-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
39 lines (31 loc) · 1.06 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
import discord
from discord.ext import commands
import os
from dotenv import load_dotenv
load_dotenv()
bot = commands.Bot(command_prefix ="$", intents = discord.Intents.all())
@bot.event
async def on_ready():
for FileName in os.listdir('./cmds'):
if FileName.endswith('.py'):
await bot.load_extension(f'cmds.{FileName[:-3]}')
print(">>Bot is Online<<")
@bot.command()
async def load(ctx, extension):
await bot.load_extension(f'cmds.{extension}')
await ctx.send(f'Loaded')
@bot.command()
async def reload(ctx, extension):
await bot.reload_extension(f'cmds.{extension}')
await ctx.send(f'Reloaded')
@bot.command()
async def unload(ctx, extension):
await bot.unload_extension(f'cmds.{extension}')
await ctx.send(f'Unloaded')
@bot.command()
async def sync(ctx):
commands = await bot.tree.sync()
output = "\n".join([item.name for item in commands])
await ctx.send("Sucessfully sync the following commands\n" + output)
if __name__ == "__main__":
bot.run(os.getenv('TOKEN'))