Update default help messages with given ones, instead of replacing them
This commit is contained in:
parent
8c37d00602
commit
88835955ef
@ -11,7 +11,7 @@ __author__ = "Davide Testa"
|
|||||||
__email__ = "davide@davte.it"
|
__email__ = "davide@davte.it"
|
||||||
__credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
|
__credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
|
||||||
__license__ = "GNU General Public License v3.0"
|
__license__ = "GNU General Public License v3.0"
|
||||||
__version__ = "2.6.8"
|
__version__ = "2.6.9"
|
||||||
__maintainer__ = "Davide Testa"
|
__maintainer__ = "Davide Testa"
|
||||||
__contact__ = "t.me/davte"
|
__contact__ = "t.me/davte"
|
||||||
|
|
||||||
|
@ -5,7 +5,8 @@ from .bot import Bot
|
|||||||
from .messages import default_help_messages
|
from .messages import default_help_messages
|
||||||
from .utilities import (
|
from .utilities import (
|
||||||
get_cleaned_text, make_inline_keyboard,
|
get_cleaned_text, make_inline_keyboard,
|
||||||
make_lines_of_buttons, make_button
|
make_lines_of_buttons, make_button,
|
||||||
|
recursive_dictionary_update
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -245,10 +246,15 @@ async def _start_command(bot, update, user_record):
|
|||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
def init(telegram_bot, help_messages=None):
|
def init(telegram_bot: Bot, help_messages: dict = None):
|
||||||
"""Assign parsers, commands, buttons and queries to given `bot`."""
|
"""Assign parsers, commands, buttons and queries to given `bot`."""
|
||||||
if help_messages is None:
|
if help_messages is None:
|
||||||
help_messages = default_help_messages
|
help_messages = default_help_messages
|
||||||
|
else:
|
||||||
|
help_messages = recursive_dictionary_update(
|
||||||
|
default_help_messages.copy(),
|
||||||
|
help_messages.copy()
|
||||||
|
)
|
||||||
telegram_bot.messages['help'] = help_messages
|
telegram_bot.messages['help'] = help_messages
|
||||||
|
|
||||||
@telegram_bot.command("/start", authorization_level='everybody')
|
@telegram_bot.command("/start", authorization_level='everybody')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user