-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
43 lines (36 loc) · 1.31 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
import asyncio
from itertools import cycle
import os
import aiosqlite
import discord
import discordSuperUtils
from discord.ext import commands, tasks
from tools.autocogs import AutoCogs
from dotenv import load_dotenv
import threading
from pycord_components import PycordComponents
import config
load_dotenv(verbose=True)
class MyBot(commands.Bot):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
AutoCogs(self)
self.remove_command("help")
async def on_ready(self):
"""Called upon the READY event"""
await self.change_presence(status=discord.Status.online, activity=discord.Activity(name=">도움",
type=discord.ActivityType.playing))
print("Bot is ready.")
async def is_owner(self, user):
if user.id in config.OWNER:
return True
@staticmethod
async def create_db_con():
db = await aiosqlite.connect("db/db.sqlite")
MyBot.db = discordSuperUtils.DatabaseManager.connect(database=db)
INTENTS = discord.Intents.all()
my_bot = MyBot(command_prefix=["> ",">"], intents=INTENTS)
PycordComponents(my_bot)
if __name__ == "__main__":
my_bot.loop.run_until_complete(MyBot.create_db_con())
my_bot.run(os.getenv('TOKEN'))