-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
70 lines (56 loc) · 1.91 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
import os
import asyncio
import disnake
import jishaku
import sentry_sdk
from disnake.ext import commands
intents = disnake.Intents(messages=True, guilds=True)
# Init sentry
if os.getenv("BETA") != "TRUE":
sentry_sdk.init(os.getenv("SENTRY_ENDPOINT"), traces_sample_rate=1.0)
async def run():
"""
Main function, runs the bot.
"""
# load the bot class
bot = Bot()
# load cogs
for filename in os.listdir('./cogs'):
if filename.endswith(".py") and not filename.startswith("_"):
bot.load_extension(f"cogs.{filename[:-3]}")
bot.load_extension("jishaku")
# and finally, start the bot!
await bot.start(os.getenv("TOKEN"))
class Bot(commands.AutoShardedBot):
def __init__(self) -> None:
"""
The Bot object
"""
super().__init__(
command_prefix="gc!",
# only usable in dms without the message content intent
case_insensitive=True,
strip_after_prefix=True,
activity=disnake.Activity(
type=disnake.ActivityType.listening, name="slash commands"
),
help_command=None,
intents=intents,
)
self.invite_link = "https://discord.com/api/oauth2/authorize?client_id=843550872293867570&permissions=379904" \
"&scope=bot%20applications.commands "
self.command_list = {
"meme": ["meme"],
"gigachadify": ["gigachadify", "Gigachadify"],
"chadmeter": ["chadmeter", "Chadmeter"],
"caption": ["caption"],
}
async def on_ready(self) -> None:
print("------")
print("Logged in as")
print(self.user.name)
print(self.user.id)
print(disnake.__version__)
print("------")
loop = asyncio.get_event_loop()
loop.run_until_complete(run())