-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
44 lines (34 loc) · 1.15 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import json
import DatabaseTools.tool as tool
from nextcord.ext import commands
file_handle = open("config.JSON", "r")
config_file = json.loads(file_handle.read())
file_handle.close()
TOKEN = config_file["TOKEN"]
bot_masters = config_file["BOT_MASTERS"]
del config_file["TOKEN"]
class Gavin(commands.Bot):
connection, cursor = tool.connect()
bot_name = "Gavin"
config = config_file
bot_masters = bot_masters
if tool.create_tables(connection, cursor):
print("Table checks okay.")
def __init__(self, **kwargs):
super(Gavin, self).__init__(**kwargs)
async def on_ready(self):
print(f'{self.user} has connected to discord!')
@classmethod
def prefixes(cls, client: None, message):
guildID = message.guild.id
prefix = tool.sql_retrieve_setting(guildID, "commandPrefix", cls.cursor)
if prefix is None:
return "!"
else:
return prefix
if __name__ == "__main__":
bot = Gavin(command_prefix=Gavin.prefixes, max_messages=20_000)
bot.load_extension('cogs.admincog')
bot.load_extension('cogs.gavincog')
print("Trying to login...")
bot.run(TOKEN)