yannickgloster / discord-10man

Discord bot for CS:GO Scrims and Pugs
MIT License
39 stars 11 forks source link

[BUG] Score stops updating if unicode in steam name #95

Closed penalte closed 3 years ago

penalte commented 3 years ago

Score stops updating if unicode in steam name.

It has to do with get5_eventapi when it happens the bot has an error.

Traceback (most recent call last):
  File "C:\Users\penalte\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\aiohttp\web_protocol.py", line 418, in start
    resp = await task
  File "C:\Users\penalte\Desktop\5vs5\discord-10man-master\utils\server.py", line 109, in _handler
    gotv = server.get_gotv()
  File "C:\Users\penalte\Desktop\5vs5\discord-10man-master\utils\csgo_server.py", line 50, in get_gotv
    status: str = valve.rcon.execute((self.server_address, self.server_port), self.RCON_password, 'status')
  File "C:\Users\penalte\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\valve\rcon.py", line 631, in execute
    return rcon(command)
  File "C:\Users\penalte\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\valve\rcon.py", line 346, in __call__
    raise RCONMessageError("Couldn't decode response: {}".format(exc))
valve.rcon.RCONMessageError: Couldn't decode response: 'ascii' codec can't decode byte 0xe2 in position 602: ordinal not in range(128)
yannickgloster commented 3 years ago

Looks like if players have non ascii characters in their name, when I use status to get the GOTV port, it will break. Options: a) enforce player names through get5 b) add a catch for decode error in get_gotv c) see if there is a different way to get the port other than status

yannickgloster commented 3 years ago

Will do b) and c) instead of using status, I will use tv_port