|
|
|
@@ -5,7 +5,8 @@ |
|
|
|
import logging |
|
|
|
import requests |
|
|
|
import json |
|
|
|
from telegram.ext import Updater, CommandHandler |
|
|
|
from telegram import InlineKeyboardButton, InlineKeyboardMarkup |
|
|
|
from telegram.ext import Updater, CommandHandler, CallbackQueryHandler |
|
|
|
from config import config, series |
|
|
|
from betaseries import login_beta, get_title_only, to_see |
|
|
|
from telegram_api import send_message |
|
|
|
@@ -107,6 +108,42 @@ def liste(update, context): |
|
|
|
|
|
|
|
message += '\n' + "Bon Visionnage !" |
|
|
|
send_message(message) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def coding(update, context): |
|
|
|
if type(series) == str : |
|
|
|
file_path = 'latest/' + series + '.json' |
|
|
|
print(file_path) |
|
|
|
with open(file_path) as json_file: |
|
|
|
data = json.load(json_file) |
|
|
|
message = u'Episode que vous allez marquer comme vu : ' + data['serie_title'] + ' - S' + str(data['season ']) + 'E' + str(data['episode']) |
|
|
|
send_message(message) |
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
keyboard = [[InlineKeyboardButton("Option 1", callback_data='1'), |
|
|
|
InlineKeyboardButton("Option 2", callback_data='2'), |
|
|
|
InlineKeyboardButton("Option 3", callback_data='3')], |
|
|
|
|
|
|
|
[InlineKeyboardButton("Option 4", callback_data='5')] ] |
|
|
|
|
|
|
|
reply_markup = InlineKeyboardMarkup(keyboard) |
|
|
|
|
|
|
|
update.message.reply_text(message, reply_markup=reply_markup) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def button(update, context): |
|
|
|
query = update.callback_query |
|
|
|
|
|
|
|
query.answer() |
|
|
|
|
|
|
|
query.edit_message_text(text="Selected option: {}".format(query.data)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main(): |
|
|
|
updater = Updater(token_bot, use_context=True) |
|
|
|
@@ -133,6 +170,9 @@ def main(): |
|
|
|
|
|
|
|
dp.add_handler(CommandHandler("check", check_seen)) |
|
|
|
|
|
|
|
dp.add_handler(CommandHandler("code", coding)) |
|
|
|
updater.dispatcher.add_handler(CallbackQueryHandler(button)) |
|
|
|
|
|
|
|
|
|
|
|
updater.start_polling() |
|
|
|
updater.idle() |
|
|
|
|