2
0
mirror of https://github.com/Nick80835/microbot synced 2025-08-22 18:19:16 +00:00

add ability to disable link preview for inline articles

This commit is contained in:
Nick80835 2020-11-05 14:05:49 -05:00
parent 561361811e
commit 9448539c73
2 changed files with 3 additions and 1 deletions

View File

@ -48,6 +48,7 @@ class InlineArticleCommand:
self.pattern_extra = args.get("pattern_extra", "") self.pattern_extra = args.get("pattern_extra", "")
self.default = args.get("default", None) self.default = args.get("default", None)
self.extra = args.get("extra", None) self.extra = args.get("extra", None)
self.link_preview = args.get("link_preview", True)
class CallbackQueryCommand: class CallbackQueryCommand:

View File

@ -137,6 +137,7 @@ class CommandHandler():
event.command = pattern_match.groups()[0] event.command = pattern_match.groups()[0]
event.extra = command.extra event.extra = command.extra
event.object = command event.object = command
event.link_preview = command.link_preview
result_list = await command.function(event) result_list = await command.function(event)
@ -147,7 +148,7 @@ class CommandHandler():
for result in result_list: for result in result_list:
try: try:
articles += [await builder.article(title=result["title"], description=result["description"], text=result["text"])] articles += [await builder.article(title=result["title"], description=result["description"], text=result["text"], link_preview=event.link_preview)]
except: except:
print_exc() print_exc()