in the code below the event listener works and also the slash command gets recognised, but the prefixed version wont work (same thing when using ext.commands instead of bridge)
import asyncio
from hypercorn.config import Config
from hypercorn.asyncio import serve
from quart import Quart
import discord
from discord.ext import bridge
import signal
loop = asyncio.new_event_loop()
intends = discord.Intents.all()
token = "token"
bot = bridge.Bot(intends=intends, command_prefix="!", loop=loop, debug_guilds=[576380164250927124])
config = Config()
config.bind = ["localhost:8000"]
app = Quart(__name__)
@app.route("/")
async def index():
return "Hello World"
@bot.bridge_command()
async def hello(ctx):
print("test")
await ctx.respond("Hello!")
@bot.event
async def on_ready():
print("Bot ready")
shutdown_event = asyncio.Event()
def _signal_handler():
shutdown_event.set()
# loop.add_signal_handler(signal.SIGTERM, _signal_handler)
try:
bot_task = loop.create_task(bot.start(token))
web_task = loop.create_task(serve(app, config, shutdown_trigger=shutdown_event.wait))
loop.run_until_complete(asyncio.gather(bot_task, web_task))
except KeyboardInterrupt:
loop.run_until_complete(bot.close())
finally:
loop.close()

