:spakles: Database and OOP

This commit is contained in:
NikolajDanger
2020-08-13 16:31:28 +02:00
parent f431c079d1
commit 4127e537a1
31 changed files with 3674 additions and 3731 deletions

View File

@ -2,7 +2,7 @@ import discord, os, finnhub, pymongo
from discord.ext import commands
from pymongo import MongoClient
from funcs import logThis, makeFiles, transferUsers
from funcs import logThis, makeFiles, transferUsers, Money, Funcs, SwChar, SwDestiny, SwRoll, Games
commandPrefix = "!"
@ -30,8 +30,22 @@ class Gwendolyn(commands.Bot):
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-Test?retryWrites=true&w=majority")
self.database = self.MongoClient["Gwendolyn-Test"]
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:
self.database = self.MongoClient["Gwendolyn-Test"]
else:
self.database = self.MongoClient["Gwendolyn"]
self.swchar = SwChar(self)
self.swroll = SwRoll(self)
self.swdestiny = SwDestiny(self)
Games(self)
self.money = Money(self)
self.funcs = Funcs(self)
super().__init__(command_prefix=commandPrefix, case_insensitive=True)
# Creates the required files