-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
68 lines (55 loc) · 1.68 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import discord
from discord.ext import commands
from utils import *
import os
from dotenv import load_dotenv
load_dotenv()
DISCORD_TOKEN = os.getenv("DISCORD_TOKEN")
startup_extensions = ["amongusbot", "secretsanta"]
bot = commands.Bot(command_prefix = '!')
@bot.event
async def on_ready():
await bot.change_presence(status=discord.Status.online, activity=discord.Activity(type = discord.ActivityType.listening, name = "Beep boop I'm red and you're SUS"))
create_table = """CREATE TABLE people (
disc_id BIGINT NOT NULL,
disc_name varchar(30) NOT NULL,
first_name varchar(20) NOT NULL,
last_name varchar(20) NOT NULL,
address varchar(150) NOT NULL,
phone_num varchar(20) NOT NULL,
description varchar(200) NOT NULL,
gift_advisor varchar(40) NOT NULL,
santa BIGINT DEFAULT NULL,
recipient BIGINT DEFAULT NULL,
PRIMARY KEY (disc_id))"""
#connect to DB
"""
db = mysql.connect(user = MYSQL_USER, password = MYSQL_PASS,
host = '127.0.0.1',
database = 'mydatabase',
auth_plugin= 'caching_sha2_password')
cursor = db.cursor()
try:
print("Creating table")
cursor.execute(create_table)
except mysql.Error as err:
if err.errno == errorcode.ER_TABLE_EXISTS_ERROR:
print("table exists.")
else:
print(err.msg)
else:
print("OK")
db.close()
cursor.close()
"""
@bot.command()
async def emojiname(ctx, emoji):
await ctx.send(get_name(emoji))
if __name__ == "__main__":
for extension in startup_extensions:
try:
bot.load_extension(extension)
except Exception as e:
exc = '{}: {}'.format(type(e).__name__, e)
print('Failed to load extension {}\n{}'.format(extension, exc))
bot.run(DISCORD_TOKEN)