-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.py
45 lines (33 loc) · 1.17 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
import discord
from discord.ext import commands
import response, asyncio, json, os, random
with open("info.json", mode = 'r', encoding='utf8') as js:
data = json.load(js)
intents = discord.Intents.default()
intents.message_content = True
#client = discord.Client(intents = intents)
bot = commands.Bot(command_prefix='!', intents = intents)
def run_bot():
@bot.event
async def on_ready():
print(f'{bot.user} is online!')
@bot.command()
async def load(ctx, extension):
await bot.load_extension(f'cmds.{extension}')
await ctx.send(f'{extension} loaded')
@bot.command()
async def unload(ctx, extension):
await bot.unload_extension(f'cmds.{extension}')
await ctx.send(f'{extension} unloaded')
@bot.command()
async def reload(ctx, extension):
await bot.reload_extension(f'cmds.{extension}')
await ctx.send(f'{extension} reloaded')
bot.run(data['TOKEN'])
async def load_extension():
for filename in os.listdir('./cog'):
if filename.endswith('.py'):
await bot.load_extension(f'cog.{filename[:-3]}')
asyncio.run(load_extension())
if __name__ == "__main__":
run_bot()