/stop command implemented
This commit is contained in:
parent
ab63f56276
commit
191a2d2ecb
@ -14,7 +14,7 @@ __author__ = "Davide Testa"
|
||||
__email__ = "davide@davte.it"
|
||||
__credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
|
||||
__license__ = "GNU General Public License v3.0"
|
||||
__version__ = "2.1.23"
|
||||
__version__ = "2.1.24"
|
||||
__maintainer__ = "Davide Testa"
|
||||
__contact__ = "t.me/davte"
|
||||
|
||||
|
@ -502,6 +502,12 @@ default_admin_messages = {
|
||||
'en': "<i>Restart was successful.</i>",
|
||||
'it': "<i>Restart avvenuto con successo.</i>"
|
||||
}
|
||||
},
|
||||
'stop_command': {
|
||||
'description': {
|
||||
'en': "Stop bots",
|
||||
'it': "Ferma i bot"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -531,6 +537,11 @@ async def _restart_command(bot, update, user_record):
|
||||
return
|
||||
|
||||
|
||||
async def _stop_command(bot, update, user_record):
|
||||
bot.__class__.stop(message='=== STOP ===', final_state=0)
|
||||
return
|
||||
|
||||
|
||||
def init(bot, talk_messages=None, admin_messages=None, language='en'):
|
||||
"""Assign parsers, commands, buttons and queries to given `bot`."""
|
||||
if talk_messages is None:
|
||||
@ -626,3 +637,14 @@ def init(bot, talk_messages=None, admin_messages=None, language='en'):
|
||||
ensure=True
|
||||
)
|
||||
return
|
||||
|
||||
stop_command_description = bot.get_message(
|
||||
'admin', 'stop_command', 'description',
|
||||
language=language
|
||||
)
|
||||
|
||||
@bot.command(command='/stop', aliases=[], show_in_keyboard=False,
|
||||
description=stop_command_description,
|
||||
authorization_level='admin')
|
||||
async def stop_command(bot, update, user_record):
|
||||
return await _stop_command(bot, update, user_record)
|
||||
|
Loading…
x
Reference in New Issue
Block a user