ソースを参照

modified: betaseries.py Ajout de la chance to_see pour les episodes à voir

modified:   bot.py Ajout de la chance to_see pour les episodes à voir
master
administrator 8ヶ月前
コミット
d2cf699e11
2個のファイルの変更44行の追加3行の削除
  1. +3
    -2
      betaseries.py
  2. +41
    -1
      bot.py

+ 3
- 2
betaseries.py ファイルの表示

@@ -8,6 +8,7 @@ import requests
import json
from config import config
import os
# import time
from os import path
from telegram_api import send_message

@@ -116,7 +117,7 @@ def check_latest(thetvdb_id):
message = 'Nouvel episode de ' + title + ' ! ' + 'S' + str(latest_season) + 'E' + str(latest_episode)
send_message(message)
os.remove(file_path)
#create_file(file_path, episode_info)
create_file(file_path, episode_info)
return
print("Aucun changement")
@@ -159,7 +160,7 @@ def to_see(thetvdb_id):
return

def main():
#Only here for debug
#Only here for debug
login_beta()
print(get_title_only('354198'))



+ 41
- 1
bot.py ファイルの表示

@@ -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()


読み込み中…
キャンセル
保存