diff --git a/website/static/website/example.py b/website/static/website/example.py index 3a6fdbf..cd900d8 100644 --- a/website/static/website/example.py +++ b/website/static/website/example.py @@ -1,12 +1,12 @@ -from telegram.ext import Updater, CommandHandler +from telegram import Update +from telegram.ext import Updater, CommandHandler, CallbackContext -def hello(update, context): - update.message.reply_text( - 'Hello {}'.format(update.message.from_user.first_name)) +def hello(update: Update, context: CallbackContext) -> None: + update.message.reply_text(f'Hello {update.effective_user.first_name}') -updater = Updater('YOUR TOKEN HERE', use_context=True) +updater = Updater('YOUR TOKEN HERE') updater.dispatcher.add_handler(CommandHandler('hello', hello)) diff --git a/website/templates/website/index.html b/website/templates/website/index.html index 31f4509..e847917 100644 --- a/website/templates/website/index.html +++ b/website/templates/website/index.html @@ -11,15 +11,15 @@

It's fun

and the highlighted code underneath with pygmentize -f html example.py {% endcomment %} -
from telegram.ext import Updater, CommandHandler
+
from telegram import Update
+from telegram.ext import Updater, CommandHandler, CallbackContext
 
 
-def hello(update, context):
-    update.message.reply_text(
-        'Hello {}'.format(update.message.from_user.first_name))
+def hello(update: Update, context: CallbackContext) -> None:
+    update.message.reply_text(f'Hello {update.effective_user.first_name}')
 
 
-updater = Updater('YOUR TOKEN HERE', use_context=True)
+updater = Updater('YOUR TOKEN HERE')
 
 updater.dispatcher.add_handler(CommandHandler('hello', hello))