forked from HugTeddy/AQ3D
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
67 lines (58 loc) · 1.98 KB
/
main.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
import discord
import configparser
import json
from datetime import datetime
from discord.ext import commands
import traceback
import datetime
client = commands.Bot(command_prefix='!', case_insensitive=True)
config = configparser.ConfigParser()
config.read('config.ini')
token = config.get('DEFAULT', 'Token')
bot_owner = int(config.get('DEFAULT', 'owner_id'))
@client.command()
async def reload(ctx, extension):
if ctx.message.author.id != bot_owner:
await ctx.send('Nice Try')
return
client.unload_extension(f'extensions.{extension}')
client.load_extension(f'extensions.{extension}')
await ctx.message.add_reaction("✅")
@client.command()
async def load(ctx, extension):
if ctx.message.author.id != bot_owner:
await ctx.send('Nice Try')
return
client.load_extension(f'extensions.{extension}')
await ctx.message.add_reaction("✅")
@client.command()
async def unload(ctx, extension):
if ctx.message.author.id != bot_owner:
await ctx.send('Nice Try')
return
client.unload_extension(f'extensions.{extension}')
await ctx.message.add_reaction("✅")
@client.event
async def on_ready():
await client.change_presence(
activity=discord.Activity(
name='with AQ3D', type=discord.ActivityType.playing))
client.load_extension('extensions.AQCommands')
client.load_extension('extensions.ItemCog')
print('Bot is ready.')
@client.event
async def on_error(event, *args, **kwargs):
embed = discord.Embed(title=':x: Event Error', colour=0xe74c3c) #Red
embed.add_field(name='Event', value=event)
embed.description = '```py\n%s\n```' % traceback.format_exc()
embed.timestamp = datetime.datetime.utcnow()
AppInfo = await client.application_info()
await AppInfo.owner.send(embed=embed)
@client.command()
async def botstop(ctx):
if ctx.message.author.id != bot_owner:
await ctx.send('Nice Try')
return
await ctx.send('Bye Bye')
await client.logout()
client.run(token)