lisibilité accru
This commit is contained in:
parent
85eecde4dd
commit
e6a129d8fb
2 changed files with 12 additions and 5 deletions
14
cogs/commands.py
Executable file → Normal file
14
cogs/commands.py
Executable file → Normal file
|
@ -16,14 +16,18 @@ class Commands(commands.Cog):
|
||||||
async def ping(self, ctx, *, question = '0'):
|
async def ping(self, ctx, *, question = '0'):
|
||||||
"""Affiche mon ping.\n ➡ Syntaxe: .ping [help]"""
|
"""Affiche mon ping.\n ➡ Syntaxe: .ping [help]"""
|
||||||
if question == 'help':
|
if question == 'help':
|
||||||
return await ctx.send(embed = discord.Embed(color = randint(0, 0xFFFFFF), description = ":hourglass: correspond au temps entre deux battements de cœurs (en millisecondes)\n\n:stopwatch: correspond au temps que met le bot a calculer le ping (en millisecondes)\n\n:heartbeat: correspond au temps que met le bot a réagir au messages (en millisecondes)"))
|
return await ctx.send(embed = discord.Embed(color = randint(0, 0xFFFFFF),
|
||||||
|
description = ":hourglass: correspond au temps entre deux battements de cœurs (en millisecondes)\n\n"
|
||||||
|
+ ":stopwatch: correspond au temps que met le bot a calculer le ping (en millisecondes)\n\n"
|
||||||
|
+ ":heartbeat: correspond au temps que met le bot a réagir au messages (en millisecondes)"))
|
||||||
else:
|
else:
|
||||||
now = int(round(time.time() * 1000))
|
now = int(round(time.time() * 1000))
|
||||||
ping = now - int(round(ctx.message.created_at.timestamp() * 1000))
|
ping = now - int(round(ctx.message.created_at.timestamp() * 1000))
|
||||||
embed = discord.Embed(description = 'Pinging...')
|
embed = discord.Embed(description = 'Pinging...')
|
||||||
message = await ctx.send(embed = embed)
|
message = await ctx.send(embed = embed)
|
||||||
ping2 = int(round(time.time() * 1000)) - now
|
ping2 = int(round(time.time() * 1000)) - now
|
||||||
await message.edit(embed = discord.Embed(color = randint(0, 0xFFFFFF), description = f':hourglass: {round(self.bot.latency * 1000)}ms\n\n:stopwatch: {ping2}ms\n\n:heartbeat: {ping}ms'))
|
await message.edit(embed = discord.Embed(color = randint(0, 0xFFFFFF),
|
||||||
|
description = f':hourglass: {round(self.bot.latency * 1000)}ms\n\n:stopwatch: {ping2}ms\n\n:heartbeat: {ping}ms'))
|
||||||
await ctx.message.add_reaction(emoji = '✅')
|
await ctx.message.add_reaction(emoji = '✅')
|
||||||
|
|
||||||
@commands.command(aliases = ['calculatrice', 'calcu'])
|
@commands.command(aliases = ['calculatrice', 'calcu'])
|
||||||
|
@ -111,7 +115,8 @@ class Commands(commands.Cog):
|
||||||
|
|
||||||
embed.set_author(name='Bot Licence L1', icon_url=ctx.author.avatar_url)
|
embed.set_author(name='Bot Licence L1', icon_url=ctx.author.avatar_url)
|
||||||
|
|
||||||
total_online = len({m.id for m in self.bot.get_all_members() if m.status is discord.Status.online}) # liste utilisateurs de tous les serveurs où le bot est, en ligne
|
# liste utilisateurs de tous les serveurs où le bot est, en ligne
|
||||||
|
total_online = len({m.id for m in self.bot.get_all_members() if m.status is discord.Status.online})
|
||||||
total_unique = len(self.bot.users) # pareil mais en comptants les hors lignes aussi
|
total_unique = len(self.bot.users) # pareil mais en comptants les hors lignes aussi
|
||||||
|
|
||||||
# liste des différents canaux
|
# liste des différents canaux
|
||||||
|
@ -128,7 +133,8 @@ class Commands(commands.Cog):
|
||||||
embed.add_field(name='Serveurs', value=len(self.bot.guilds))
|
embed.add_field(name='Serveurs', value=len(self.bot.guilds))
|
||||||
embed.add_field(name='Membres', value=f'{total_unique} au total\n{total_online} en ligne')
|
embed.add_field(name='Membres', value=f'{total_unique} au total\n{total_online} en ligne')
|
||||||
embed.add_field(name='Channels', value=f'{text} textuelles\n{voice} vocales')
|
embed.add_field(name='Channels', value=f'{text} textuelles\n{voice} vocales')
|
||||||
embed.set_footer(text=f'Basé sur discord.py {discord.__version__}') # ca peut être utile de connaitre quel version le bot utilise sans devoir se connecter a distance au serveur qui fait tourner le bot
|
# ca peut être utile de connaitre quel version le bot utilise sans devoir se connecter a distance au serveur qui fait tourner le bot
|
||||||
|
embed.set_footer(text=f'Basé sur discord.py {discord.__version__}')
|
||||||
await ctx.send(embed=embed)
|
await ctx.send(embed=embed)
|
||||||
|
|
||||||
|
|
||||||
|
|
3
main.py
Executable file → Normal file
3
main.py
Executable file → Normal file
|
@ -16,7 +16,8 @@ async def on_connect():
|
||||||
# le status du bot
|
# le status du bot
|
||||||
@client.event
|
@client.event
|
||||||
async def on_ready():
|
async def on_ready():
|
||||||
await client.change_presence(status = discord.Status.online, activity = discord.Activity(name = "https://github.com/Mylloon/bot-licence", type = discord.ActivityType.competing))
|
await client.change_presence(status = discord.Status.online, activity = discord.Activity(name = "https://github.com/Mylloon/bot-licence",
|
||||||
|
type = discord.ActivityType.competing))
|
||||||
print("Bot chargé à 100%.")
|
print("Bot chargé à 100%.")
|
||||||
|
|
||||||
@client.event
|
@client.event
|
||||||
|
|
Reference in a new issue