Skip to content

Test #4

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

Open
wants to merge 147 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
07c0e82
first commit
Vlad-KVR May 14, 2021
8494f65
add login function
Vlad-KVR May 14, 2021
58ba0af
change start message
Vlad-KVR May 14, 2021
6a4748c
change aithorization message
Vlad-KVR May 14, 2021
804cea1
delete password tree
Vlad-KVR May 14, 2021
d4502a6
change login variable to username
Vlad-KVR May 14, 2021
14da379
connect to salesforce
Vlad-KVR May 14, 2021
2c84648
change requirments.txt
Vlad-KVR May 14, 2021
dd461c3
delete security token
Vlad-KVR May 14, 2021
521df83
delete contact var
Vlad-KVR May 14, 2021
2d7e571
add class UserTelegram
Vlad-KVR May 14, 2021
31e7801
change start message
Vlad-KVR May 14, 2021
57ceb85
update password message
Vlad-KVR May 14, 2021
ad2b954
change login,password message
Vlad-KVR May 14, 2021
23afe0a
change login,password message
Vlad-KVR May 14, 2021
9c0d1a4
add usersTelegram
Vlad-KVR May 14, 2021
e3b1f1e
change usrname password global var on object var
Vlad-KVR May 14, 2021
8dcad13
add bool isUserLog
Vlad-KVR May 14, 2021
e6a519f
remove not in isUserLog
Vlad-KVR May 14, 2021
49e8a1a
add end function
Vlad-KVR May 14, 2021
0c271df
change end function on cancel
Vlad-KVR May 14, 2021
86a357a
change place end function
Vlad-KVR May 14, 2021
a954bfe
add comment for end function
Vlad-KVR May 14, 2021
80d615f
add end in echo function
Vlad-KVR May 14, 2021
d85847c
change if in echo
Vlad-KVR May 14, 2021
b3d183d
add return in echo
Vlad-KVR May 14, 2021
e129b5b
delete run start function in echo
Vlad-KVR May 14, 2021
76d053b
add invoke start in echo
Vlad-KVR May 14, 2021
dd18105
filled contact fill in userTelegram object in login function
Vlad-KVR May 15, 2021
e216f26
change 'contact' on 'user.contact'
Vlad-KVR May 15, 2021
8b33a23
add str(user.contact) in login
Vlad-KVR May 15, 2021
c825d0a
get email in contact
Vlad-KVR May 15, 2021
4009e2e
delete get email
Vlad-KVR May 15, 2021
e77b5fe
login function get attributes
Vlad-KVR May 15, 2021
2e2a11b
get one record in login func
Vlad-KVR May 15, 2021
50b0129
get email in login func
Vlad-KVR May 15, 2021
70eb648
change query to incorect
Vlad-KVR May 15, 2021
385ed95
add reply about incorrect login
Vlad-KVR May 15, 2021
9234987
change if else to try except
Vlad-KVR May 15, 2021
ad72833
chage query for login
Vlad-KVR May 15, 2021
70f08d6
add throw exception if contact empty
Vlad-KVR May 15, 2021
b46b18b
insert new bot
Vlad-KVR May 15, 2021
cfe4c58
change place bot
Vlad-KVR May 15, 2021
0f2621b
on old bot
Vlad-KVR May 15, 2021
a7ab183
add import to old bot
Vlad-KVR May 15, 2021
01b773a
add bot in start function
Vlad-KVR May 15, 2021
b632978
add replyKeyboard
Vlad-KVR May 15, 2021
3b3105c
change button name
Vlad-KVR May 15, 2021
7f5f849
add echoForExistUser
Vlad-KVR May 15, 2021
a31117a
add reply text on create card
Vlad-KVR May 17, 2021
667f016
add reply on cancel message
Vlad-KVR May 17, 2021
56d4c22
update repy on cancel message
Vlad-KVR May 17, 2021
19744f0
update reply on cancel message
Vlad-KVR May 17, 2021
ba5ec0b
update reply on cancel message
Vlad-KVR May 17, 2021
0ba5cd5
update reply on cancel message
Vlad-KVR May 17, 2021
380327c
create card class
Vlad-KVR May 17, 2021
e1ffe00
update keyboard markup
Vlad-KVR May 17, 2021
eb85a52
update reply cancel message
Vlad-KVR May 17, 2021
1e5c2fc
update replyMarkup
Vlad-KVR May 17, 2021
1478225
update reply Markup[
Vlad-KVR May 17, 2021
3f89796
make get current balance
Vlad-KVR May 17, 2021
f5cceef
update reply about success auth
Vlad-KVR May 17, 2021
cb9f3e4
update reply success auth
Vlad-KVR May 17, 2021
e6343ef
update get current balance
Vlad-KVR May 17, 2021
38853ca
update reply end message
Vlad-KVR May 17, 2021
321878f
create creatingCardDate/Amount/Decription
Vlad-KVR May 17, 2021
2ba1880
update createCardKeyboard
Vlad-KVR May 17, 2021
7575308
update mainMenuKeyboard
Vlad-KVR May 17, 2021
d125c68
create getOptionsForDaysOfMonthKeyboard
Vlad-KVR May 17, 2021
7df72c3
update reply on calendar message
Vlad-KVR May 17, 2021
9884d61
update getOptionsForDaysOfMonthKeyboard
Vlad-KVR May 17, 2021
266b635
update getOptionsForDaysOfMonthKeyboard
Vlad-KVR May 17, 2021
845c0bc
update getOptionsForDaysOfMonthKeyboard
Vlad-KVR May 17, 2021
7ae431d
update creatingCardDate
Vlad-KVR May 17, 2021
72b9567
update getOptionsForDaysOfMonthKeyboard
Vlad-KVR May 17, 2021
f39d9c5
update getOptionsForDaysOfMonthKeyboard
Vlad-KVR May 17, 2021
432731b
update getOptionsForDaysOfMonthKeyboard
Vlad-KVR May 17, 2021
f8ef3db
update getOptionsForDaysOfMonthKeyboard
Vlad-KVR May 17, 2021
b543f4a
update getOptionsForDaysOfMonthKeyboard
Vlad-KVR May 17, 2021
8394c13
update getOptionsForDaysOfMonthKeyboard
Vlad-KVR May 17, 2021
bda28f5
update creatingCardDate
Vlad-KVR May 17, 2021
c45a436
update creatingCardDate
Vlad-KVR May 17, 2021
e07f5ce
update creatingCardDate
Vlad-KVR May 17, 2021
b748b05
update creatingCardDate
Vlad-KVR May 17, 2021
09ef46a
creatingCardDate
Vlad-KVR May 17, 2021
ddab36c
create getDateFromString
Vlad-KVR May 17, 2021
8fc2ce8
update creatingCardDate
Vlad-KVR May 17, 2021
3fd0526
debug
Vlad-KVR May 17, 2021
ba60920
debug
Vlad-KVR May 17, 2021
78632b9
debug
Vlad-KVR May 17, 2021
728a427
update getDateFromString
Vlad-KVR May 17, 2021
61685d3
update getDateFromString
Vlad-KVR May 17, 2021
fc19dcd
update getDateFromString
Vlad-KVR May 17, 2021
516c7dc
update import
Vlad-KVR May 17, 2021
4296ecf
debug getDateFromString
Vlad-KVR May 17, 2021
f77fb53
debug getDateFromString
Vlad-KVR May 17, 2021
9c1981b
debug getDateFromString
Vlad-KVR May 17, 2021
dbb3506
debug getDateFromString
Vlad-KVR May 17, 2021
f5656a7
debug getDateFromString
Vlad-KVR May 17, 2021
da452b0
debug getDateFromString
Vlad-KVR May 17, 2021
e3ee777
update getDateFromString
Vlad-KVR May 17, 2021
9da2a6a
update getDateFromString
Vlad-KVR May 17, 2021
a1539c2
update getDateFromString
Vlad-KVR May 17, 2021
e1b923a
update creatingCardDate
Vlad-KVR May 17, 2021
9cd11f5
update creatingCardDate
Vlad-KVR May 17, 2021
8a83a1e
create cancel keyboard
Vlad-KVR May 17, 2021
554ebc6
update creatingCardAmount, creatingCardDecription
Vlad-KVR May 17, 2021
8c97f8c
debug creatingCardAmount
Vlad-KVR May 17, 2021
a095cd6
debug
Vlad-KVR May 17, 2021
f04fc4a
debug
Vlad-KVR May 17, 2021
d67320d
create confirmCreateCard
Vlad-KVR May 17, 2021
8b0fecc
UPDATE creatingCard
Vlad-KVR May 17, 2021
cbcf3d0
update getDateFromString
Vlad-KVR May 17, 2021
6c15845
update creatingCardDecription
Vlad-KVR May 17, 2021
8299281
update confirmCreateCard
Vlad-KVR May 17, 2021
61e2f3b
update confirmCreateCard
Vlad-KVR May 17, 2021
e698761
update confirmCreateCard
Vlad-KVR May 17, 2021
db645cb
update createCardInSalesforce
Vlad-KVR May 17, 2021
1ca559d
update createCardInSalesforce
Vlad-KVR May 17, 2021
9a867c0
refactoring all file
Vlad-KVR May 17, 2021
bbb6d96
update start
Vlad-KVR May 17, 2021
7051f15
delete message 'ты не должен видеть это сообщение'
Vlad-KVR May 17, 2021
52e286b
update creatingCardDateNone
Vlad-KVR May 17, 2021
3f5b98e
update creatingCardDateNone
Vlad-KVR May 17, 2021
73b10da
update creatingCardDateNone
Vlad-KVR May 17, 2021
00ae528
update creatingCardDateNone
Vlad-KVR May 17, 2021
63fc2f7
update createCardInSalesforce
Vlad-KVR May 17, 2021
8b990af
debug
Vlad-KVR May 17, 2021
05bd071
update creatingCardDateNone
Vlad-KVR May 17, 2021
01e631a
debug
Vlad-KVR May 17, 2021
c2dd514
update getStringAsDateAndValidate
Vlad-KVR May 17, 2021
2b63560
delete debugs
Vlad-KVR May 17, 2021
fe6a884
update createCardInSalesforce
Vlad-KVR May 17, 2021
2031ebb
update createCardInSalesforce
Vlad-KVR May 17, 2021
5f0f483
update createCardInSalesforce
Vlad-KVR May 17, 2021
86f9993
debug createCardInSalesforce
Vlad-KVR May 17, 2021
13c6c14
debug createCardInSalesforce
Vlad-KVR May 17, 2021
cd2f1e3
debug
Vlad-KVR May 17, 2021
264e401
update createCardInSalesforce
Vlad-KVR May 17, 2021
262a5bb
update createCardInSalesforce
Vlad-KVR May 17, 2021
b514b28
update createCardInSalesforce
Vlad-KVR May 17, 2021
7aad7b6
update createCardInSalesforce
Vlad-KVR May 17, 2021
6bc9964
update createCardInSalesforce
Vlad-KVR May 17, 2021
922fc70
update balance/amount output
Vlad-KVR May 17, 2021
71caf31
update readme
Vlad-KVR May 17, 2021
974ef0f
update readme
Vlad-KVR May 17, 2021
6753452
update readme
Vlad-KVR Jul 12, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 3 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,58 +1,3 @@


# python-telegram-bot-heroku
A guide to hosting a telegram bot created using the python-telegram-bot library with heroku.
![Deploy your Ember project to Heroku from Github - Philip Mutua ...](https://miro.medium.com/max/3600/1*fIjRtO5P8zc3pjs0E5hYkw.png)
See the full article explaining the steps [here](https://towardsdatascience.com/how-to-deploy-a-telegram-bot-using-heroku-for-free-9436f89575d2).

## Getting Started
Before you begin, you will need a Telegram bot API token from [BotFather](https://t.me/botfather).

1. Download the three files in this repo: bot.py (containing your python code for the Telegram bot), requirements.txt (containing the python libraries to be installed), and Procfile (containing the command to execute the python file).
2. Login / [create](https://signup.heroku.com/dc) a Heroku account.
3. Install [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git).
4. Install the [Heroku CLI](https://devcenter.heroku.com/articles/getting-started-with-python#set-up).
5. Once installed, you can use the _heroku_ command in your terminal / command prompt. Go to the same directory as the files in this repository, and type:

> heroku login

A new window will be opened in your browser prompting you to login, so just click on the button.

6. Once you are logged in, go back to the command line. Type in
> heroku create

to create your new webapp. Heroku will assign your webapp a name as well as the link to your webapp, which should be of the format [https://{yourherokuappname}.herokuapp.com/.](https://yourherokuappname.herokuapp.com/.)

7. To the bot.py file, change the TOKEN variable to the API token of your telegram bot, and change the yourherokuappname to the name of your heroku app in the line

> updater.bot.setWebhook('https://yourherokuappname.herokuapp.com/' + TOKEN)

8. Next, in your command line, type the following commands in the following order:

> git init
> git add .
> git commit -m "first commit"

> heroku git:remote -a YourAppName

> git push heroku master

(Make sure to replace YourAppName with the name of your Heroku webapp)

You should then see the following messages:

![](https://cdn-images-1.medium.com/max/1000/1*y3JH7a7mY4oYFaAjDCA1Ow.png)

In particular, it will say that a Python app is detected and it will install the required libraries in the requirements.txt file using pip. Then, it will read the Procfile which specifies that the bot.py file is to be executed.

9. Go to your conversation with your Telegram bot on Telegram and type /start. The bot should be working now!

Since you are using the free plan on heroku, the bot will sleep after 30 minutes of inactivity. So do expect the bot to take a few seconds to respond to your /start if you are using it more than 30 minutes after it was previously used. Other than that, the bot will respond almost instantaneously~

## What to do if your Bot stops responding
I’ve noticed the bot stops responding after about 24 hours of inactivity (because we are using the free version of Heroku), so if you want to “jolt” the bot awake, one way is to make a change to one of the files (eg. changing the python3 in the procfile to python and vice versa) and then committing the changes with the lines below:
> git add .
> git commit -m "changing python3 to python in Procfile"
> git push heroku master

You should see again see the messages about a Python app being detected and once it finishes executing, your bot should revive now!
Hello!
Here
telegram bot: https://t.me/expenses_salesforce_bot
293 changes: 280 additions & 13 deletions bot.py
Original file line number Diff line number Diff line change
@@ -1,46 +1,313 @@
import logging
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
import calendar
import datetime

from requests.api import options
from telegram import ReplyKeyboardMarkup, Update, ReplyKeyboardRemove
from telegram.ext import (
Updater,
CommandHandler,
MessageHandler,
Filters,
ConversationHandler,
CallbackContext,
)

from simple_salesforce import Salesforce
import os

#####################################Data#####################################
sf = Salesforce(
username='[email protected]',
password='JKlw124O2kanv5kLLf',
security_token='')

PORT = int(os.environ.get('PORT', 5000))

# Enable logging
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO)

logger = logging.getLogger(__name__)
TOKEN = 'YOURTELEGRAMBOTTOKEN'
TOKEN = '1841783209:AAHrDitzlrEGtxSyCUgRr2oSl-vQsgBzPK8'
bot = ''

class UserTelegram:
def __init__(self):
self.login = None
self.password = None
self.exist = False
self.contact = None
self.newCard = None


# Define a few command handlers. These usually take the two arguments update and
# context. Error handlers also receive the raised TelegramError object in error.
class Card:
def __init__(self, keeper):
self.date = None
self.amount = None
self.description = None
self.keeper = keeper
self.confirmCreate = None

usersTelegram = {}


#######################################Functions###########################################

######################################Handlers##############################################
def start(update, context):
"""Send a message when the command /start is issued."""
update.message.reply_text('Hi!')

def help(update, context):
"""Send a message when the command /help is issued."""
update.message.reply_text('Help!')

userId = update._effective_user.id
createUserIfItNeed(userId)
isUserLog = usersTelegram[userId].exist
if isUserLog:
update.message.reply_text('Вы уже зарегистрированы!', reply_markup=mainMenuKeyboard())
else:
update.message.reply_text('Введите логин', reply_markup=ReplyKeyboardRemove())
# sf.Contact.create({'LastName':'simple_salesforce','Email':'[email protected]'})

def echo(update, context):
"""Echo the user message."""
update.message.reply_text(update.message.text)
userId = update._effective_user.id

if userId not in usersTelegram:
start(update,context)
return

if usersTelegram[userId].exist == False:
login(update, context)
else:
echoForExistUser(update,context)

#update.message.reply_text(update.message.text)

def end(update, context):
userId = update._effective_user.id
usersTelegram.pop(userId)
update.message.reply_text('До свидания!',
reply_markup=ReplyKeyboardRemove())

def error(update, context):
"""Log Errors caused by Updates."""
logger.warning('Update "%s" caused error "%s"', update, context.error)

######################################Handlers##############################################

######################################Helper handlers##############################################

def login(update, context):
userId = update._effective_user.id
user = usersTelegram[userId]

if user.login == None:
user.login = update.message.text
update.message.reply_text('Введите пароль')
else:
user.password = update.message.text
try:
user.contact = sf.query(f"SELECT Id, Name, Email, Office__c, Admin__c FROM Contact WHERE Email ='{user.login}' AND Password__c ='{user.password}' LIMIT 1")
throwExceptionIfContactEmpty(user.contact)
user.exist = True
update.message.reply_text('Авторизация прошла успешно ',
reply_markup=mainMenuKeyboard())
except Exception:
update.message.reply_text('Неправильный логин или пароль.Попробуйте Снова')
refreshUser(user)
start(update,context)
return

def echoForExistUser(update,context):
message = update.message.text.lower()
userId = update._effective_user.id
user = usersTelegram[userId]
userContactId = user.contact['records'][0]['Id']
if message == 'текущий баланс':
balance = sf.apexecute('Contact/'+userContactId, method='GET')
update.message.reply_text(str(balance)+'$',
reply_markup=mainMenuKeyboard())
elif message == 'создать карточку':
user.card = Card(userContactId)
update.message.reply_text('На какой день желаете создать карточку?',
reply_markup=createCardKeyboard())
elif message == 'отмена':
cancelToMainMenu(update,user)
elif user.card != None:
creatingCard(update,user,message)

def creatingCard(update,user,message):
if user.card.date == None or user.card.date == True:
creatingCardDate(update,user,message)
elif user.card.amount == None or user.card.amount == True:
creatingCardAmount(update,user,message)
elif user.card.description == None or user.card.description == True:
creatingCardDecription(update,user,message)
elif isinstance(user.card.description,str):
confirmCreateCard(update,user,message)


def creatingCardDate(update,user,message):
if user.card.date == None:
creatingCardDateNone(update,user,message)
elif user.card.date == True:
try:
cardDate = getStringAsDateAndValidate(message)
user.card.date = cardDate
creatingCardAmount(update,user,message)
except Exception as e:
update.message.reply_text('Кажется вы неправильно ввели дату. Попробуйте еще раз или обратитесь к администратору. Пример: 2021-03-31',
reply_markup=cancelKeyboard())
#update.message.reply_text(str(e))

def creatingCardDateNone(update,user,message):
if message == 'сегодня':
today = datetime.datetime.today()
user.card.date = getStringAsDateAndValidate(str(today.day))
creatingCardAmount(update,user,message)
elif message == 'календарь':
update.message.reply_text('Выберите число')
replyMessage = """Или Введите дату вручную(день-месяц-число)
Пример:
2021-03-31
"""
update.message.reply_text(replyMessage,
reply_markup=daysOfMonthKeyboard())
user.card.date = True

def creatingCardAmount(update,user,message):
if user.card.amount == None:
update.message.reply_text('Введите сумму')
user.card.amount = True
elif user.card.amount == True:
try:
cardAmount = float(message)
user.card.amount = cardAmount
creatingCardDecription(update,user,message)
except Exception as e:
update.message.reply_text('Кажется вы неправильно ввели сумму. Попробуйте еще раз или обратитесь к администратору. Пример: 5.014',
reply_markup=cancelKeyboard())

def creatingCardDecription(update,user,message):
if user.card.description == None:
update.message.reply_text('Введите описание')
user.card.description = True
elif user.card.description == True:
user.card.description = update.message.text
confirmCreateCard(update,user,message)

def confirmCreateCard(update,user,message):
if user.card.confirmCreate == None:
update.message.reply_text('Вы уверены что хотите создать следующую карточку?')
update.message.reply_text('Дата: ' + str(user.card.date))
update.message.reply_text('Сумма: ' + str(user.card.amount)+'$')
update.message.reply_text('Описание: ' + user.card.description, reply_markup=confirmKeyboard())
user.card.confirmCreate = True
elif user.card.confirmCreate == True:
createCardInSalesforce(update,user)
user.card = None

def createCardInSalesforce(update,user):
try:
something = sf.Expense_Card__c.create({'CardDate__c': user.card.date,'Amount__c':str(user.card.amount),'Description__c':user.card.description,'CardKeeper__c':user.card.keeper})
user.card = None
update.message.reply_text('Карточка успешно создана!', reply_markup=mainMenuKeyboard())
except Exception as e:
update.message.reply_text('Извините, карточку не получилось создать', reply_markup=mainMenuKeyboard())
for err in e.content:
update.message.reply_text(str(err['message']))


def cancelToMainMenu(update,user):
user.card = None
update.message.reply_text('Что вы хотите сделать?',
reply_markup=mainMenuKeyboard())

######################################Helper handlers##############################################


#########################Keyboards############################
def mainMenuKeyboard():
options = [['Текущий баланс'],['Создать карточку']]
return ReplyKeyboardMarkup(options)

def cancelKeyboard():
options = [['Отмена']]
return ReplyKeyboardMarkup(options, one_time_keyboard=True)

def createCardKeyboard():
options = [['Сегодня'],['Календарь'],['Отмена']]
return ReplyKeyboardMarkup(options, one_time_keyboard=True)

def daysOfMonthKeyboard():
options = getOptionsForDaysOfMonthKeyboard()
return ReplyKeyboardMarkup(options, one_time_keyboard=True)

def confirmKeyboard():
options = [['Да'],['Отмена']]
return ReplyKeyboardMarkup(options, one_time_keyboard=True)

#########################Keyboards############################

#########################Utils############################
def getOptionsForDaysOfMonthKeyboard():
options = []
rowOptions = []
now = datetime.datetime.now()
daysInMonth = calendar.monthrange(now.year, now.month)[1]
count = 1
while count <= daysInMonth:
strCount = str(count)
if len(rowOptions) >= 4 or count == daysInMonth:
rowOptions.append(strCount)
options.append(rowOptions)
rowOptions = []
else:
rowOptions.append(strCount)

count += 1
return options

def getStringAsDateAndValidate(message):
dateStrResult = ''
if len(message) < 3:
now = datetime.datetime.now()
dateStrResult = str(now.year)+'-'+str(now.month)+'-'+message
else:
dateStrResult = message

dateStrForValidate = dateStrResult + ' 00:00:00'
dateObject = datetime.datetime.strptime(dateStrForValidate, '%Y-%m-%d %H:%M:%S')
return dateStrResult

def createUserIfItNeed(userId):
if userId not in usersTelegram:
usersTelegram[userId] = UserTelegram()

def refreshUser(user):
user.login = None
user.password = None
user.exist = False
user.contact = None

def throwExceptionIfContactEmpty(contact):
totalSize = int(contact['totalSize'])
if totalSize < 1:
raise Exception('Contact empty')

#########################Utils############################

def main():
"""Start the bot."""
# Create the Updater and pass it your bot's token.
# Make sure to set use_context=True to use the new context based callbacks
# Post version 12 this will no longer be necessary
updater = Updater(TOKEN, use_context=True)

# Get the dispatcher to register handlers
dp = updater.dispatcher

# on different commands - answer in Telegram
dp.add_handler(CommandHandler("start", start))
dp.add_handler(CommandHandler("help", help))
dp.add_handler(CommandHandler('end',end))

# on noncommand i.e message - echo the message on Telegram
dp.add_handler(MessageHandler(Filters.text, echo))
Expand All @@ -52,7 +319,7 @@ def main():
updater.start_webhook(listen="0.0.0.0",
port=int(PORT),
url_path=TOKEN)
updater.bot.setWebhook('https://yourherokuappname.herokuapp.com/' + TOKEN)
updater.bot.setWebhook('https://frozen-scrubland-72051.herokuapp.com/' + TOKEN)

# Run the bot until you press Ctrl-C or the process receives SIGINT,
# SIGTERM or SIGABRT. This should be used most of the time, since
Expand Down
Loading