From f7dab809fad2dce3364aa2093eb13a81a8e51c57 Mon Sep 17 00:00:00 2001 From: poolitzer Date: Sat, 14 Sep 2019 21:53:20 -0700 Subject: [PATCH 1/3] adding Pygments to requirements, update example to context --- requirements.txt | 1 + website/static/website/example.py | 6 ++---- website/templates/website/index.html | 7 ++++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/requirements.txt b/requirements.txt index 6a97db0..83e62ae 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,3 +2,4 @@ django>=2 cherrypy paste git+https://github.com/natevw/django-sameas.git@master#egg=django-sameas +Pygments diff --git a/website/static/website/example.py b/website/static/website/example.py index 954951d..f7484d2 100644 --- a/website/static/website/example.py +++ b/website/static/website/example.py @@ -1,15 +1,13 @@ from telegram.ext import Updater, CommandHandler -def start(bot, update): - update.message.reply_text('Hello World!') -def hello(bot, update): +def hello(update, context): update.message.reply_text( 'Hello {}'.format(update.message.from_user.first_name)) + updater = Updater('YOUR TOKEN HERE') -updater.dispatcher.add_handler(CommandHandler('start', start)) updater.dispatcher.add_handler(CommandHandler('hello', hello)) updater.start_polling() diff --git a/website/templates/website/index.html b/website/templates/website/index.html index c43247c..d997f60 100644 --- a/website/templates/website/index.html +++ b/website/templates/website/index.html @@ -14,9 +14,10 @@

It's fun

from telegram.ext import Updater, CommandHandler
 
 
-def hello(bot, update):
-    update.message.reply_text(
-        'Hello {}'.format(update.message.from_user.first_name))
+def hello(update, context):
+
+    update.message.reply_text(
+        'Hello {}'.format(update.message.from_user.first_name))
 
 
 updater = Updater('YOUR TOKEN HERE')

From a3798aaae83af591c0bcfaac17df20844a30c476 Mon Sep 17 00:00:00 2001
From: poolitzer 
Date: Sat, 14 Sep 2019 22:41:56 -0700
Subject: [PATCH 2/3] added use_context

---
 website/static/website/example.py    | 2 +-
 website/templates/website/index.html | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/website/static/website/example.py b/website/static/website/example.py
index f7484d2..3a6fdbf 100644
--- a/website/static/website/example.py
+++ b/website/static/website/example.py
@@ -6,7 +6,7 @@ def hello(update, context):
         'Hello {}'.format(update.message.from_user.first_name))
 
 
-updater = Updater('YOUR TOKEN HERE')
+updater = Updater('YOUR TOKEN HERE', use_context=True)
 
 updater.dispatcher.add_handler(CommandHandler('hello', hello))
 
diff --git a/website/templates/website/index.html b/website/templates/website/index.html
index d997f60..7447723 100644
--- a/website/templates/website/index.html
+++ b/website/templates/website/index.html
@@ -20,7 +20,7 @@ 

It's fun

'Hello {}'.format(update.message.from_user.first_name)) -updater = Updater('YOUR TOKEN HERE') +updater = Updater('YOUR TOKEN HERE', use_context=True) updater.dispatcher.add_handler(CommandHandler('hello', hello)) From 122f657c445f39d4123746d15932891a8a4ce7c1 Mon Sep 17 00:00:00 2001 From: poolitzer <25934244+Poolitzer@users.noreply.github.com> Date: Thu, 10 Oct 2019 11:14:38 -0700 Subject: [PATCH 3/3] fixed the spaces and newlines no one wants --- website/templates/website/index.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/website/templates/website/index.html b/website/templates/website/index.html index 7447723..31f4509 100644 --- a/website/templates/website/index.html +++ b/website/templates/website/index.html @@ -15,9 +15,8 @@

It's fun

def hello(update, context): - update.message.reply_text( - 'Hello {}'.format(update.message.from_user.first_name)) + 'Hello {}'.format(update.message.from_user.first_name)) updater = Updater('YOUR TOKEN HERE', use_context=True)