first commit
This commit is contained in:
parent
0432400880
commit
56be15c10f
6 changed files with 226 additions and 217 deletions
0
.gitignore
vendored
Normal file → Executable file
0
.gitignore
vendored
Normal file → Executable file
9
README.md
Normal file → Executable file
9
README.md
Normal file → Executable file
|
@ -16,3 +16,12 @@ token = "ton token"
|
||||||
#### __Mise en marche__
|
#### __Mise en marche__
|
||||||
|
|
||||||
- Lancer [main.py](main.py)
|
- Lancer [main.py](main.py)
|
||||||
|
|
||||||
|
## __Commandes__
|
||||||
|
|
||||||
|
- Gestion des réactions à un certain message + attribution des rôles correspondant
|
||||||
|
- Commande info pour une liste d'informations sur le bot
|
||||||
|
- Commande calculatrice pour faire des calculs simples
|
||||||
|
- Commande help pour plus de précisions sur les commandes
|
||||||
|
- Commande syntax qui explique la syntaxe sur Discord
|
||||||
|
- Commande ping pour vérifier le ping du bot
|
218
cogs/commands.py
Normal file → Executable file
218
cogs/commands.py
Normal file → Executable file
|
@ -5,126 +5,126 @@ from datetime import datetime
|
||||||
import time
|
import time
|
||||||
|
|
||||||
class Commands(commands.Cog):
|
class Commands(commands.Cog):
|
||||||
"""Commandes générales du bot."""
|
"""Commandes générales du bot."""
|
||||||
|
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
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()
|
@commands.command()
|
||||||
async def calc(self, ctx, *, msg):
|
async def calc(self, ctx, *, msg):
|
||||||
"""Calculatrice.\n ➡ Syntaxe: .calc <calcul>"""
|
"""Calculatrice.\n ➡ Syntaxe: .calc <calcul>"""
|
||||||
equation = msg.replace('^', '**').replace('x', '*').replace('×', '*').replace('÷', '/').replace('≥', '>=').replace('≤', '<=')
|
equation = msg.replace('^', '**').replace('x', '*').replace('×', '*').replace('÷', '/').replace('≥', '>=').replace('≤', '<=')
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
if '=' in equation:
|
if '=' in equation:
|
||||||
if '<' in equation:
|
if '<' in equation:
|
||||||
left = eval(equation.split("<=")[0])
|
left = eval(equation.split("<=")[0])
|
||||||
right = eval(equation.split("<=")[1])
|
right = eval(equation.split("<=")[1])
|
||||||
answer = str(left <= right)
|
answer = str(left <= right)
|
||||||
elif '>' in equation:
|
elif '>' in equation:
|
||||||
left = eval(equation.split(">=")[0])
|
left = eval(equation.split(">=")[0])
|
||||||
right = eval(equation.split(">=")[1])
|
right = eval(equation.split(">=")[1])
|
||||||
answer = str(left >= right)
|
answer = str(left >= right)
|
||||||
else:
|
else:
|
||||||
left = eval(equation.split("=")[0])
|
left = eval(equation.split("=")[0])
|
||||||
right = eval(equation.split("=")[1])
|
right = eval(equation.split("=")[1])
|
||||||
answer = str(left == right)
|
answer = str(left == right)
|
||||||
else:
|
else:
|
||||||
answer = str(eval(equation))
|
answer = str(eval(equation))
|
||||||
except ZeroDivisionError:
|
except ZeroDivisionError:
|
||||||
return await ctx.send("Tu ne peux pas divisé par 0.")
|
return await ctx.send("Tu ne peux pas divisé par 0.")
|
||||||
except TypeError:
|
except TypeError:
|
||||||
return await ctx.send("Requête de calcul invalide.")
|
return await ctx.send("Requête de calcul invalide.")
|
||||||
if '.' in answer:
|
if '.' in answer:
|
||||||
aftercomma = answer.split(".")[1]
|
aftercomma = answer.split(".")[1]
|
||||||
if len(aftercomma) > 2:
|
if len(aftercomma) > 2:
|
||||||
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 = randint(0, 0xFFFFFF), 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)
|
||||||
embed.add_field(name = 'Réponse :', value = answer.replace('False', 'Faux').replace('True', 'Vrai'), inline = False)
|
embed.add_field(name = 'Réponse :', value = answer.replace('False', 'Faux').replace('True', 'Vrai'), inline = False)
|
||||||
await ctx.message.add_reaction(emoji = '✅')
|
await ctx.message.add_reaction(emoji = '✅')
|
||||||
await ctx.send(content = None, embed = embed)
|
await ctx.send(content = None, embed = embed)
|
||||||
@calc.error
|
@calc.error
|
||||||
async def calc_error(self, ctx, error):
|
async def calc_error(self, ctx, error):
|
||||||
await ctx.send("Tu n'as pas spécifié de calcul.")
|
await ctx.send("Tu n'as pas spécifié de calcul.")
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
async def syntax(self, ctx):
|
async def syntax(self, ctx):
|
||||||
"""Informations pour bien éditer son texte."""
|
"""Informations pour bien éditer son texte."""
|
||||||
syntaxe = "-----------------------------------------------------\n"
|
syntaxe = "-----------------------------------------------------\n"
|
||||||
syntaxe += discord.utils.escape_markdown("```Js\n")
|
syntaxe += discord.utils.escape_markdown("```Js\n")
|
||||||
syntaxe += discord.utils.escape_markdown("//code en js (possible de remplacer 'js' par d'autres languages . adaptez le !)\n")
|
syntaxe += discord.utils.escape_markdown("//code en js (possible de remplacer 'js' par d'autres languages . adaptez le !)\n")
|
||||||
syntaxe += discord.utils.escape_markdown('console.log("hi");\n')
|
syntaxe += discord.utils.escape_markdown('console.log("hi");\n')
|
||||||
syntaxe += discord.utils.escape_markdown("```\n")
|
syntaxe += discord.utils.escape_markdown("```\n")
|
||||||
syntaxe += "```Js\n"
|
syntaxe += "```Js\n"
|
||||||
syntaxe += "//code en js (possible de remplacer 'js' par d'autres languages . adaptez le !)\n"
|
syntaxe += "//code en js (possible de remplacer 'js' par d'autres languages . adaptez le !)\n"
|
||||||
syntaxe += 'console.log("hi");\n'
|
syntaxe += 'console.log("hi");\n'
|
||||||
syntaxe += "```\n"
|
syntaxe += "```\n"
|
||||||
syntaxe += "-----------------------------------------------------\n"
|
syntaxe += "-----------------------------------------------------\n"
|
||||||
syntaxe += discord.utils.escape_markdown("`code sur une seule ligne`\n")
|
syntaxe += discord.utils.escape_markdown("`code sur une seule ligne`\n")
|
||||||
syntaxe += "`code sur une seule ligne`\n"
|
syntaxe += "`code sur une seule ligne`\n"
|
||||||
syntaxe += "-----------------------------------------------------\n"
|
syntaxe += "-----------------------------------------------------\n"
|
||||||
syntaxe += discord.utils.escape_markdown("*texte en italique*\n")
|
syntaxe += discord.utils.escape_markdown("*texte en italique*\n")
|
||||||
syntaxe += "*texte en italique*\n"
|
syntaxe += "*texte en italique*\n"
|
||||||
syntaxe += "-----------------------------------------------------\n"
|
syntaxe += "-----------------------------------------------------\n"
|
||||||
syntaxe += discord.utils.escape_markdown("**text en gras**\n")
|
syntaxe += discord.utils.escape_markdown("**text en gras**\n")
|
||||||
syntaxe += "**text en gras**\n"
|
syntaxe += "**text en gras**\n"
|
||||||
syntaxe += "-----------------------------------------------------\n"
|
syntaxe += "-----------------------------------------------------\n"
|
||||||
syntaxe += discord.utils.escape_markdown("***text en italique-gras***\n")
|
syntaxe += discord.utils.escape_markdown("***text en italique-gras***\n")
|
||||||
syntaxe += "***text en italique-gras***\n"
|
syntaxe += "***text en italique-gras***\n"
|
||||||
syntaxe += "-----------------------------------------------------\n"
|
syntaxe += "-----------------------------------------------------\n"
|
||||||
syntaxe += discord.utils.escape_markdown("> cette ligne est cité\npas celle là\n")
|
syntaxe += discord.utils.escape_markdown("> cette ligne est cité\npas celle là\n")
|
||||||
syntaxe += "> cette ligne est cité\npas celle là\n"
|
syntaxe += "> cette ligne est cité\npas celle là\n"
|
||||||
syntaxe += "-----------------------------------------------------\n"
|
syntaxe += "-----------------------------------------------------\n"
|
||||||
syntaxe += discord.utils.escape_markdown(">>> cette ligne est cité\ncelle là aussi (et elles le seront toutes!)\n")
|
syntaxe += discord.utils.escape_markdown(">>> cette ligne est cité\ncelle là aussi (et elles le seront toutes!)\n")
|
||||||
syntaxe += ">>> cette ligne est cité\ncelle là aussi (et elles le seront toutes!)\n"
|
syntaxe += ">>> cette ligne est cité\ncelle là aussi (et elles le seront toutes!)\n"
|
||||||
await ctx.message.add_reaction(emoji = '✅')
|
await ctx.message.add_reaction(emoji = '✅')
|
||||||
await ctx.send(syntaxe)
|
await ctx.send(syntaxe)
|
||||||
|
|
||||||
@commands.command(aliases = ['infos'])
|
@commands.command(aliases = ['infos'])
|
||||||
async def info(self, ctx):
|
async def info(self, ctx):
|
||||||
"""Donne des infos sur le bot.\n ➡ Syntaxe: .info/infos"""
|
"""Donne des infos sur le bot.\n ➡ Syntaxe: .info/infos"""
|
||||||
embed = discord.Embed(url = 'https://github.com/Mylloon', color = randint(0, 0xFFFFFF))
|
embed = discord.Embed(url = 'https://github.com/Mylloon', color = randint(0, 0xFFFFFF))
|
||||||
|
|
||||||
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})
|
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)
|
total_unique = len(self.bot.users)
|
||||||
|
|
||||||
voice_channels = []
|
voice_channels = []
|
||||||
text_channels = []
|
text_channels = []
|
||||||
for guild in self.bot.guilds:
|
for guild in self.bot.guilds:
|
||||||
voice_channels.extend(guild.voice_channels)
|
voice_channels.extend(guild.voice_channels)
|
||||||
text_channels.extend(guild.text_channels)
|
text_channels.extend(guild.text_channels)
|
||||||
|
|
||||||
text = len(text_channels)
|
text = len(text_channels)
|
||||||
voice = len(voice_channels)
|
voice = len(voice_channels)
|
||||||
|
|
||||||
embed.add_field(name='Développeur', value='Mylloon#7869')
|
embed.add_field(name='Développeur', value='Mylloon#7869')
|
||||||
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__}')
|
embed.set_footer(text=f'Basé sur discord.py {discord.__version__}')
|
||||||
await ctx.send(embed=embed)
|
await ctx.send(embed=embed)
|
||||||
|
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
bot.add_cog(Commands(bot))
|
bot.add_cog(Commands(bot))
|
96
cogs/help.py
Normal file → Executable file
96
cogs/help.py
Normal file → Executable file
|
@ -3,57 +3,57 @@ from discord.ext import commands
|
||||||
from random import randint
|
from random import randint
|
||||||
|
|
||||||
class Help(commands.Cog):
|
class Help(commands.Cog):
|
||||||
"""Listes des commandes et/ou catégories."""
|
"""Listes des commandes et/ou catégories."""
|
||||||
|
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
async def help(self, ctx, *cog):
|
async def help(self, ctx, *cog):
|
||||||
"""Affiche toutes les commandes du bot.\n ➡ Syntaxe: .help [catégorie]"""
|
"""Affiche toutes les commandes du bot.\n ➡ Syntaxe: .help [catégorie]"""
|
||||||
if not cog:
|
if not cog:
|
||||||
"""Liste des Cog"""
|
"""Liste des Cog"""
|
||||||
halp=discord.Embed(title = 'Liste des catégories et commandes non catégorisées',
|
halp=discord.Embed(title = 'Liste des catégories et commandes non catégorisées',
|
||||||
description = 'Utilisez `.help *Catégorie*` pour en savoir plus sur eux !',
|
description = 'Utilisez `.help *Catégorie*` pour en savoir plus sur eux !',
|
||||||
color = randint(0, 0xFFFFFF))
|
color = randint(0, 0xFFFFFF))
|
||||||
cogs_desc = ''
|
cogs_desc = ''
|
||||||
for x in self.bot.cogs:
|
for x in self.bot.cogs:
|
||||||
cogs_desc += (f'{x} - {self.bot.cogs[x].__doc__}\n')
|
cogs_desc += (f'{x} - {self.bot.cogs[x].__doc__}\n')
|
||||||
halp.add_field(name = 'Catégories', value = cogs_desc[0:len(cogs_desc)-1], inline = False)
|
halp.add_field(name = 'Catégories', value = cogs_desc[0:len(cogs_desc)-1], inline = False)
|
||||||
cmds_desc = ''
|
cmds_desc = ''
|
||||||
for y in self.bot.walk_commands():
|
for y in self.bot.walk_commands():
|
||||||
if not y.cog_name and not y.hidden:
|
if not y.cog_name and not y.hidden:
|
||||||
cmds_desc += (f'.{y.name} - {y.help}\n ')
|
cmds_desc += (f'.{y.name} - {y.help}\n ')
|
||||||
if len(cmds_desc) > 1:
|
if len(cmds_desc) > 1:
|
||||||
halp.add_field(name = 'Commandes sans catégories', value = cmds_desc[0:len(cmds_desc)-1], inline = False)
|
halp.add_field(name = 'Commandes sans catégories', value = cmds_desc[0:len(cmds_desc)-1], inline = False)
|
||||||
await ctx.message.add_reaction(emoji = '✅')
|
await ctx.message.add_reaction(emoji = '✅')
|
||||||
await ctx.send(embed = halp)
|
await ctx.send(embed = halp)
|
||||||
else:
|
else:
|
||||||
"""Avertissement si il y a trop d'arguments dans la variable cog"""
|
"""Avertissement si il y a trop d'arguments dans la variable cog"""
|
||||||
if len(cog) > 1:
|
if len(cog) > 1:
|
||||||
halp = discord.Embed(title = 'Erreur !', description = "Tu as renseigné trop d'arguments !", color = 0xC41B1B)
|
halp = discord.Embed(title = 'Erreur !', description = "Tu as renseigné trop d'arguments !", color = 0xC41B1B)
|
||||||
await ctx.send(embed = halp)
|
await ctx.send(embed = halp)
|
||||||
else:
|
else:
|
||||||
"""Liste des commandes avec cogs."""
|
"""Liste des commandes avec cogs."""
|
||||||
|
|
||||||
cog = [item.capitalize() for item in cog]
|
cog = [item.capitalize() for item in cog]
|
||||||
|
|
||||||
found = False
|
found = False
|
||||||
for x in self.bot.cogs:
|
for x in self.bot.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.bot.cogs[cog[0]].__doc__, color = randint(0, 0xFFFFFF))
|
halp = discord.Embed(title = f'{cog[0]} - Liste des commandes', description = self.bot.cogs[cog[0]].__doc__, color = randint(0, 0xFFFFFF))
|
||||||
for c in self.bot.get_cog(y).get_commands():
|
for c in self.bot.get_cog(y).get_commands():
|
||||||
if not c.hidden:
|
if not c.hidden:
|
||||||
halp.add_field(name = f".{c.name}", value = f"{c.help}\n ", inline = False)
|
halp.add_field(name = f".{c.name}", value = f"{c.help}\n ", inline = False)
|
||||||
found = True
|
found = True
|
||||||
if not found:
|
if not found:
|
||||||
"""Rappel si le cog n'existe pas."""
|
"""Rappel si le cog n'existe pas."""
|
||||||
await ctx.message.add_reaction(emoji = '❌')
|
await ctx.message.add_reaction(emoji = '❌')
|
||||||
halp = discord.Embed(title = 'Erreur !', description = f"Qu'est ce que {cog[0]} ?", color = 0xC41B1B)
|
halp = discord.Embed(title = 'Erreur !', description = f"Qu'est ce que {cog[0]} ?", color = 0xC41B1B)
|
||||||
else:
|
else:
|
||||||
await ctx.message.add_reaction(emoji = '✅')
|
await ctx.message.add_reaction(emoji = '✅')
|
||||||
await ctx.send('', embed = halp)
|
await ctx.send('', embed = halp)
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
bot.add_cog(Help(bot))
|
bot.add_cog(Help(bot))
|
112
main.py
Normal file → Executable file
112
main.py
Normal file → Executable file
|
@ -12,74 +12,74 @@ async def on_connect():
|
||||||
|
|
||||||
@client.event
|
@client.event
|
||||||
async def on_ready():
|
async def on_ready():
|
||||||
await client.change_presence(status = discord.Status.online, activity = discord.Activity(name = "devenir fort en info", type = discord.ActivityType.playing))
|
await client.change_presence(status = discord.Status.online, activity = discord.Activity(name = "devenir fort en info", type = discord.ActivityType.playing))
|
||||||
print("Bot chargé à 100%.")
|
print("Bot chargé à 100%.")
|
||||||
|
|
||||||
@client.event
|
@client.event
|
||||||
async def on_raw_reaction_add(payload):
|
async def on_raw_reaction_add(payload):
|
||||||
if payload.message_id == 765470422149365760:
|
if payload.message_id == 765470422149365760:
|
||||||
if payload.emoji.name == '🟡':
|
if payload.emoji.name == '🟡':
|
||||||
role = discord.utils.get(payload.member.guild.roles, name="L1A1")
|
role = discord.utils.get(payload.member.guild.roles, name="L1A1")
|
||||||
await payload.member.add_roles(role)
|
await payload.member.add_roles(role)
|
||||||
if payload.emoji.name == '🟠':
|
if payload.emoji.name == '🟠':
|
||||||
role = discord.utils.get(payload.member.guild.roles, name="L1A2")
|
role = discord.utils.get(payload.member.guild.roles, name="L1A2")
|
||||||
await payload.member.add_roles(role)
|
await payload.member.add_roles(role)
|
||||||
if payload.emoji.name == '🔵':
|
if payload.emoji.name == '🔵':
|
||||||
role = discord.utils.get(payload.member.guild.roles, name="L1B1")
|
role = discord.utils.get(payload.member.guild.roles, name="L1B1")
|
||||||
await payload.member.add_roles(role)
|
await payload.member.add_roles(role)
|
||||||
if payload.emoji.name == '🟣':
|
if payload.emoji.name == '🟣':
|
||||||
role = discord.utils.get(payload.member.guild.roles, name="L1B2")
|
role = discord.utils.get(payload.member.guild.roles, name="L1B2")
|
||||||
await payload.member.add_roles(role)
|
await payload.member.add_roles(role)
|
||||||
if payload.emoji.name == '🟤':
|
if payload.emoji.name == '🟤':
|
||||||
role = discord.utils.get(payload.member.guild.roles, name="L1C1")
|
role = discord.utils.get(payload.member.guild.roles, name="L1C1")
|
||||||
await payload.member.add_roles(role)
|
await payload.member.add_roles(role)
|
||||||
if payload.emoji.name == '🟢':
|
if payload.emoji.name == '🟢':
|
||||||
role = discord.utils.get(payload.member.guild.roles, name="L1C2")
|
role = discord.utils.get(payload.member.guild.roles, name="L1C2")
|
||||||
await payload.member.add_roles(role)
|
await payload.member.add_roles(role)
|
||||||
|
|
||||||
@client.event
|
@client.event
|
||||||
async def on_raw_reaction_remove(payload):
|
async def on_raw_reaction_remove(payload):
|
||||||
if payload.message_id == 765470422149365760:
|
if payload.message_id == 765470422149365760:
|
||||||
if payload.emoji.name == '🟡':
|
if payload.emoji.name == '🟡':
|
||||||
guild = discord.utils.find(lambda g : g.id == payload.guild_id, client.guilds)
|
guild = discord.utils.find(lambda g : g.id == payload.guild_id, client.guilds)
|
||||||
member = discord.utils.find(lambda m: m.id == payload.user_id, guild.members)
|
member = discord.utils.find(lambda m: m.id == payload.user_id, guild.members)
|
||||||
role = discord.utils.get(guild.roles, name="L1A1")
|
role = discord.utils.get(guild.roles, name="L1A1")
|
||||||
await member.remove_roles(role)
|
await member.remove_roles(role)
|
||||||
if payload.emoji.name == '🟠':
|
if payload.emoji.name == '🟠':
|
||||||
guild = discord.utils.find(lambda g : g.id == payload.guild_id, client.guilds)
|
guild = discord.utils.find(lambda g : g.id == payload.guild_id, client.guilds)
|
||||||
member = discord.utils.find(lambda m: m.id == payload.user_id, guild.members)
|
member = discord.utils.find(lambda m: m.id == payload.user_id, guild.members)
|
||||||
role = discord.utils.get(guild.roles, name="L1A2")
|
role = discord.utils.get(guild.roles, name="L1A2")
|
||||||
await member.remove_roles(role)
|
await member.remove_roles(role)
|
||||||
if payload.emoji.name == '🔵':
|
if payload.emoji.name == '🔵':
|
||||||
guild = discord.utils.find(lambda g : g.id == payload.guild_id, client.guilds)
|
guild = discord.utils.find(lambda g : g.id == payload.guild_id, client.guilds)
|
||||||
member = discord.utils.find(lambda m: m.id == payload.user_id, guild.members)
|
member = discord.utils.find(lambda m: m.id == payload.user_id, guild.members)
|
||||||
role = discord.utils.get(guild.roles, name="L1B1")
|
role = discord.utils.get(guild.roles, name="L1B1")
|
||||||
await member.remove_roles(role)
|
await member.remove_roles(role)
|
||||||
if payload.emoji.name == '🟣':
|
if payload.emoji.name == '🟣':
|
||||||
guild = discord.utils.find(lambda g : g.id == payload.guild_id, client.guilds)
|
guild = discord.utils.find(lambda g : g.id == payload.guild_id, client.guilds)
|
||||||
member = discord.utils.find(lambda m: m.id == payload.user_id, guild.members)
|
member = discord.utils.find(lambda m: m.id == payload.user_id, guild.members)
|
||||||
role = discord.utils.get(guild.roles, name="L1B2")
|
role = discord.utils.get(guild.roles, name="L1B2")
|
||||||
await member.remove_roles(role)
|
await member.remove_roles(role)
|
||||||
if payload.emoji.name == '🟤':
|
if payload.emoji.name == '🟤':
|
||||||
guild = discord.utils.find(lambda g : g.id == payload.guild_id, client.guilds)
|
guild = discord.utils.find(lambda g : g.id == payload.guild_id, client.guilds)
|
||||||
member = discord.utils.find(lambda m: m.id == payload.user_id, guild.members)
|
member = discord.utils.find(lambda m: m.id == payload.user_id, guild.members)
|
||||||
role = discord.utils.get(guild.roles, name="L1C1")
|
role = discord.utils.get(guild.roles, name="L1C1")
|
||||||
await member.remove_roles(role)
|
await member.remove_roles(role)
|
||||||
if payload.emoji.name == '🟢':
|
if payload.emoji.name == '🟢':
|
||||||
guild = discord.utils.find(lambda g : g.id == payload.guild_id, client.guilds)
|
guild = discord.utils.find(lambda g : g.id == payload.guild_id, client.guilds)
|
||||||
member = discord.utils.find(lambda m: m.id == payload.user_id, guild.members)
|
member = discord.utils.find(lambda m: m.id == payload.user_id, guild.members)
|
||||||
role = discord.utils.get(guild.roles, name="L1C2")
|
role = discord.utils.get(guild.roles, name="L1C2")
|
||||||
await member.remove_roles(role)
|
await member.remove_roles(role)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
client.load_extension("cogs.commands")
|
client.load_extension("cogs.commands")
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
print(error)
|
print(error)
|
||||||
|
|
||||||
client.remove_command("help")
|
client.remove_command("help")
|
||||||
try:
|
try:
|
||||||
client.load_extension("cogs.help")
|
client.load_extension("cogs.help")
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
print(error)
|
print(error)
|
||||||
|
|
||||||
client.run(token)
|
client.run(token)
|
0
requirements.txt
Normal file → Executable file
0
requirements.txt
Normal file → Executable file
Reference in a new issue