/
errors.py
107 lines (102 loc) · 5.23 KB
/
errors.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
from discord.ext import commands
class Errors(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_command_error(self, ctx, error):
if isinstance(error, commands.ConversionError):
pass
elif isinstance(error, commands.CheckFailure):
if isinstance(error, commands.PrivateMessageOnly):
pass
elif isinstance(error, commands.NoPrivateMessage):
pass
elif isinstance(error, commands.CheckAnyFailure):
pass
elif isinstance(error, commands.NotOwner):
pass
elif isinstance(error, commands.MissingPermissions):
pass
elif isinstance(error, commands.BotMissingPermissions):
pass
elif isinstance(error, commands.MissingRole):
pass
elif isinstance(error, commands.BotMissingRole):
pass
elif isinstance(error, commands.MissingAnyRole):
pass
elif isinstance(error, commands.BotMissingAnyRole):
pass
elif isinstance(error, commands.NSFWChannelRequired):
pass
elif isinstance(error, commands.CommandNotFound):
pass
elif isinstance(error, commands.DisabledCommand):
pass
elif isinstance(error, commands.CommandInvokeError):
pass
elif isinstance(error, commands.UserInputError):
if isinstance(error, commands.MissingRequiredArgument):
pass
elif isinstance(error, commands.ArgumentParsingError):
if isinstance(error, commands.UnexpectedQuoteError):
await ctx.send("Invalid quotes!")
elif isinstance(error, commands.InvalidEndOfQuotedStringError):
await ctx.send("I don't understand this syntax")
elif isinstance(error, commands.ExpectedClosingQuoteError):
await ctx.send("I don't understand this syntax")
elif isinstance(error, commands.BadArgument):
if isinstance(error, commands.MessageNotFound):
await ctx.send("What message?")
elif isinstance(error, commands.MemberNotFound):
await ctx.send("Member not cached or unexisting")
elif isinstance(error, commands.GuildNotFound):
await ctx.send("404 server not found")
elif isinstance(error, commands.UserNotFound):
await ctx.send("User not cached or unexisting")
elif isinstance(error, commands.ChannelNotFound):
await ctx.send("[NUCLEAR ERROR] This channel does not exist")
elif isinstance(error, commands.ChannelNotReadable):
await ctx.send("I'm blind, I dont read that!")
elif isinstance(error, commands.BadColourArgument):
await ctx.send("What the heck is this color")
elif isinstance(error, commands.RoleNotFound):
await ctx.send("This role does not exist")
elif isinstance(error, commands.BadInviteArgument):
await ctx.send("I am not invited to that party!")
elif isinstance(error, commands.EmojiNotFound):
await ctx.send("What emoji?")
elif isinstance(error, commands.PartialEmojiConversionFailure):
await ctx.send("This emoji has too low data")
elif isinstance(error, commands.BadBoolArgument):
await ctx.send("I cant convert to 0 or 1")
elif isinstance(error, commands.TooManyArguments):
await ctx.send("Too much data, explosion risk 101%")
elif isinstance(error, commands.CommandOnCooldown):
await ctx.send(
f"You are too fast! Wait {round(error.retry_after, 2)} seconds"
)
elif isinstance(error, commands.MaxConcurrencyReached):
await ctx.send("Too much concorrents")
elif isinstance(error, commands.errors.CommandOnCooldown):
await ctx.send(
f"You are too fast! Wait {round(error.retry_after, 2)} seconds"
)
elif isinstance(error, commands.MaxConcurrencyReached):
await ctx.send("Too much concorrents")
elif isinstance(error, commands.ExtensionError):
if isinstance(error, commands.ExtensionAlreadyLoaded):
print("[EXTENSIONS] Extension already loaded.")
elif isinstance(error, commands.ExtensionNotLoaded):
print("[EXTENSIONS] Extension not loaded.")
elif isinstance(error, commands.NoEntryPointError):
print("[EXTENSIONS] no setup in extension.")
elif isinstance(error, commands.ExtensionFailed):
print("[EXTENSIONS] extension failed.")
elif isinstance(error, commands.ExtensionNotFound):
print("[EXTENSIONS] extension not found.")
elif isinstance(error, commands.CommandRegistrationError):
print("[COMMANDS] error while registering command.")
raise error
async def setup(bot):
await bot.add_cog(Errors(bot))