-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbot.py
More file actions
36 lines (29 loc) · 973 Bytes
/
bot.py
File metadata and controls
36 lines (29 loc) · 973 Bytes
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
import discord
from dotenv import load_dotenv
import os
from ai import ask
from discord.ext import commands, ipc
# from src import answer
# from src import ipc as IPC
# from src import register
from src.cogs import ipc as IPC
from src.cogs import register , answer, moderation
from sqlalchemy import create_engine
load_dotenv()
token = os.getenv('DISCORD_TOKEN')
class MyBot(commands.Bot):
def __init__(self , *args , **kwargs):
super().__init__(*args , **kwargs)
self.ipc = ipc.Server(self , secret_key=os.getenv("IPC_SECRET"))
async def on_ipc_ready(self):
print("IPC server up and running")
async def on_ipc_error(self , endpoint, error):
print(endpoint , error)
# bot = commands.Bot(command_prefix="!")
bot = MyBot(command_prefix="!")
bot.add_cog(answer.AnswerCog(bot , ask))
bot.add_cog(IPC.IPCCog(bot))
bot.add_cog(register.RegisterCog(bot))
bot.add_cog(moderation.ModerationCog(bot))
bot.ipc.start()
bot.run(token)