Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/stats user doesnt work no more #21

Open
hndrk-themer opened this issue Apr 17, 2023 · 3 comments
Open

/stats user doesnt work no more #21

hndrk-themer opened this issue Apr 17, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@hndrk-themer
Copy link

Hey, am running the latest docker image. Unfortunately the /stats user command is broken rn.

This is what the Error log looks like:

2023-04-17 17:11:45,690 - telegram.ext.dispatcher - ERROR - No error handlers are registered, logging exception.
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/telegram/ext/utils/promise.py", line 96, in run
self._result = self.pooled_function(*self.args, **self.kwargs)
File "/usr/src/app/telegram_stats_bot/main.py", line 169, in print_stats
context.bot.send_message(chat_id=update.effective_chat.id,
File "/usr/local/lib/python3.9/site-packages/telegram/bot.py", line 134, in decorator
result = func(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/telegram/bot.py", line 534, in send_message
return self._message( # type: ignore[return-value]
File "/usr/local/lib/python3.9/site-packages/telegram/ext/extbot.py", line 203, in _message
result = super()._message(
File "/usr/local/lib/python3.9/site-packages/telegram/bot.py", line 344, in _message
result = self._post(endpoint, data, timeout=timeout, api_kwargs=api_kwargs)
File "/usr/local/lib/python3.9/site-packages/telegram/bot.py", line 299, in _post
return self.request.post(
File "/usr/local/lib/python3.9/site-packages/telegram/utils/request.py", line 361, in post
result = self._request_wrapper(
File "/usr/local/lib/python3.9/site-packages/telegram/utils/request.py", line 279, in _request_wrapper
raise BadRequest(message)
telegram.error.BadRequest: Can't parse entities: can't find end of italic entity at byte offset 9

@mkdryden
Copy link
Owner

mkdryden commented Apr 18, 2023

Hmm, that's a weird error. That usually means there is something wrong with the markdown being sent in the message. Would you happen to have an underscore or asterisk in your username? (The thing that starts with @ in your profile) I can probably escape the username better:

return f"User {user[1].lstrip('@')}: ```\n{text}\n```", None
or just take out the markdown. It doesn't really need it there anyways.

@hndrk-themer
Copy link
Author

hndrk-themer commented Apr 18, 2023

Yes, my username contains an underscore.

And can confirm, after changing without underscore it works again

@mkdryden mkdryden added the bug Something isn't working label Apr 19, 2023
@mkdryden mkdryden self-assigned this Apr 19, 2023
@eiger8
Copy link

eiger8 commented Oct 24, 2023

I can confirm this behaviour

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants