Skip to content

Commit

Permalink
🆙 ⬆️ update main.py
Browse files Browse the repository at this point in the history
- add inline mode
  • Loading branch information
Eqwe-Wewe authored Jul 11, 2021
1 parent 60ae1a2 commit 16e76b4
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,4 +337,27 @@ def button(text: str, url: str = None, callback_data: str = None):
return keyboard


bot.polling(none_stop=True)
@bot.inline_handler(func=lambda query: True)
def inline_mode(inline_query):
current = telebot.types.InlineQueryResultArticle(
'1',
'Погода сейчас',
telebot.types.InputTextMessageContent(set_message(Var.url)))
ten_day = telebot.types.InlineQueryResultArticle(
'2',
'Прогноз на 10 дней',
telebot.types.InputTextMessageContent(set_message_10_days(Var.url)))
bot.answer_inline_query(
inline_query.id,
[current, ten_day])


def main():
bot.polling(none_stop=True)


if __name__ == '__main__':
try:
main()
except Exception as err:
print(f'error: {err}')

0 comments on commit 16e76b4

Please sign in to comment.