-
Notifications
You must be signed in to change notification settings - Fork 185
Description
Describe the bug.
Hiya! I've built a pretty simple bot using interactions.py, and it works extremely well for my use case, but I'm having trouble getting the bot to stay online.
I've turned on some logging and it seems to get stuck after messages like this:
2022-07-22T14:52:35.058970301Z app[web.1]: 07/22/2022 02:52:35 PM [DEBUG] (gateway) {"op": 1, "d": 1}
2022-07-22T14:52:35.059016619Z app[web.1]: 07/22/2022 02:52:35 PM [DEBUG] (gateway) HEARTBEAT
2022-07-22T14:52:35.087019104Z app[web.1]: 07/22/2022 02:52:35 PM [DEBUG] (gateway) None
2022-07-22T14:52:35.087030590Z app[web.1]: 07/22/2022 02:52:35 PM [DEBUG] (gateway) HEARTBEAT_ACK
2022-07-22T14:53:16.351026755Z app[web.1]: 07/22/2022 02:53:16 PM [DEBUG] (gateway) {"op": 1, "d": 1}
2022-07-22T14:53:16.351077315Z app[web.1]: 07/22/2022 02:53:16 PM [DEBUG] (gateway) HEARTBEAT
2022-07-22T14:53:16.390594024Z app[web.1]: 07/22/2022 02:53:16 PM [DEBUG] (gateway) None
2022-07-22T14:53:16.390606161Z app[web.1]: 07/22/2022 02:53:16 PM [DEBUG] (gateway) HEARTBEAT_ACK
2022-07-22T14:53:57.642993887Z app[web.1]: 07/22/2022 02:53:57 PM [DEBUG] (gateway) {"op": 1, "d": 1}
2022-07-22T14:53:57.643029579Z app[web.1]: 07/22/2022 02:53:57 PM [DEBUG] (gateway) HEARTBEAT
2022-07-22T14:54:38.927076841Z app[web.1]: 07/22/2022 02:54:38 PM [DEBUG] (gateway) HEARTBEAT_ACK missing, reconnecting...
I don't get messages after that, and restarting the bot seems to fix it for a day or two and then it is back to that.
My bot is really simple, so here is my usage:
@bot.command(
name="print",
description="Prints a message to the Paper Crumpler 🖨",
scope=discord_guild_id,
options=[
interactions.Option(
name="text",
description="Something cool you want printed!",
type=interactions.OptionType.STRING,
required=True,
),
],
)
async def print_message(ctx: interactions.CommandContext, text: str):
nick = ctx.author.nick or ctx.author.user.username
logging.info(f"Printing message: [{nick}@discord] {text}")
send_print_server_message(text, nick) # Updates a record in a Firebase DB
await ctx.send(f"Printing message: `[{nick}@discord] {text}`")and then I'm just kicking off the bot with bot.start().
Currently using discord-py-interactions==4.2.1, but it's been an issue on a couple of older versions and unstable as well. Running inside a Docker container FROM python:3.10.4-slim-bullseye.
List the steps.
- Create a bot that can respond to a single command
- Run bot using
bot.start() - Wait a day or so
- Eventually the bot stops responding and the last logged message is
(gateway) HEARTBEAT_ACK missing, reconnecting...
What you expected.
The application appears to continue to run but never successfully reconnects. If it crashed or otherwise exited, I'd be able to easily restart the application, but since it gets stuck like that, it's hard to detect.
What you saw.
2022-07-22T14:52:35.058970301Z app[web.1]: 07/22/2022 02:52:35 PM [DEBUG] (gateway) {"op": 1, "d": 1}
2022-07-22T14:52:35.059016619Z app[web.1]: 07/22/2022 02:52:35 PM [DEBUG] (gateway) HEARTBEAT
2022-07-22T14:52:35.087019104Z app[web.1]: 07/22/2022 02:52:35 PM [DEBUG] (gateway) None
2022-07-22T14:52:35.087030590Z app[web.1]: 07/22/2022 02:52:35 PM [DEBUG] (gateway) HEARTBEAT_ACK
2022-07-22T14:53:16.351026755Z app[web.1]: 07/22/2022 02:53:16 PM [DEBUG] (gateway) {"op": 1, "d": 1}
2022-07-22T14:53:16.351077315Z app[web.1]: 07/22/2022 02:53:16 PM [DEBUG] (gateway) HEARTBEAT
2022-07-22T14:53:16.390594024Z app[web.1]: 07/22/2022 02:53:16 PM [DEBUG] (gateway) None
2022-07-22T14:53:16.390606161Z app[web.1]: 07/22/2022 02:53:16 PM [DEBUG] (gateway) HEARTBEAT_ACK
2022-07-22T14:53:57.642993887Z app[web.1]: 07/22/2022 02:53:57 PM [DEBUG] (gateway) {"op": 1, "d": 1}
2022-07-22T14:53:57.643029579Z app[web.1]: 07/22/2022 02:53:57 PM [DEBUG] (gateway) HEARTBEAT
2022-07-22T14:54:38.927076841Z app[web.1]: 07/22/2022 02:54:38 PM [DEBUG] (gateway) HEARTBEAT_ACK missing, reconnecting...
What version of the library did you use?
release
Version specification
4.2.1
Code of Conduct
- I agree to follow the contribution requirements.