2019-09-19 01:59:13 +02:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
from telegram.ext import Updater, CommandHandler
|
|
|
|
from randstrip import createStrip
|
|
|
|
import requests
|
2019-09-24 13:26:31 +02:00
|
|
|
import os
|
|
|
|
|
|
|
|
fileDir = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
fileDir = fileDir +"/"
|
2019-09-19 01:59:13 +02:00
|
|
|
|
|
|
|
def newStrip(bot, update):
|
2019-09-25 12:35:05 +02:00
|
|
|
status = createStrip("telegram.png")
|
2019-09-19 01:59:13 +02:00
|
|
|
if status == 0:
|
|
|
|
try:
|
2019-09-24 13:26:31 +02:00
|
|
|
bot.send_photo(chat_id=update.message.chat_id,photo=open(fileDir+"telegram.png","rb"))
|
2019-09-19 01:59:13 +02:00
|
|
|
except Exception as err:
|
|
|
|
print(err)
|
|
|
|
else:
|
|
|
|
print("Creation of image failed\n")
|
|
|
|
print(status)
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2019-11-19 13:24:20 +01:00
|
|
|
with open(fileDir+"telegram_token") as token_file:
|
2019-09-19 01:59:13 +02:00
|
|
|
content = token_file.readlines()
|
|
|
|
token = content[0].strip()
|
|
|
|
updater = Updater(token)
|
|
|
|
dp = updater.dispatcher
|
|
|
|
dp.add_handler(CommandHandler('strip',newStrip))
|
|
|
|
updater.start_polling()
|
|
|
|
updater.idle()
|