-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
executable file
·43 lines (32 loc) · 929 Bytes
/
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
#!/usr/bin/env python3
import nextcord
from nextcord.ext import commands
from config import discord_token
from pychan.commands.text.reddit import Reddit
from pychan import database, status
from pychan.core import Core
from pychan.help import PyChanHelp
def main():
database.create_database()
intents = nextcord.Intents.default()
intents.message_content = True
intents.members = True
bot = commands.Bot(
command_prefix=database.get_guild_prefix, intents=intents,
help_command=PyChanHelp()
)
bot.add_cog(Core(bot))
@bot.event
async def on_ready():
change_status = status.ChangeStatus(bot)
change_status.change_status.start()
print("Bot is ready")
bot.run(discord_token)
def cleanup():
database.close_database()
Reddit.reddit.close()
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
cleanup()