-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
33 lines (22 loc) · 768 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
import discord
from discord.ext import bridge
from discordToken import BOT_TOKEN
from database.queries import insert_server_data, delete_server_data
bot = bridge.Bot(command_prefix='!', intents=discord.Intents.all(), auto_sync_commands=True)
@bot.event
async def on_ready():
print(f"Ready - this bot is owned by {bot.user}")
@bot.event
async def on_guild_join(guild):
# print(f"Guild joined: {guild.name}")
insert_server_data(guild.id)
@bot.event
async def on_guild_remove(guild):
# print(f"Guild left: {guild.name}")
delete_server_data(guild.id)
async def main():
bot.load_extension("cogs.create_command")
bot.load_extension("cogs.disband_command")
await bot.start(BOT_TOKEN)
loop = bot.loop
loop.run_until_complete(main())