robbmanes / seeding-reward-bot

Seeding reward bot for Glow's Battlegrounds Community
https://discord.gg/glows
GNU Lesser General Public License v3.0
4 stars 2 forks source link

`update_seeders` fails with boolean ValueError exception when parsing player lists from RCON #6

Closed robbmanes closed 1 year ago

robbmanes commented 1 year ago

Describe the bug During update_seeders we're having tracebacks due to a boolean somehow being returned as a key of a dict it seems:

Traceback (most recent call last):
  File "/root/.cache/pypoetry/virtualenvs/glowbot-Yr1L9Y8C-py3.11/lib/python3.11/site-packages/discord/ext/tasks/__init__.py", line 198, in _loop
    raise exc
  File "/root/.cache/pypoetry/virtualenvs/glowbot-Yr1L9Y8C-py3.11/lib/python3.11/site-packages/discord/ext/tasks/__init__.py", line 169, in _loop
    await self.coro(*args, **kwargs)
  File "/root/GlowBot/glowbot/tasks.py", line 69, in update_seeders
    player_list = result[rcon_server_url]

This causes incorrect seeding times as the update_seeders method bails.

To Reproduce Only happens during seeders, and only when certain players are present, although I am not sure what the criteria is.

Expected behavior Obviously a string for the RCON name should be returned here, never a bool, and I am unsure how we're getting here. Looking into it.

robbmanes commented 1 year ago

Further testing shows this only occurs when the send_player_message is invoked asynchronously, leading me to believe somehow our session response is being overwritten when we do get_player_list as well.

Commenting out send_player_message resolves the problem, which further cements the need for a handler CRCON http library that is async capable.

robbmanes commented 1 year ago

Fixed in https://github.com/glows-battlegrounds/GlowBot/pull/7.