mhthies / qaqabot Goto Github PK
View Code? Open in Web Editor NEWTelegram bot for playing the question-answer-question-answer party game in Telegram.
License: Apache License 2.0
Telegram bot for playing the question-answer-question-answer party game in Telegram.
License: Apache License 2.0
As soon as #31 is implemented, we could add additional administration functionality:
Much more magic than talking to the BotFather!
Manually set languages should be remembered when re-registering.
Expected behavior: First /start
message registers the user
Actual behavior: Error because the first update has no language-code
As experience shows, Users™ don't understand they have to click the START button …
Expected behaviour: Send a message to user that this is not intended
Actual behaviour: Game crashes
Expected behavior: after the last round the bot presents the results and ends the game.
Actual behavior: most games can not be finalized due to running into Telegrams flood limits.
See also #13.
Per default the number of rounds is the number of players. The bot should also show that number so you don't have to manually count players.
Users should be identified via their name, with the @-handle in parenthesis behind that, for more visual clarity.
Expected behaviour: nice way to control setting the amount of roungs
Actual behaviour: annoying way to type because clicking on the command sends it without possibility to write the amount of the rounds
… even if they have a Telegram username. We could use links to make the first name unambiguos and interactive.
This requires that we always store the first name in the database. Perhaps, it also requires that we store usernames additionally for the links. (Maybe, we can add links by account id?)
To prevent accidentally giving an answer instead of writing a question (and vice versa), the bot should validate that:
?
The bot may ask for confirmation, or outright reject the answer/question.
This could be allowed before the game start or even in the game.
The bot could easily adapted to play "continuation story" games, where players have to continue a story with one sentence each, but only know the current last sentence.
We would need to
EntryType
_format_for_next()
methodThis feature would be similar to #25 but more sophisticated: Each player is required to submit two entries (verses) per round (except for the first and last round of a sheet), where only the second entry is passed to the next player.
The response should contain the new message text (instead of the old message text) to be less confusing.
The optimal solution would be word- or character-wise diff view, using underlining and strikethrough to highlight insertions and deletions.
Implement /help
command in group chats and private chats.
/help
in private chats should show to the following link to add the bot to a group: https://t.me/${bot_username}?startgroup=now
When individually requesting a status from the bot you get a list of all games you are currently playing and a count of your current sheets.
We could provide links/inline-keyboards/something else to allow the individual user to receive the status overview that you get from the central game group, so you do not need to spam that group.
We could replace the is_started
and is_finished
boolean fields with datetime fields.
We can show the timestamps in the /status commands response and on the web result pages.
Add a game mode, where text messages and emoji-only messages are passed on alternately, instead of questions and answers.
This would only require modified messages as well as a modification of the game logics, such that a page usually has an odd number of entries and starts and ends with a text message (instead of starting with a question and ending with an answer).
We could also constrain the character set of the emoji messages to refuse alphabetic characters.
See https://github.com/python-telegram-bot/python-telegram-bot/wiki/Avoiding-flood-limits for some documenation of python-telegram-bot on that topic.
The python-telegram-bot library already includes a MessageQueue
for delaying messages to avoid the Telegram flood limits. We could integrate it into our Frontend.def send_messages()
method. For this to work, we need to change the TranslatedMessage
named tuple to include a is_group_chat
flag.
The bot could edit its answer message to the /status command (in groups) regularly to inform about the changed state without new messages.
It would be nice to see only the first question and the last answer of each sheet, and by clicking you can expand/collapse the sheet.
Currently, in case of multiple /join_games, an uncaught consistency error is raised by the database backend.
When clicking a language button of the /set_lang inline keyboard, the following exception is logged:
qaqa_bot.bot - ERROR - Error while update {'update_id': 570115936, 'callback_query': {'id': '356326171076547235', 'chat_instance': '<snip>', 'message': {'message_id': 19, 'date': 1588425785, 'chat': {'id': <snip>, 'type': 'private', 'username': '<snip>', 'first_name': '<snip>', 'last_name': '<snip>'}, 'text': 'Please choose:', 'entities': [], 'caption_entities': [], 'photo': [], 'new_chat_members': [], 'new_chat_photo': [], 'delete_chat_photo': False, 'group_chat_created': False, 'supergroup_chat_created': False, 'channel_chat_created': False, 'reply_markup': {'inline_keyboard': [[{'text': '🇩🇪', 'callback_data': 'de'}, {'text': '🇬🇧', 'callback_data': 'en'}]]}, 'from': {'id': 1223479557, 'first_name': 'QAQA-Test-Bot (Michael)', 'is_bot': True, 'username': 'qaqagame_michael_test_bot'}}, 'data': 'en', 'from': {'id': <snip>, 'first_name': '<snip>', 'is_bot': False, 'last_name': '<snip>', 'username': '<snip>', 'language_code': 'de'}}, '_effective_user': {'id': <snip>, 'first_name': '<snip>', 'is_bot': False, 'last_name': '<snip>', 'username': '<snip>', 'language_code': 'de'}, '_effective_chat': {'id': <snip>, 'type': 'private', 'username': '<snip>', 'first_name': '<snip>', 'last_name': '<snip>'}, '_effective_message': {'message_id': 19, 'date': 1588425785, 'chat': {'id': <snip>, 'type': 'private', 'username': '<snip>', 'first_name': '<snip>', 'last_name': '<snip>'}, 'text': 'Please choose:', 'entities': [], 'caption_entities': [], 'photo': [], 'new_chat_members': [], 'new_chat_photo': [], 'delete_chat_photo': False, 'group_chat_created': False, 'supergroup_chat_created': False, 'channel_chat_created': False, 'reply_markup': {'inline_keyboard': [[{'text': '🇩🇪', 'callback_data': 'de'}, {'text': '🇬🇧', 'callback_data': 'en'}]]}, 'from': {'id': 1223479557, 'first_name': 'QAQA-Test-Bot (Michael)', 'is_bot': True, 'username': 'qaqagame_michael_test_bot'}}}
Traceback (most recent call last):
File "/home/michael/Documents/Freizeit/Programme/python/QAQAbot/venv/lib/python3.8/site-packages/telegram/ext/dispatcher.py", line 343, in process_update
handler.handle_update(update, self, check, context)
File "/home/michael/Documents/Freizeit/Programme/python/QAQAbot/venv/lib/python3.8/site-packages/telegram/ext/handler.py", line 117, in handle_update
return self.callback(update, context)
File "/home/michael/Documents/Freizeit/Programme/python/QAQAbot/qaqa_bot/bot.py", line 235, in button
command = query.message.reply_to_message.text
AttributeError: 'NoneType' object has no attribute 'text'
Each user should get their sheet back.
Add time zone hint.
Always sending the same response (🆗) is a bit monotone. Maybe provide a range of replies and select one at random.
Report:
Beim ersten Mal machte der Bot nichts nachdem alle die erste Antwort geschrieben hatten und beim zweiten Mal nach der zweiten Antwort. Wir konnten also nicht weiterspielen obwohl alle Antworten gegeben waren.
Den status haben wir gefragt, er hat auf niemanden gewartet. Wir probieren gerade den Asynchronmodus, das scheint bisher besser zu funktionieren.
Und das passiert nur im synchronmodus
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.