import discord, os, finnhub, platform, asyncio, traceback from discord.ext import commands from discord_slash import SlashCommand from pymongo import MongoClient from funcs import logThis, makeFiles, Money, Funcs, SwChar, SwDestiny, SwRoll, Games, Generators, BedreNetflix, NerdShit from utils import Options, Credentials class Gwendolyn(commands.Bot): def __init__(self): self.options = Options() self.credentials = Credentials() self.finnhubClient = finnhub.Client(api_key = self.credentials.finnhubKey) self.MongoClient = MongoClient(f"mongodb+srv://{self.credentials.mongoDBUser}:{self.credentials.mongoDBPassword}@gwendolyn.qkwfy.mongodb.net/Gwendolyn?retryWrites=true&w=majority") if self.options.testing: logThis("Testing mode") self.database = self.MongoClient["Gwendolyn-Test"] else: self.database = self.MongoClient["Gwendolyn"] self.swchar = SwChar(self) self.swroll = SwRoll(self) self.swdestiny = SwDestiny(self) self.generator = Generators() self.bedreNetflix = BedreNetflix(self) self.nerdShit = NerdShit(self) Games(self) self.money = Money(self) self.funcs = Funcs(self) super().__init__(command_prefix=" ", case_insensitive=True) if __name__ == "__main__": if platform.system() == "Windows": asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) # Creates the required files makeFiles() # Creates the Bot client = Gwendolyn() slash = SlashCommand(client, sync_commands=True, sync_on_cog_reload=True, override_type=True) #Loads cogs for filename in os.listdir("./cogs"): if filename.endswith(".py"): client.load_extension(f"cogs.{filename[:-3]}") try: # Runs the whole shabang client.run(client.credentials.token) except: logThis("Could not log in. Remember to write your bot token in the credentials.txt file")