40 lines
1.5 KiB
Python
40 lines
1.5 KiB
Python
from interactions import Client, Status
|
|
from gwendolyn.utils import get_options, get_credentials, long_strings, log
|
|
|
|
from pymongo import MongoClient # Used for database management
|
|
|
|
class Gwendolyn(Client):
|
|
|
|
def __init__(self):
|
|
"""Initialize the bot."""
|
|
initiation_parameters = {
|
|
"status": Status.DND,
|
|
"delete_unused_application_cmds": True
|
|
}
|
|
super().__init__(**initiation_parameters)
|
|
|
|
self._add_clients_and_options()
|
|
# self._add_util_classes()
|
|
# self._add_function_containers()
|
|
# self._add_cogs()
|
|
|
|
def _add_clients_and_options(self):
|
|
"""Add all the client, option and credentials objects."""
|
|
self.long_strings = long_strings()
|
|
self.options = get_options()
|
|
self.credentials = get_credentials()
|
|
mongo_user = self.credentials["mongo_db_user"]
|
|
mongo_password = self.credentials["mongo_db_password"]
|
|
mongo_url = f"mongodb+srv://{mongo_user}:{mongo_password}@gwendolyn"
|
|
mongo_url += ".qkwfy.mongodb.net/Gwendolyn?retryWrites=true&w=majority"
|
|
database_client = MongoClient(mongo_url)
|
|
|
|
if self.options["testing"]:
|
|
self.log("Testing mode")
|
|
self.database = database_client["Gwendolyn-Test"]
|
|
else:
|
|
self.database = database_client["Gwendolyn"]
|
|
|
|
def log(self, messages, channel: str = "", level: int = 20): # pylint:disable=no-self-use
|
|
"""Log a message. Described in utils/util_functions.py."""
|
|
log(messages, channel, level) |