-
Notifications
You must be signed in to change notification settings - Fork 0
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
Enable commands in DMs #20
Conversation
kipubot/handlers/_dm_handlers.py
Outdated
query_result = CON.execute( | ||
f'SELECT R.chat_id,chat.title FROM in_chat AS C \ | ||
JOIN raffle as R ON C.chat_id=R.chat_id JOIN\ | ||
chat ON chat.chat_id=R.chat_id\ | ||
WHERE C.user_id={update.effective_user.id}').fetchall() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
F-string = can inject SQL very bad 😞
chat_id = update.effective_chat.id | ||
chat_title = update.effective_chat.title | ||
if update.callback_query is not None: | ||
chat_id, chat_title, graph_type = update.callback_query.data | ||
message = update.callback_query.message | ||
else: | ||
chat_id = update.effective_chat.id | ||
chat_title = update.effective_chat.title | ||
message = update.message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Joku data verification vois olla hyvä, jos botti restarttaa tms.
Esim:
if (isinstance(query.data, InvalidCallbackData) or
len(query.data) != 3 or
not isinstance(query.data[0], int) or
not isinstance(query.data[1], str) or
not isinstance(query.data[2], int)):
await query.message.edit_text(STRINGS['unknown_error'])
return ConversationHandler.END
closed since the structure of the program has changed drastically. |
enabling commands in DMs:
closes #17