-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
44 lines (41 loc) · 1.96 KB
/
test.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
import discord, asyncio
from discord.ext import commands
bot = commands.Bot(command_prefix=["m!", "M!", "m! ", "M! "])
bot.remove_command('help')
TOKEN = "the token"
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.errors.CheckFailure):
embed = discord.Embed(
description=
f"```css\n[ Permission Error ]\n```\nInvalid permissions",
color=discord.Color.red())
embed.set_author(name=ctx.author.display_name, icon_url=ctx.author.avatar_url)
embed.set_footer(text="User: {}".format(ctx.author.display_name))
await ctx.send(embed=embed)
elif isinstance(error, commands.errors.CommandNotFound):
embed = discord.Embed(
description=
f"```css\n[ 404 Command Error ]\n```\nCommand not found",
color=discord.Color.red())
embed.set_author(name=ctx.author.display_name, icon_url=ctx.author.avatar_url)
embed.set_footer(text="User: {}".format(ctx.author.display_name))
await ctx.send(embed=embed)
elif isinstance(error, commands.errors.BadArgument):
embed = discord.Embed(
description=
f"```css\n[ 404 General Error ]\n```\nCould not find that",
color=discord.Color.red())
embed.set_author(name=ctx.author.display_name, icon_url=ctx.author.avatar_url)
embed.set_footer(text="User: {}".format(ctx.author.display_name))
await ctx.send(embed=embed)
elif isinstance(error, commands.MissingRequiredArgument):
arg = error.param.name
embed = discord.Embed(
description=
f"```css\n[ Argument Error ]\n```\nMissing argument: `{arg}`",
color=discord.Color.red())
embed.set_author(name=ctx.author.display_name, icon_url=ctx.author.avatar_url)
embed.set_footer(text="User: {}".format(ctx.author.display_name))
await ctx.send(embed=embed)
bot.run(TOKEN)