Changing random color according with Rapptz/discord.py#6067
This commit is contained in:
parent
394aae33c5
commit
384cb52fdc
4 changed files with 23 additions and 23 deletions
|
@ -19,7 +19,7 @@ class Help(commands.Cog):
|
||||||
"""Liste des Cog"""
|
"""Liste des Cog"""
|
||||||
halp=discord.Embed(title = 'Liste des catégories et commandes sans catégorie',
|
halp=discord.Embed(title = 'Liste des catégories et commandes sans catégorie',
|
||||||
description = f'Utilisez `{ctx.prefix}help [catégorie]` pour en savoir plus sur elles et leur commande.',
|
description = f'Utilisez `{ctx.prefix}help [catégorie]` pour en savoir plus sur elles et leur commande.',
|
||||||
color = randint(0, 0xFFFFFF))
|
color = discord.Colour.random())
|
||||||
for name_cog in self.client.cogs:
|
for name_cog in self.client.cogs:
|
||||||
liste_cmds = ""
|
liste_cmds = ""
|
||||||
nb_cmds = 0
|
nb_cmds = 0
|
||||||
|
@ -50,7 +50,7 @@ class Help(commands.Cog):
|
||||||
for x in self.client.cogs:
|
for x in self.client.cogs:
|
||||||
for y in cog:
|
for y in cog:
|
||||||
if x == y:
|
if x == y:
|
||||||
halp = discord.Embed(title = f'{cog[0]} - Liste des commandes', description = self.client.cogs[cog[0]].__doc__, color = randint(0, 0xFFFFFF))
|
halp = discord.Embed(title = f'{cog[0]} - Liste des commandes', description = self.client.cogs[cog[0]].__doc__, color = discord.Colour.random())
|
||||||
for c in self.client.get_cog(y).get_commands():
|
for c in self.client.get_cog(y).get_commands():
|
||||||
if not c.hidden:
|
if not c.hidden:
|
||||||
cmds_help = str(c.help).split("\n")
|
cmds_help = str(c.help).split("\n")
|
||||||
|
|
|
@ -53,7 +53,7 @@ class Internet(commands.Cog):
|
||||||
|
|
||||||
image = ["png", "jpg", "jpeg", "bmp", "gif"]
|
image = ["png", "jpg", "jpeg", "bmp", "gif"]
|
||||||
if submission.url[-3:] in image:
|
if submission.url[-3:] in image:
|
||||||
embed = discord.Embed(title = f"r/{subredditchoix} pour {ctx.author.name}", color = randint(0, 0xFFFFFF), description = f"[lien du meme]({submission.url})")
|
embed = discord.Embed(title = f"r/{subredditchoix} pour {ctx.author.name}", color = discord.Colour.random(), description = f"[lien du meme]({submission.url})")
|
||||||
embed.set_footer(text = f"Meme de Reddit")
|
embed.set_footer(text = f"Meme de Reddit")
|
||||||
embed.set_image(url = submission.url)
|
embed.set_image(url = submission.url)
|
||||||
message = await ctx.send(embed = embed)
|
message = await ctx.send(embed = embed)
|
||||||
|
@ -95,7 +95,7 @@ class Internet(commands.Cog):
|
||||||
name = f"{ctx.author.nick} ({ctx.author.name}#{ctx.author.discriminator})"
|
name = f"{ctx.author.nick} ({ctx.author.name}#{ctx.author.discriminator})"
|
||||||
else:
|
else:
|
||||||
name = f"{ctx.author.name}"
|
name = f"{ctx.author.name}"
|
||||||
embed = discord.Embed(title = f"Poticha pour {name}", colour = randint(0, 0xFFFFFF))
|
embed = discord.Embed(title = f"Poticha pour {name}", colour = discord.Colour.random())
|
||||||
cat = self._random_image("http://aws.random.cat/meow")
|
cat = self._random_image("http://aws.random.cat/meow")
|
||||||
embed.set_image(url = cat[0]['file'])
|
embed.set_image(url = cat[0]['file'])
|
||||||
embed.set_footer(text = f"random.cat a pris {cat[1]} ms.")
|
embed.set_footer(text = f"random.cat a pris {cat[1]} ms.")
|
||||||
|
@ -111,7 +111,7 @@ class Internet(commands.Cog):
|
||||||
name = f"{ctx.author.nick} ({ctx.author.name}#{ctx.author.discriminator})"
|
name = f"{ctx.author.nick} ({ctx.author.name}#{ctx.author.discriminator})"
|
||||||
else:
|
else:
|
||||||
name = f"{ctx.author.name}"
|
name = f"{ctx.author.name}"
|
||||||
embed = discord.Embed(title = f"Potichien pour {name}", colour = randint(0, 0xFFFFFF))
|
embed = discord.Embed(title = f"Potichien pour {name}", colour = discord.Colour.random())
|
||||||
dog = self._random_image("https://dog.ceo/api/breeds/image/random")
|
dog = self._random_image("https://dog.ceo/api/breeds/image/random")
|
||||||
embed.set_image(url = dog[0]['message'])
|
embed.set_image(url = dog[0]['message'])
|
||||||
embed.set_footer(text = f"dog.ceo a pris {dog[1]} ms.")
|
embed.set_footer(text = f"dog.ceo a pris {dog[1]} ms.")
|
||||||
|
@ -128,7 +128,7 @@ class Internet(commands.Cog):
|
||||||
else:
|
else:
|
||||||
choice_of_nsfw = choice(liste_hot)
|
choice_of_nsfw = choice(liste_hot)
|
||||||
if ctx.channel.is_nsfw():
|
if ctx.channel.is_nsfw():
|
||||||
embed = discord.Embed(title = f"{choice_of_nsfw.capitalize()} pour {ctx.author.name}", colour = randint(0, 0xFFFFFF))
|
embed = discord.Embed(title = f"{choice_of_nsfw.capitalize()} pour {ctx.author.name}", colour = discord.Colour.random())
|
||||||
nsfw = self._random_image(f'http://api.o{choice_of_nsfw}.ru/noise/')
|
nsfw = self._random_image(f'http://api.o{choice_of_nsfw}.ru/noise/')
|
||||||
embed.set_image(url = f"http://media.o{choice_of_nsfw}.ru/{nsfw[0][0]['preview']}")
|
embed.set_image(url = f"http://media.o{choice_of_nsfw}.ru/{nsfw[0][0]['preview']}")
|
||||||
embed.set_footer(text = f"o{choice_of_nsfw}.ru a pris {nsfw[1]} ms.")
|
embed.set_footer(text = f"o{choice_of_nsfw}.ru a pris {nsfw[1]} ms.")
|
||||||
|
@ -168,14 +168,14 @@ class Internet(commands.Cog):
|
||||||
choix_site = arg.lower()
|
choix_site = arg.lower()
|
||||||
|
|
||||||
if arg.lower() == "liste":
|
if arg.lower() == "liste":
|
||||||
embed = discord.Embed(title = "Liste des sources", color = randint(0, 0xFFFFFF), description = ", ".join([key.capitalize() for key in rss_website.keys()]))
|
embed = discord.Embed(title = "Liste des sources", color = discord.Colour.random(), description = ", ".join([key.capitalize() for key in rss_website.keys()]))
|
||||||
return await ctx.send(embed = embed)
|
return await ctx.send(embed = embed)
|
||||||
|
|
||||||
newsfeed = feedparser.parse(rss_website[choix_site])
|
newsfeed = feedparser.parse(rss_website[choix_site])
|
||||||
info = choice([newsfeed.entries[i] for i in range(0, 10 if len(newsfeed.entries) > 10 else len(newsfeed.entries))])
|
info = choice([newsfeed.entries[i] for i in range(0, 10 if len(newsfeed.entries) > 10 else len(newsfeed.entries))])
|
||||||
|
|
||||||
desc = "Pas de description trouvée." if "<p>" in info.description or "</a>" in info.description else info.description
|
desc = "Pas de description trouvée." if "<p>" in info.description or "</a>" in info.description else info.description
|
||||||
embed = discord.Embed(title = info.title, color = randint(0, 0xFFFFFF), description = f"[**lien de la news**]({info.link})\n\n{desc}")
|
embed = discord.Embed(title = info.title, color = discord.Colour.random(), description = f"[**lien de la news**]({info.link})\n\n{desc}")
|
||||||
try:
|
try:
|
||||||
embed.set_author(name = info.author)
|
embed.set_author(name = info.author)
|
||||||
except:
|
except:
|
||||||
|
|
|
@ -157,7 +157,7 @@ class Song:
|
||||||
def create_embed(self):
|
def create_embed(self):
|
||||||
embed = (discord.Embed(title="Joue",
|
embed = (discord.Embed(title="Joue",
|
||||||
description=f"\n[{self.source.title}]({self.source.url})\n",
|
description=f"\n[{self.source.title}]({self.source.url})\n",
|
||||||
color=randint(0, 0xFFFFFF))
|
color=discord.Colour.random())
|
||||||
.add_field(name="Durée", value=self.source.duration)
|
.add_field(name="Durée", value=self.source.duration)
|
||||||
.add_field(name="Demandé par", value=self.requester.mention)
|
.add_field(name="Demandé par", value=self.requester.mention)
|
||||||
.add_field(name="Chaîne", value=f"[{self.source.uploader}]({self.source.uploader_url})")
|
.add_field(name="Chaîne", value=f"[{self.source.uploader}]({self.source.uploader_url})")
|
||||||
|
@ -419,7 +419,7 @@ class Music(commands.Cog):
|
||||||
for i, song in enumerate(ctx.voice_state.songs[start:end], start=start):
|
for i, song in enumerate(ctx.voice_state.songs[start:end], start=start):
|
||||||
queue += f"`{i + 1}.` [**{song.source.title}**]({song.source.url})\n"
|
queue += f"`{i + 1}.` [**{song.source.title}**]({song.source.url})\n"
|
||||||
|
|
||||||
embed = (discord.Embed(description=f"**{len(ctx.voice_state.songs)} piste{'s' if len(ctx.voice_state.songs)>1 else ''} :**\n\n{queue}", color = randint(0, 0xFFFFFF))
|
embed = (discord.Embed(description=f"**{len(ctx.voice_state.songs)} piste{'s' if len(ctx.voice_state.songs)>1 else ''} :**\n\n{queue}", color = discord.Colour.random())
|
||||||
.set_footer(text=f"Page {page}/{pages}"))
|
.set_footer(text=f"Page {page}/{pages}"))
|
||||||
await ctx.send(embed=embed)
|
await ctx.send(embed=embed)
|
||||||
|
|
||||||
|
@ -500,7 +500,7 @@ class Music(commands.Cog):
|
||||||
message = await ctx.send(f":mag: **Cherche les paroles de ** `{song}`")
|
message = await ctx.send(f":mag: **Cherche les paroles de ** `{song}`")
|
||||||
temps_requete = int(round(time.time() * 1000))
|
temps_requete = int(round(time.time() * 1000))
|
||||||
song_genius = genius.search_song(song)
|
song_genius = genius.search_song(song)
|
||||||
couleur_embed = randint(0, 0xFFFFFF)
|
couleur_embed = discord.Colour.random()
|
||||||
try:
|
try:
|
||||||
paroles = song_genius.lyrics
|
paroles = song_genius.lyrics
|
||||||
except:
|
except:
|
||||||
|
|
|
@ -20,14 +20,14 @@ class Utils(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 client a calculer le ping (en millisecondes)\n\n:heartbeat: correspond au temps que met le client a réagir au messages (en millisecondes)"))
|
return await ctx.send(embed = discord.Embed(color = discord.Colour.random(), description = ":hourglass: correspond au temps entre deux battements de cœurs (en millisecondes)\n\n:stopwatch: correspond au temps que met le client a calculer le ping (en millisecondes)\n\n:heartbeat: correspond au temps que met le client 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.client.latency * 1000)}ms\n\n:stopwatch: {ping2}ms\n\n:heartbeat: {ping}ms'))
|
await message.edit(embed = discord.Embed(color = discord.Colour.random(), description = f':hourglass: {round(self.client.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(name='avatar')
|
@commands.command(name='avatar')
|
||||||
|
@ -38,7 +38,7 @@ class Utils(commands.Cog):
|
||||||
else:
|
else:
|
||||||
user = self.client.get_user(int(user[2:-1].replace("!","")))
|
user = self.client.get_user(int(user[2:-1].replace("!","")))
|
||||||
await ctx.message.add_reaction(emoji = '✅')
|
await ctx.message.add_reaction(emoji = '✅')
|
||||||
embed = discord.Embed(description = f"[lien vers la photo de profil]({user.avatar_url}) de {user.mention}", color = randint(0, 0xFFFFFF))
|
embed = discord.Embed(description = f"[lien vers la photo de profil]({user.avatar_url}) de {user.mention}", color = discord.Colour.random())
|
||||||
embed.set_author(name = f"Photo de profil de {user.name}")
|
embed.set_author(name = f"Photo de profil de {user.name}")
|
||||||
embed.set_image(url = user.avatar_url)
|
embed.set_image(url = user.avatar_url)
|
||||||
await ctx.send(embed = embed)
|
await ctx.send(embed = embed)
|
||||||
|
@ -74,7 +74,7 @@ class Utils(commands.Cog):
|
||||||
answer = str(round(float(answer),2))
|
answer = str(round(float(answer),2))
|
||||||
equation = f"'{equation}' arrondi à 2"
|
equation = f"'{equation}' arrondi à 2"
|
||||||
equation = equation.replace('*', '×').replace('/', '÷').replace('>=', '≥').replace('<=', '≤')
|
equation = equation.replace('*', '×').replace('/', '÷').replace('>=', '≥').replace('<=', '≤')
|
||||||
embed = discord.Embed(color = randint(0, 0xFFFFFF), title = 'Calculatrice')
|
embed = discord.Embed(color = discord.Colour.random(), title = 'Calculatrice')
|
||||||
embed.set_footer(text = ctx.author)
|
embed.set_footer(text = ctx.author)
|
||||||
|
|
||||||
embed.add_field(name = 'Calcul :', value = equation, inline = False)
|
embed.add_field(name = 'Calcul :', value = equation, inline = False)
|
||||||
|
@ -142,7 +142,7 @@ class Utils(commands.Cog):
|
||||||
return await ctx.send("Ta note doit faire moins de 2048 caractères.")
|
return await ctx.send("Ta note doit faire moins de 2048 caractères.")
|
||||||
else:
|
else:
|
||||||
await ctx.message.delete()
|
await ctx.message.delete()
|
||||||
embed = discord.Embed(description = text, color = randint(0, 0xFFFFFF))
|
embed = discord.Embed(description = text, color = discord.Colour.random())
|
||||||
embed.set_author(name = f"Mémo noté depuis {ctx.guild.name}", icon_url = ctx.author.avatar_url)
|
embed.set_author(name = f"Mémo noté depuis {ctx.guild.name}", icon_url = ctx.author.avatar_url)
|
||||||
embed.set_footer(text = f'📝 le {datetime.now(pytz.timezone("Europe/Paris")).strftime("%d/%m/%Y à %H:%M:%S")}')
|
embed.set_footer(text = f'📝 le {datetime.now(pytz.timezone("Europe/Paris")).strftime("%d/%m/%Y à %H:%M:%S")}')
|
||||||
await ctx.author.send(embed = embed)
|
await ctx.author.send(embed = embed)
|
||||||
|
@ -157,7 +157,7 @@ class Utils(commands.Cog):
|
||||||
"""Donne des infos sur le bot.\n ➡ Syntaxe: .infos/info"""
|
"""Donne des infos sur le bot.\n ➡ Syntaxe: .infos/info"""
|
||||||
appinfo = await self.client.application_info()
|
appinfo = await self.client.application_info()
|
||||||
|
|
||||||
embed = discord.Embed(color = randint(0, 0xFFFFFF))
|
embed = discord.Embed(color = discord.Colour.random())
|
||||||
|
|
||||||
embed.set_author(name = appinfo.name, icon_url = self.client.user.avatar_url)
|
embed.set_author(name = appinfo.name, icon_url = self.client.user.avatar_url)
|
||||||
|
|
||||||
|
@ -209,25 +209,25 @@ class Utils(commands.Cog):
|
||||||
"""Affiche la carte voulue d'Among Us.\n ➡ Syntaxe: .amongus <carte>"""
|
"""Affiche la carte voulue d'Among Us.\n ➡ Syntaxe: .amongus <carte>"""
|
||||||
if map.lower() in self._map_list_among_us("mira"):
|
if map.lower() in self._map_list_among_us("mira"):
|
||||||
image = "https://i.imgur.com/6ijrH1h.jpg"
|
image = "https://i.imgur.com/6ijrH1h.jpg"
|
||||||
embed = discord.Embed(title = f"Map Mira HQ d'Among Us", color = randint(0, 0xFFFFFF), description = f"[lien de l'image]({image})")
|
embed = discord.Embed(title = f"Map Mira HQ d'Among Us", color = discord.Colour.random(), description = f"[lien de l'image]({image})")
|
||||||
embed.set_image(url = image)
|
embed.set_image(url = image)
|
||||||
await ctx.send(embed = embed)
|
await ctx.send(embed = embed)
|
||||||
await ctx.message.add_reaction(emoji = '✅')
|
await ctx.message.add_reaction(emoji = '✅')
|
||||||
elif map.lower() in self._map_list_among_us("polus"):
|
elif map.lower() in self._map_list_among_us("polus"):
|
||||||
image = "https://i.imgur.com/mhFmcw3.jpg"
|
image = "https://i.imgur.com/mhFmcw3.jpg"
|
||||||
embed = discord.Embed(title = f"Map Polus d'Among Us", color = randint(0, 0xFFFFFF), description = f"[lien de l'image]({image})")
|
embed = discord.Embed(title = f"Map Polus d'Among Us", color = discord.Colour.random(), description = f"[lien de l'image]({image})")
|
||||||
embed.set_image(url = image)
|
embed.set_image(url = image)
|
||||||
await ctx.send(embed = embed)
|
await ctx.send(embed = embed)
|
||||||
await ctx.message.add_reaction(emoji = '✅')
|
await ctx.message.add_reaction(emoji = '✅')
|
||||||
elif map.lower() in self._map_list_among_us("skeld"):
|
elif map.lower() in self._map_list_among_us("skeld"):
|
||||||
image = "https://i.imgur.com/OSXI4Zv.jpg"
|
image = "https://i.imgur.com/OSXI4Zv.jpg"
|
||||||
embed = discord.Embed(title = f"Map The Skeld d'Among Us", color = randint(0, 0xFFFFFF), description = f"[lien de l'image]({image})")
|
embed = discord.Embed(title = f"Map The Skeld d'Among Us", color = discord.Colour.random(), description = f"[lien de l'image]({image})")
|
||||||
embed.set_image(url = image)
|
embed.set_image(url = image)
|
||||||
await ctx.send(embed = embed)
|
await ctx.send(embed = embed)
|
||||||
await ctx.message.add_reaction(emoji = '✅')
|
await ctx.message.add_reaction(emoji = '✅')
|
||||||
elif map.lower() in self._map_list_among_us("airship"):
|
elif map.lower() in self._map_list_among_us("airship"):
|
||||||
image = "https://i.imgur.com/CYbPlQ6.png"
|
image = "https://i.imgur.com/CYbPlQ6.png"
|
||||||
embed = discord.Embed(title = f"Map Airship d'Among Us", color = randint(0, 0xFFFFFF), description = f"[lien de l'image]({image})")
|
embed = discord.Embed(title = f"Map Airship d'Among Us", color = discord.Colour.random(), description = f"[lien de l'image]({image})")
|
||||||
embed.set_image(url = image)
|
embed.set_image(url = image)
|
||||||
await ctx.send(embed = embed)
|
await ctx.send(embed = embed)
|
||||||
await ctx.message.add_reaction(emoji = '✅')
|
await ctx.message.add_reaction(emoji = '✅')
|
||||||
|
@ -243,7 +243,7 @@ class Utils(commands.Cog):
|
||||||
nom = f"{user[0].name}#{user[0].discriminator}"
|
nom = f"{user[0].name}#{user[0].discriminator}"
|
||||||
if user[0].nick:
|
if user[0].nick:
|
||||||
nom = f"{user[0].nick} ({user[0].name}#{user[0].discriminator})"
|
nom = f"{user[0].nick} ({user[0].name}#{user[0].discriminator})"
|
||||||
embed = discord.Embed(color = randint(0, 0xFFFFFF)).set_author(name = nom, icon_url = user[0].avatar_url)
|
embed = discord.Embed(color = discord.Colour.random()).set_author(name = nom, icon_url = user[0].avatar_url)
|
||||||
|
|
||||||
embed.add_field(name = "ID", value = user[0].id)
|
embed.add_field(name = "ID", value = user[0].id)
|
||||||
|
|
||||||
|
@ -328,7 +328,7 @@ class Utils(commands.Cog):
|
||||||
shuffle(emojis_chosen)
|
shuffle(emojis_chosen)
|
||||||
for i in range(len(args[1:])):
|
for i in range(len(args[1:])):
|
||||||
message += f"{emojis_chosen[i]} -> {propositions[i]}\n"
|
message += f"{emojis_chosen[i]} -> {propositions[i]}\n"
|
||||||
embed = discord.Embed(title = question, description = message,color = randint(0, 0xFFFFFF)).set_footer(text = self.user_or_nick(ctx.author), icon_url = ctx.author.avatar_url)
|
embed = discord.Embed(title = question, description = message,color = discord.Colour.random()).set_footer(text = self.user_or_nick(ctx.author), icon_url = ctx.author.avatar_url)
|
||||||
sondage = await ctx.send(embed = embed)
|
sondage = await ctx.send(embed = embed)
|
||||||
for i in range(len(args[1:])):
|
for i in range(len(args[1:])):
|
||||||
await sondage.add_reaction(emoji = emojis_chosen[i])
|
await sondage.add_reaction(emoji = emojis_chosen[i])
|
||||||
|
|
Reference in a new issue