本文整理汇总了Python中discord.__version__方法的典型用法代码示例。如果您正苦于以下问题:Python discord.__version__方法的具体用法?Python discord.__version__怎么用?Python discord.__version__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类discord
的用法示例。
在下文中一共展示了discord.__version__方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: botinfo
# 需要导入模块: import discord [as 别名]
# 或者: from discord import __version__ [as 别名]
def botinfo(ctx, **_):
"""
[CMD_KEY]botinfo
General information about DueUtil.
"""
info_embed = discord.Embed(title="DueUtil's Information", type="rich", color=gconf.DUE_COLOUR)
info_embed.description = "DueUtil is customizable bot to add fun commands, quests and battles to your server."
info_embed.add_field(name="Created by", value="[MacDue#4453](https://dueutil.tech/)")
info_embed.add_field(name="Framework",
value="[discord.py %s :two_hearts:](http://discordpy.readthedocs.io/en/latest/)"
% discord.__version__)
info_embed.add_field(name="Version", value=gconf.VERSION),
info_embed.add_field(name="Invite Due!", value="https://dueutil.tech/invite", inline=False)
info_embed.add_field(name="Support server",
value="For help with the bot or a laugh join **https://discord.gg/n4b94VA**!")
await util.say(ctx.channel, embed=info_embed)
示例2: stats
# 需要导入模块: import discord [as 别名]
# 或者: from discord import __version__ [as 别名]
def stats(self, ctx):
guilds = sum(await self.bot.cogs["Communication"].handler("guild_count", self.bot.cluster_count))
channels = sum(await self.bot.cogs["Communication"].handler("channel_count", self.bot.cluster_count))
users = sum(await self.bot.cogs["Communication"].handler("user_count", self.bot.cluster_count))
embed = discord.Embed(title=f"{self.bot.user.name} Statistics", colour=self.bot.primary_colour)
embed.add_field(name="Owner", value="CHamburr#2591")
embed.add_field(name="Bot Version", value=self.bot.version)
embed.add_field(name="Uptime", value=self.get_bot_uptime(brief=True))
embed.add_field(name="Clusters", value=f"{self.bot.cluster}/{self.bot.cluster_count}")
if ctx.guild:
embed.add_field(name="Shards", value=f"{ctx.guild.shard_id + 1}/{self.bot.shard_count}")
else:
embed.add_field(name="Shards", value=f"{self.bot.shard_count}")
embed.add_field(name="Servers", value=str(guilds))
embed.add_field(name="Channels", value=str(channels))
embed.add_field(name="Users", value=str(users))
embed.add_field(name="CPU Usage", value=f"{psutil.cpu_percent()}%")
embed.add_field(name="RAM Usage", value=f"{psutil.virtual_memory().percent}%")
embed.add_field(name="Python Version", value=platform.python_version())
embed.add_field(name="discord.py Version", value=discord.__version__)
embed.set_thumbnail(url=self.bot.user.avatar_url)
embed.set_footer(
text=f"Made with ❤ using discord.py", icon_url="https://www.python.org/static/opengraph-icon-200x200.png",
)
await ctx.send(embed=embed)
示例3: on_ready
# 需要导入模块: import discord [as 别名]
# 或者: from discord import __version__ [as 别名]
def on_ready():
print(f"{bot.user.name} - Online")
print(f"discord.py {discord.__version__}\n")
print("-------------------------------")
await bot.change_presence(activity=discord.Game(name=">help | >report \"x\""))
示例4: botinformation
# 需要导入模块: import discord [as 别名]
# 或者: from discord import __version__ [as 别名]
def botinformation(cmd, pld):
"""
:param cmd: The command object referenced in the command.
:type cmd: sigma.core.mechanics.command.SigmaCommand
:param pld: The payload with execution data and details.
:type pld: sigma.core.mechanics.payload.CommandPayload
"""
version = cmd.bot.info.get_version()
authors = cmd.bot.info.get_authors().authors
full_version = f'{version.major}.{version.minor}.{version.patch}'
if version.beta:
full_version += ' Beta'
sigma_title = f'Apex Sigma: v{full_version} {version.codename}'
env_text = f'Language: **Python** {sys.version.split()[0]}'
env_text += f'\nLibrary: **discord.py** {discord.__version__}'
env_text += f'\nPlatform: **{sys.platform.upper()}**'
auth_text = ''
for author in authors:
auth = await cmd.bot.get_user(author.id)
if auth:
auth_text += f'\n**{auth.name}**#{auth.discriminator}'
else:
auth_text += f'\n**{author.name}**#{author.discriminator}'
response = discord.Embed(color=0x1B6F5F, timestamp=arrow.get(version.timestamp).datetime)
response.set_author(name=sigma_title, icon_url=sigma_image, url=support_url)
response.add_field(name='Authors', value=auth_text)
response.add_field(name='Environment', value=env_text)
response.set_footer(text=f'Last updated {arrow.get(version.timestamp).humanize()}')
await pld.msg.channel.send(embed=response)
示例5: req_check_deps
# 需要导入模块: import discord [as 别名]
# 或者: from discord import __version__ [as 别名]
def req_check_deps():
try:
import discord
if discord.version_info.major < 1:
log.critical("This version of MusicBot requires a newer version of discord.py (1.0+). Your version is {0}. Try running update.py.".format(discord.__version__))
bugger_off()
except ImportError:
# if we can't import discord.py, an error will be thrown later down the line anyway
pass
示例6: on_ready
# 需要导入模块: import discord [as 别名]
# 或者: from discord import __version__ [as 别名]
def on_ready():
logger.info(f"Starting Graham v{__version__}")
logger.info(f"Discord.py version {discord.__version__}")
logger.info(f"Bot name: {client.user.name}")
logger.info(f"Bot Discord ID: {client.user.id}")
await client.change_presence(activity=discord.Game(config.playing_status))
# Process any transactions in our DB that are outstanding
logger.info(f"Re-queueing any unprocessed transactions")
unprocessed_txs = await Transaction.filter(block_hash=None, destination__not_isnull=True).all().prefetch_related('sending_user', 'receiving_user')
for tx in unprocessed_txs:
await TransactionQueue.instance(bot=client).put(tx)
logger.info(f"Re-queued {len(unprocessed_txs)} transactions")
示例7: __init__
# 需要导入模块: import discord [as 别名]
# 或者: from discord import __version__ [as 别名]
def __init__(self, config, misc_config, logger, test,
pg_controller: PostgresController, chanreact, blacklist):
"""
init for bot class
"""
self.pg_controller = pg_controller
self.start_time = int(time())
self.version = discord.__version__
if test:
self.credentials = os.environ['TOKEN']
else:
self.credentials = config['token']
self.guild_id = config['guild_id']
self.mod_log = config['mod_log']
self.mod_info = config['mod_info']
self.emoji_ignore_channels = config['emoji_ignore_channels']
self.traffic_ignore_channels = config['traffic_ignore_channels']
self.filter_channels = config['filter_channels']
self.filter_allowed = config['filter_allowed']
self.spoiler_channels = config['spoiler_channels']
self.wait_time = config['wait_time']
self.clover_days = config['clover_days']
self.dm_forward = config['dm_forward']
self.timeout_id = misc_config['timeout_id']
self.logger = logger
self.chanreact = chanreact
self.blglobal = blacklist
super().__init__('-')
示例8: status
# 需要导入模块: import discord [as 别名]
# 或者: from discord import __version__ [as 别名]
def status(self, ctx):
'''Infos über den Bot'''
timeUp = time.time() - self.bot.startTime
hours = timeUp / 3600
minutes = (timeUp / 60) % 60
seconds = timeUp % 60
admin = self.bot.AppInfo.owner
users = 0
channel = 0
if len(self.bot.commands_used.items()):
commandsChart = sorted(self.bot.commands_used.items(), key=lambda t: t[1], reverse=False)
topCommand = commandsChart.pop()
commandsInfo = '{} (Top-Command: {} x {})'.format(sum(self.bot.commands_used.values()), topCommand[1], topCommand[0])
else:
commandsInfo = str(sum(self.bot.commands_used.values()))
for guild in self.bot.guilds:
users += len(guild.members)
channel += len(guild.channels)
embed = discord.Embed(color=ctx.me.top_role.colour)
embed.set_footer(text='Dieser Bot ist Open-Source auf GitHub: https://github.com/Der-Eddy/discord_bot')
embed.set_thumbnail(url=ctx.me.avatar_url)
embed.add_field(name='Admin', value=admin, inline=False)
embed.add_field(name='Uptime', value='{0:.0f} Stunden, {1:.0f} Minuten und {2:.0f} Sekunden\n'.format(hours, minutes, seconds), inline=False)
embed.add_field(name='Beobachtete Benutzer', value=users, inline=True)
embed.add_field(name='Beobachtete Server', value=len(self.bot.guilds), inline=True)
embed.add_field(name='Beobachtete Channel', value=channel, inline=True)
embed.add_field(name='Ausgeführte Commands', value=commandsInfo, inline=True)
embed.add_field(name='Bot Version', value=self.bot.botVersion, inline=True)
embed.add_field(name='Discord.py Version', value=discord.__version__, inline=True)
embed.add_field(name='Python Version', value=platform.python_version(), inline=True)
# embed.add_field(name='Speicher Auslastung', value=f'{round(memory_usage(-1)[0], 3)} MB', inline=True)
embed.add_field(name='Betriebssystem', value=f'{platform.system()} {platform.release()} {platform.version()}', inline=False)
await ctx.send('**:information_source:** Informationen über diesen Bot:', embed=embed)
示例9: on_ready
# 需要导入模块: import discord [as 别名]
# 或者: from discord import __version__ [as 别名]
def on_ready():
if bot.user.id == 701915238488080457:
bot.dev = True
else:
bot.dev = False
print('Logged in as')
print(f'Bot-Name: {bot.user.name}')
print(f'Bot-ID: {bot.user.id}')
print(f'Dev Mode: {bot.dev}')
print(f'Discord Version: {discord.__version__}')
print(f'Bot Version: {__version__}')
bot.AppInfo = await bot.application_info()
print(f'Owner: {bot.AppInfo.owner}')
print('------')
for cog in loadconfig.__cogs__:
try:
bot.load_extension(cog)
except Exception:
print(f'Couldn\'t load cog {cog}')
bot.commands_used = Counter()
bot.startTime = time.time()
bot.botVersion = __version__
bot.userAgentHeaders = {'User-Agent': f'linux:shinobu_discordbot:v{__version__} (by Der-Eddy)'}
bot.gamesLoop = asyncio.ensure_future(_randomGame())
_setupDatabase('reaction.db')