This repository has been archived by the owner on Aug 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
57 lines (48 loc) · 1.79 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
import discord
from discord.ext import commands
import os
from dotenv import load_dotenv
load_dotenv()
TOKEN = os.getenv('TOKEN')
client = commands.Bot(command_prefix='-')
extensions = ['src.cogs.emails', 'src.cogs.ping']
@client.command()
async def load(ctx, extension):
try:
client.load_extension(extension)
await ctx.send(f'{extension} successfully loaded')
print(f'{extension} successfully loaded')
except Exception as exception:
await ctx.send(f'{extension} cannot be loaded. [{exception}]')
print(f'{extension} cannot be loaded. [{exception}]')
@client.command()
async def unload(ctx, extension):
try:
client.unload_extension(extension)
await ctx.send(f'{extension} successfully unloaded')
print(f'{extension} successfully unloaded')
except Exception as exception:
await ctx.send(f'{extension} cannot be unloaded. [{exception}]')
print(f'{extension} cannot be unloaded. [{exception}]')
@client.command()
async def reload(ctx, extension):
try:
client.reload_extension(extension)
await ctx.send(f'{extension} successfully reloaded')
print(f'{extension} successfully reloaded')
except Exception as exception:
await ctx.send(f'{extension} cannot be reloaded. [{exception}]')
print(f'{extension} cannot be reloaded. [{exception}]')
@client.event
async def on_ready():
print("Bot is ready")
game = discord.Game('Hacking!')
await client.change_presence(activity=game)
if __name__ == '__main__':
for extension in extensions:
try:
client.load_extension(extension)
print(f'{extension} successfully loaded')
except Exception as exception:
print(f'{extension} cannot be loaded. [{exception}]')
client.run(TOKEN)