import discord
import json
import os
with open("configuration.json", "r") as config:
data = json.load(config)
token = data["token"]
owner_id = data["owner_id"]
intents = discord.Intents.all()
bot = discord.Bot(intents = intents, owner_id = owner_id)
bot.load_extension('cogs.profile', recursive=True)
bot.load_extension('cogs.shop', recursive=True)
@bot.slash_command()
async def load(ctx, name):
if ctx.author.id != int(owner_id):
return
bot.load_extension(f'cogs.{name}')
await ctx.respond(f'Loaded {name}')
@bot.slash_command()
async def unloaded(ctx, name):
if ctx.author.id != int(owner_id):
return
bot.unload_extension(f'cogs.{name}')
await ctx.respond(f'Unloaded {name}')
@bot.slash_command()
async def reload(ctx, name):
if ctx.author.id != int(owner_id):
return
bot.unload_extension(f'cogs.{name}')
bot.load_extension(f'cogs.{name}')
await ctx.respond(f'Reloaded {name}')
@bot.event
async def on_ready():
print(f"We have logged in as {bot.user}")
print(f"Discord Version: {discord.__version__}")
await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name = "/help"))
bot.run(token)```