1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00
This commit is contained in:
Steffo 2017-04-26 09:01:37 +02:00
parent 7024d442d0
commit 5399c81e55

View file

@ -34,7 +34,7 @@ async def status_typing(bot, thing):
raise TypeError("thing must be either a telegram.Update or a discord.Message") raise TypeError("thing must be either a telegram.Update or a discord.Message")
async def display_help(bot, thing, func: function): async def display_help(bot, thing, func):
"""Display the help command of a function""" """Display the help command of a function"""
# Telegram bot commands start with / # Telegram bot commands start with /
if isinstance(thing, telegram.Update): if isinstance(thing, telegram.Update):
@ -108,23 +108,23 @@ Sintassi: {symbol}leggi <numero>"""
async def helpme(bot, thing, arguments): async def helpme(bot, thing, arguments):
"""Visualizza il messaggio di aiuto di un comando. """Visualizza il messaggio di aiuto di un comando.
Sintassi: `/helpme [comando]`""" Sintassi: `{symbol}helpme [comando]`"""
# Set status to typing # Set status to typing
await status_typing(bot, thing) await status_typing(bot, thing)
# If no command is specified, show the help message for this command. # If no command is specified, show the help message for this command.
if len(arguments) == 0 or len(arguments) > 1: if len(arguments) == 0 or len(arguments) > 1:
await answer(bot, thing, helpme.__doc__) await display_help(bot, thing, helpme)
return return
# Check the list of telegram commands if the message was sent from Telegram # Check the list of telegram commands if the message was sent from Telegram
if isinstance(thing, telegram.Update): if isinstance(thing, telegram.Update):
if arguments[0] in b.commands: if arguments[0] in b.commands:
await answer(bot, thing, b.commands[arguments[0]].__doc__) await display_help(bot, thing, b.commands[arguments[0]])
else: else:
await answer(bot, thing, "⚠ Il comando specificato non esiste.") await answer(bot, thing, "⚠ Il comando specificato non esiste.")
# Check the list of discord commands if the message was sent from Discord # Check the list of discord commands if the message was sent from Discord
if isinstance(thing, extradiscord.discord.Message): if isinstance(thing, extradiscord.discord.Message):
if arguments[0] in d.commands: if arguments[0] in d.commands:
await answer(bot, thing, d.commands[arguments[0]].__doc__) await display_help(bot, thing, d.commands[arguments[0]])
else: else:
await answer(bot, thing, "⚠ Il comando specificato non esiste.") await answer(bot, thing, "⚠ Il comando specificato non esiste.")