-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
32 lines (27 loc) · 1.02 KB
/
Copy pathmain.py
File metadata and controls
32 lines (27 loc) · 1.02 KB
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
import asyncio
import discord
from discord.ext import commands
import config
import storage
class VideoGameBot(commands.Bot):
def __init__(self):
intents = discord.Intents.default()
super().__init__(command_prefix="!", intents=intents)
async def setup_hook(self):
storage.init_db()
await self.load_extension("cogs.admin")
await self.load_extension("cogs.catalog")
guild = discord.Object(id=config.DISCORD_SERVER_ID)
self.tree.copy_global_to(guild=guild)
await self.tree.sync(guild=guild)
# The commands live guild-scoped only. Clear the global scope and sync it
# so any previously registered global copies stop showing up as duplicates.
self.tree.clear_commands(guild=None)
await self.tree.sync()
async def on_ready(self):
print(f"Logged in as {self.user} (ID: {self.user.id if self.user else 'Unknown'})")
def main():
bot = VideoGameBot()
bot.run(config.DISCORD_API_KEY)
if __name__ == "__main__":
main()