-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.py
49 lines (38 loc) · 1.18 KB
/
bot.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
"""discord api connection"""
import discord
from discord.ext import commands
import discordhealthcheck
"""for --token args"""
import argparse
# make the arg --token available
parser = argparse.ArgumentParser()
parser.add_argument(
"--token",
help="Get your own token here - https://discordapp.com/developers/applications/",
)
args = parser.parse_args()
# replace args.token with "discord-token" if you dont want to run this in pterodactyl
TOKEN = args.token
bot = commands.Bot(command_prefix="")
bot.remove_command("help")
bot.load_extension("cogs.franck")
bot.load_extension("cogs.admin-only")
discordhealthcheck.start(bot)
@bot.event
async def on_ready():
print("bot started \n")
# dont give a error if a command doesn't exist
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandNotFound):
return
elif isinstance(error, commands.MissingRequiredArgument):
return
elif isinstance(error, commands.MissingPermissions):
embed = discord.Embed(
color=0xE74C3C, description="Your not allowed to use this command"
)
await ctx.send(embed=embed)
raise error
# run the bot
bot.run(TOKEN)