Commit 8d2f73f1 authored by Metefichas Team's avatar Metefichas Team
Browse files

Actually announce the available commands to the user via api

parent beb1ace8
......@@ -22,7 +22,7 @@ import tempfile
from threading import Thread
from telegram.ext import Updater, CommandHandler, MessageHandler, CallbackQueryHandler, Filters, CallbackContext
from telegram import ChatAction, InlineKeyboardButton, InlineKeyboardMarkup, Update
from telegram import ChatAction, InlineKeyboardButton, InlineKeyboardMarkup, Update, BotCommand
from telegram.ext.dispatcher import run_async
import telegram
......@@ -191,6 +191,13 @@ def callback_schedule_fichaxes_for_today(context):
Thread(target=schedule_fichaxes_for_today, args=(bot,)).start()
job2 = j.run_repeating(callback_schedule_fichaxes_for_today, interval=3600, first=1)
def callback_set_commands(context):
job = context.job
bot = context.bot
command_list = [ BotCommand(command = 'ping', description = 'comprobar o estado do bot'), BotCommand(command = 'fichar', description = 'fichar manualmente') ];
bot.setMyCommands(command_list)
job3 = j.run_once(callback_set_commands, when=0)
dispatcher.add_handler(CallbackQueryHandler(button_press, run_async=True))
dispatcher.add_handler(CommandHandler(['ping','start'], startcmd, run_async=True))
dispatcher.add_handler(CommandHandler(['ficha','fichar'], ficharcmd, run_async=True))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment