limit inline query result

This commit is contained in:
www
2020-12-28 09:29:18 +00:00
parent 5158e4b8da
commit 81911d1056

View File

@@ -179,7 +179,7 @@ class Chat(BaseChat):
r = links[0:6] r = links[0:6]
res = [ res = [
InlineQueryResultArticle( InlineQueryResultArticle(
id=d["url"], id=d["url"][0:49],
title=d["title"], title=d["title"],
url=urljoin(TARGET, d["url"]), url=urljoin(TARGET, d["url"]),
thumb_url=urljoin(TARGET, d["image"]), thumb_url=urljoin(TARGET, d["image"]),
@@ -187,17 +187,14 @@ class Chat(BaseChat):
message_text=urljoin(TARGET, d["url"]) message_text=urljoin(TARGET, d["url"])
), ),
) )
for d in r for d in r[0:10]
] ]
# links=[p["title"]+": "+"(%s) "% p["public_date"] + urljoin(TARGET,p["url"]) for p in r]
self.bot.answer_inline_query(inline_query_id=query.id, results=res) self.bot.answer_inline_query(inline_query_id=query.id, results=res)
return return
def process_command(self, cmd, txt, update): def process_command(self, cmd, txt, update):
self.last_message_id = get_message_id(update) self.last_message_id = get_message_id(update)
u = users[update] u = users[update]
# print("--\ndict: %s" % str(users.asdict()))
# users[get_from_id(update)]=u # users[get_from_id(update)]=u
if cmd == "/s" or cmd == "/search": if cmd == "/s" or cmd == "/search":
self.reply_msg("searching ...") self.reply_msg("searching ...")