Last active
May 10, 2018 12:10
-
-
Save JosXa/55e81f56ba10b5c884f418e5eb221569 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def echo(update, context: HandlerContext): | |
""" | |
Assumes that the context acts as a random-access key-value store so that the user can add | |
his or her own objects to be accessible in every callback | |
""" | |
# Automatically extracts the current peer in order to send formatted messages | |
context['formatter'].send_success("This has a green :white_checkmark: emoji") # ✅ | |
context['formatter'].send_action_hint("Lightbulb business") # 💡 | |
# Callback manager on the basis of @EchteEldin's proposal | |
arbitrary_stuff = {'user_needs_help': True} | |
callback = context['callback_manager'].generate_callback( | |
action=help, | |
data=arbitrary_stuff, | |
) | |
# I got this MessageBuilder class that abstracts building up responses | |
context['message_builder'].bold('Hello World!').newline().smallcaps('Waddup').inline_button( | |
text=context['formatter'].hint("Get Help"), | |
callback_data=callback | |
).send() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment