-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.py
89 lines (77 loc) · 2.64 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import discord
import urllib
import jishaku
import os
import traceback
import dotenv
from discord.ext import commands
import random
import aiomysql
dotenv.load_dotenv(dotenv_path=".env")
class Bot(commands.Bot):
def __init__(self):
intents = discord.Intents.all()
intents.members = True
super().__init__(
command_prefix=os.environ.get("PREFIX"),
intents=intents,
slash_commands=True,
)
# Custom ending note
ending_note = f"(C) 2022 Il BaracchinoDella Scuola"
async def on_ready(self):
print("Running. Printing wd")
os.system("pwd")
self.staff_chat = self.get_channel(907937553343209472)
dotenv.load_dotenv(".env")
self.host = os.getenv("DB_HOST")
self.port = os.getenv("DB_PORT")
self.db = os.getenv("DB_NAME")
self.user_name = os.getenv("DB_USER")
self.password = os.getenv("DB_PASSWORD")
try:
self.connection = await aiomysql.connect(
autocommit=True,
host=self.host,
port=int(self.port),
db=self.db,
user=self.user_name,
password=self.password,
)
print("Connected to MySQL")
except:
print("No sql for you, sorry")
for a in os.listdir("./cogs"):
try:
if a.endswith(".py"):
await self.load_extension("cogs." + a[:-3])
print(f"Loading {a[:-3]}.py")
except Exception as e:
print(f"Unable to load {a}\n{e}")
print(traceback.format_exc())
await self.load_extension("jishaku")
print("Bot is ready!")
c = self.get_channel(907937553343209472)
await c.send("Bot launched! Now you can start copying")
await self.change_presence(
activity=discord.Game(
name=random.choice(
[
"CopyRush 2023",
"Games at school",
"Destroy the school",
"Fake the test",
"CopyRush 2022 at school",
"CopyRush 2022 in DAD",
"#LaScuolaèDAD",
"#DADistheway",
"DAD > *",
"mario kart sui banchi a rotelle",
"scuola in presenza < *",
"hacking the school",
"listening to music at school",
]
)
)
)
Bot().run(os.environ["token"])