-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
46 lines (36 loc) · 1.09 KB
/
bot.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
import discord
from discord import Interaction, Intents, Embed
from discord.ext.commands import Bot, Context, when_mentioned
from dotenv import load_dotenv
from os import getenv
from sys import exit
from typing import Literal
import httpx
import nltk
import asyncio
load_dotenv()
token = getenv('TOKEN')
owner_id = getenv('OWNER_ID')
if token is None or owner_id is None:
print('please set a TOKEN and OWNER_ID environment variable')
exit(1)
class QBBBot(Bot):
def __init__(self) -> None:
i = Intents.default()
i.members = True
super().__init__(command_prefix=when_mentioned, intents=i)
async def setup_hook(self):
await self.load_extension('cogs.tossup')
await self.load_extension('cogs.solo')
await self.load_extension('cogs.stats')
await self.load_extension('cogs.search')
await self.load_extension('jishaku')
bot = QBBBot()
@bot.command()
async def sync(ctx: Context):
if str(ctx.author.id) == owner_id:
await bot.tree.sync()
await ctx.send('ok')
else:
await ctx.send('no')
bot.run(token)