mirror of
https://github.com/stijndcl/didier.git
synced 2026-04-07 15:48:29 +02:00
Use env vars, fixes #62
This commit is contained in:
parent
a08bfca4c7
commit
418dc41126
10 changed files with 96 additions and 106 deletions
0
startup/__init__.py
Normal file
0
startup/__init__.py
Normal file
41
startup/didier.py
Normal file
41
startup/didier.py
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
from discord.ext import commands, ipc
|
||||
from settings import HOST_IPC
|
||||
import os
|
||||
|
||||
|
||||
class Didier(commands.Bot):
|
||||
"""
|
||||
Main Bot class for Didier
|
||||
"""
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
self._host_ipc = HOST_IPC
|
||||
|
||||
# IPC Server
|
||||
# TODO secret key
|
||||
self.ipc = ipc.Server(self, secret_key="SOME_SECRET_KEY") if self._host_ipc else None
|
||||
|
||||
# Cogs that should be loaded before the others
|
||||
self._preload = ("ipc", "utils", "failedchecks", "events",)
|
||||
|
||||
# Remove default help command
|
||||
self.remove_command("help")
|
||||
|
||||
self.init_extensions()
|
||||
|
||||
def init_extensions(self):
|
||||
# Load initial extensions
|
||||
for ext in self._preload:
|
||||
self.load_extension(f"cogs.{ext}")
|
||||
|
||||
# Load all remaining cogs
|
||||
for file in os.listdir("./cogs"):
|
||||
if file.endswith(".py") and not (file.startswith(self._preload)):
|
||||
self.load_extension("cogs.{}".format(file[:-3]))
|
||||
|
||||
async def on_ipc_ready(self):
|
||||
print("IPC server is ready.")
|
||||
|
||||
async def on_ipc_error(self, endpoint, error):
|
||||
print(endpoint, "raised", error)
|
||||
5
startup/init_files.py
Normal file
5
startup/init_files.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
from os import path
|
||||
|
||||
|
||||
def check_all():
|
||||
pass
|
||||
Loading…
Add table
Add a link
Reference in a new issue