1
0
Fork 0
mirror of https://gitlab.com/oloturia/fumcaso.git synced 2025-01-04 20:47:16 +01:00

compatible with v.13.1.1 of python-telegram

This commit is contained in:
oloturia 2023-02-16 19:16:56 +01:00
parent 24f5f4c8cc
commit 5c9473fcc9

View file

@ -7,28 +7,28 @@ import os
fileDir = os.path.dirname(os.path.abspath(__file__))
fileDir = fileDir +"/"
def newStrip(bot, update, args):
config = readConfig(platform="telegram",profile=args)
status = createStrip(config)
if status == 0:
try:
strip_file=open(config["saveLocation"]+config["filename"],"rb")
bot.send_photo(chat_id=update.message.chat_id,photo=strip_file)
strip_file.close()
os.remove(config["saveLocation"]+config["filename"])
except Exception as err:
print(err)
else:
print("Creation of image failed\n")
print(status)
def newStrip(update, context):
config = readConfig(platform="telegram",profile=context.args)
status = createStrip(config)
if status == 0:
try:
strip_file=open(config["saveLocation"]+config["filename"],"rb")
context.bot.send_photo(chat_id=update.message.chat_id,photo=strip_file)
strip_file.close()
os.remove(config["saveLocation"]+config["filename"])
except Exception as err:
print(err)
else:
print("Creation of image failed\n")
print(status)
if __name__ == "__main__":
config = readConfig(platform="telegram")
with open(config["token"]) as token_file:
content = token_file.readlines()
token = content[0].strip()
updater = Updater(token)
dp = updater.dispatcher
dp.add_handler(CommandHandler('strip',newStrip, pass_args=True))
updater.start_polling()
updater.idle()
config = readConfig(platform="telegram")
with open(config["token"]) as token_file:
content = token_file.readlines()
token = content[0].strip()
updater = Updater(token, use_context=True)
dp = updater.dispatcher
dp.add_handler(CommandHandler('strip',newStrip, pass_args=True))
updater.start_polling()
updater.idle()