1
0
Fork 0
mirror of https://gitlab.com/oloturia/fumcaso.git synced 2025-01-06 21:47:17 +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 = os.path.dirname(os.path.abspath(__file__))
fileDir = fileDir +"/" fileDir = fileDir +"/"
def newStrip(bot, update, args): def newStrip(update, context):
config = readConfig(platform="telegram",profile=args) config = readConfig(platform="telegram",profile=context.args)
status = createStrip(config) status = createStrip(config)
if status == 0: if status == 0:
try: try:
strip_file=open(config["saveLocation"]+config["filename"],"rb") strip_file=open(config["saveLocation"]+config["filename"],"rb")
bot.send_photo(chat_id=update.message.chat_id,photo=strip_file) context.bot.send_photo(chat_id=update.message.chat_id,photo=strip_file)
strip_file.close() strip_file.close()
os.remove(config["saveLocation"]+config["filename"]) os.remove(config["saveLocation"]+config["filename"])
except Exception as err: except Exception as err:
print(err) print(err)
else: else:
print("Creation of image failed\n") print("Creation of image failed\n")
print(status) print(status)
if __name__ == "__main__": if __name__ == "__main__":
config = readConfig(platform="telegram") config = readConfig(platform="telegram")
with open(config["token"]) as token_file: with open(config["token"]) as token_file:
content = token_file.readlines() content = token_file.readlines()
token = content[0].strip() token = content[0].strip()
updater = Updater(token) updater = Updater(token, use_context=True)
dp = updater.dispatcher dp = updater.dispatcher
dp.add_handler(CommandHandler('strip',newStrip, pass_args=True)) dp.add_handler(CommandHandler('strip',newStrip, pass_args=True))
updater.start_polling() updater.start_polling()
updater.idle() updater.idle()