Fully converted to slash commands

This commit is contained in:
NikolajDanger
2021-03-31 00:38:51 +02:00
parent a8a7e5eabd
commit b345720468
50 changed files with 1102 additions and 1111 deletions

View File

@ -1,10 +1,10 @@
import discord, os, finnhub, platform, asyncio, traceback
import os, finnhub, platform, asyncio
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
from funcs import Money, StarWars, Games, Other, LookupFuncs
from utils import Options, Credentials, logThis, makeFiles, databaseFuncs
class Gwendolyn(commands.Bot):
def __init__(self):
@ -14,26 +14,24 @@ class Gwendolyn(commands.Bot):
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.log("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.starWars = StarWars(self)
self.other = Other(self)
self.lookupFuncs = LookupFuncs(self)
self.games = Games(self)
self.money = Money(self)
self.funcs = Funcs(self)
self.databaseFuncs = databaseFuncs(self)
super().__init__(command_prefix=" ", case_insensitive=True)
def log(self, messages, channel : str = "", level : int = 20):
logThis(messages, channel, level)
if __name__ == "__main__":
if platform.system() == "Windows":
@ -43,16 +41,16 @@ if __name__ == "__main__":
makeFiles()
# Creates the Bot
client = Gwendolyn()
slash = SlashCommand(client, sync_commands=True, sync_on_cog_reload=True, override_type=True)
bot = Gwendolyn()
bot.slash = SlashCommand(bot, 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]}")
bot.load_extension(f"cogs.{filename[:-3]}")
try:
# Runs the whole shabang
client.run(client.credentials.token)
bot.run(bot.credentials.token)
except:
logThis("Could not log in. Remember to write your bot token in the credentials.txt file")
bot.log("Could not log in. Remember to write your bot token in the credentials.txt file")