-
Notifications
You must be signed in to change notification settings - Fork 0
/
Testbot.py
42 lines (30 loc) · 971 Bytes
/
Testbot.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
import discord
from discord.ext import commands
import json
import random
import os
with open("Setting.json", "r", encoding="utf8") as jfile:
jdata = json.load(jfile)
intents = discord.Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="[", intents = intents)
@bot.event
async def on_ready():
print("Bot is Online!")
@bot.command()
async def load(ctx, extension):
bot.load_extension(f"cmds.{extension}")
await ctx.send(f"Loaded {extension} done!")
@bot.command()
async def unload(ctx, extension):
bot.unload_extension(f"cmds.{extension}")
await ctx.send(f"Unloaded {extension} done!")
@bot.command()
async def reload(ctx, extension):
bot.reload_extension(f"cmds.{extension}")
await ctx.send(f"Reloaded {extension} done!")
for filename in os.listdir("./cmds"):
if filename.endswith('.py'):
bot.load_extension(f"cmds.{filename[:-3]}")
if __name__ == "__main__":
bot.run(jdata["Token"])