import discord, os from discord.ext import commands from funcs import logThis, makeFiles commandPrefix = "!" client = commands.Bot(command_prefix=commandPrefix) # Logs in @client.event async def on_ready(): logThis("Logged in as "+client.user.name+", "+str(client.user.id)) game = discord.Game("Some weeb shit") await client.change_presence(activity=game) # Loads and unloads cogs @client.command() async def load(ctx,extension): client.load_extension(f"cogs.{extension}") @client.command() async def unload(ctx,extension): client.unload_extension(f"cogs.{extension}") @client.event async def on_command(ctx): logThis(f"{ctx.message.author.display_name} ran {ctx.message.content}") # Logs if a command experiences an error @client.event async def on_command_error(ctx, error): if isinstance(error, commands.CommandNotFound): await ctx.send("That's not a command (error code 001)") else: logThis(f"Something went wrong, {error}",str(ctx.message.channel.id)) await ctx.send("Something went wrong (error code 000)") for filename in os.listdir("./cogs"): if filename.endswith(".py"): client.load_extension(f"cogs.{filename[:-3]}") # Creates the required files makeFiles() # Gets secret bot token with open("token.txt","r") as f: token = f.read().replace("\n","") # Runs the whole shabang client.run(token)