parent
d973ac2cc4
commit
8236bfd5aa
|
|
@ -70,7 +70,7 @@ async def return_search(query, page=1, sukebei=False):
|
|||
except IndexError:
|
||||
return '', len(results), ttl
|
||||
|
||||
message_info = dict()
|
||||
message_info = {}
|
||||
ignore = set()
|
||||
|
||||
@app.on_message(filters.command(['nyaasi', f'nyaasi@{bot.username}']))
|
||||
|
|
@ -92,7 +92,11 @@ async def init_search(client, message, query, sukebei):
|
|||
if not result:
|
||||
await message.reply_text('No results found')
|
||||
else:
|
||||
buttons = [InlineKeyboardButton(f'1/{pages}', 'nyaa_nop'), InlineKeyboardButton(f'Next', 'nyaa_next')]
|
||||
buttons = [
|
||||
InlineKeyboardButton(f'1/{pages}', 'nyaa_nop'),
|
||||
InlineKeyboardButton('Next', 'nyaa_next'),
|
||||
]
|
||||
|
||||
if pages == 1:
|
||||
buttons.pop()
|
||||
reply = await message.reply_text(result, reply_markup=InlineKeyboardMarkup([
|
||||
|
|
@ -132,7 +136,12 @@ async def nyaa_callback(client, callback_query):
|
|||
await callback_query.answer('...no', cache_time=3600)
|
||||
return
|
||||
text, pages, ttl = await return_search(query, current_page, sukebei)
|
||||
buttons = [InlineKeyboardButton(f'Prev', 'nyaa_back'), InlineKeyboardButton(f'{current_page}/{pages}', 'nyaa_nop'), InlineKeyboardButton(f'Next', 'nyaa_next')]
|
||||
buttons = [
|
||||
InlineKeyboardButton('Prev', 'nyaa_back'),
|
||||
InlineKeyboardButton(f'{current_page}/{pages}', 'nyaa_nop'),
|
||||
InlineKeyboardButton('Next', 'nyaa_next'),
|
||||
]
|
||||
|
||||
if ttl_ended:
|
||||
buttons = [InlineKeyboardButton('Search Expired', 'nyaa_nop')]
|
||||
else:
|
||||
|
|
@ -196,9 +205,12 @@ class TorrentSearch:
|
|||
return string
|
||||
|
||||
async def update_message(self):
|
||||
prevBtn = InlineKeyboardButton(f"Prev", callback_data=f"{self.command}_previous")
|
||||
prevBtn = InlineKeyboardButton(
|
||||
'Prev', callback_data=f"{self.command}_previous"
|
||||
)
|
||||
|
||||
delBtn = InlineKeyboardButton(f"{emoji.CROSS_MARK}", callback_data=f"{self.command}_delete")
|
||||
nextBtn = InlineKeyboardButton(f"Next", callback_data=f"{self.command}_next")
|
||||
nextBtn = InlineKeyboardButton('Next', callback_data=f"{self.command}_next")
|
||||
|
||||
inline = []
|
||||
if (self.index != 0):
|
||||
|
|
@ -314,9 +326,10 @@ torrents_dict = {
|
|||
'ts': {'source': "https://torrents-api.netlify.app/.netlify/functions/api/all/", 'result_str': RESULT_STR_ALL}
|
||||
}
|
||||
|
||||
torrent_handlers = []
|
||||
for command, value in torrents_dict.items():
|
||||
torrent_handlers.append(TorrentSearch(command, value['source'], value['result_str']))
|
||||
torrent_handlers = [
|
||||
TorrentSearch(command, value['source'], value['result_str'])
|
||||
for command, value in torrents_dict.items()
|
||||
]
|
||||
|
||||
def searchhelp(update, context):
|
||||
help_string = '''
|
||||
|
|
|
|||
Loading…
Reference in New Issue