Move the webhook listener into a cog so that I have access to the bot for the action method.
This commit is contained in:
@@ -4,12 +4,9 @@ import sys
|
||||
|
||||
import hydra
|
||||
import nextcord
|
||||
import uvicorn
|
||||
from fastapi import FastAPI
|
||||
from hydra.core.config_store import ConfigStore
|
||||
from nextcord.ext import commands
|
||||
|
||||
import classes.clan_message as clan_message
|
||||
import database_setup.create_database as create_database
|
||||
from classes.nominate_highcouncil_views import NominateHighCouncilView
|
||||
from classes.nominate_views import NominateView
|
||||
@@ -30,9 +27,6 @@ handler.setFormatter(
|
||||
)
|
||||
logger.addHandler(handler)
|
||||
|
||||
app = FastAPI()
|
||||
app.include_router(clan_message.router)
|
||||
|
||||
|
||||
@hydra.main(config_path="conf", config_name="config")
|
||||
def main(cfg: DakinyConfig):
|
||||
@@ -67,10 +61,6 @@ def main(cfg: DakinyConfig):
|
||||
bot.add_view(VoteHighcouncilView(cfg, bot.get_guild(cfg.params.guild_id)))
|
||||
print(f"{bot.user.name} has connected to Discord!")
|
||||
|
||||
config = uvicorn.Config("main:app", port=5000, log_level="info")
|
||||
server = uvicorn.Server(config)
|
||||
await server.serve()
|
||||
|
||||
# Run Discord bot
|
||||
bot.run(bot.config.params.discord_token)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user