-
Notifications
You must be signed in to change notification settings - Fork 4
/
manager.py
42 lines (32 loc) · 1.25 KB
/
manager.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from discord.ext.commands.errors import CommandNotFound, MissingRequiredArgument
from discord.ext import commands
class Manager(commands.Cog):
"""Manage the bot"""
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_ready(self):
print(f"EU SOU UM TESTE. ME CHAMO {self.bot.user}")
@commands.Cog.listener()
async def on_message(self, message):
if message.author == self.bot.user:
return
if "palavrão" in message.content:
await message.channel.send(
f"Por favor, {message.author.name}, não ofenda os demais usuários!"
)
await message.delete()
@commands.Cog.listener()
async def on_command_error(self, ctx, error):
if isinstance(error, MissingRequiredArgument):
await ctx.send(
"Favor enviar todos os Argumentos. Digite !help para ver os parâmetros de cada comando"
)
elif isinstance(error, CommandNotFound):
await ctx.send(
"O comando não existe. Digite !help para ver todos os comandos"
)
else:
raise error
def setup(bot):
bot.add_cog(Manager(bot))