def idd(bot, update, tags=None, chat_id=None):
randomint = randint(1000, 10000000)
try:
bot.sendChatAction(chat_id, "upload_document")
tags = update.message.text.split(' ', 1)[1]
chat_id = update.message.chat_id
try:
client = Pybooru('Yandere')
posts = client.posts_list(tags="id:"+str(tags), limit=1)
for post in posts:
urllib.request.urlretrieve(post['file_url'], "tmp/anime_bot_" + str(randomint) + ".jpg")
tmp_data = "Uploader: " + post['author'] + "\nID: " + str(post['id'])
globalarray[chat_id] = dict(data=tmp_data)
photo = open('tmp/anime_bot_' + str(randomint) + ".jpg", 'rb')
reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton("More", callback_data='More')]])
bot.sendDocument(chat_id, photo, reply_markup=reply_markup)
os.remove('tmp/anime_bot_' + str(randomint) + ".jpg")
except Exception as e:
print(e)
except:
bot.sendChatAction(chat_id, "upload_document")
client = Pybooru('Yandere')
try:
posts = client.posts_list(tags="id:"+str(tags), limit=1)
for post in posts:
urllib.request.urlretrieve(post['file_url'], "tmp/anime_bot_" + str(randomint) + ".jpg")
tmp_data = "Uploader: " + post['author'] + "\nID: " + str(post['id'])
globalarray[chat_id] = dict(data=tmp_data)
photo = open('tmp/anime_bot_' + str(randomint) + ".jpg", 'rb')
reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton("More", callback_data='More')]])
bot.sendDocument(chat_id, photo, reply_markup=reply_markup)
os.remove('tmp/anime_bot_' + str(randomint) + ".jpg")
except Exception as e:
print(e)
评论列表
文章目录