Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
metefichas
metefichas
Commits
8d2f73f1
Commit
8d2f73f1
authored
Apr 25, 2022
by
Metefichas Team
Browse files
Actually announce the available commands to the user via api
parent
beb1ace8
Changes
1
Hide whitespace changes
Inline
Side-by-side
metefichas.py
View file @
8d2f73f1
...
...
@@ -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
))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment