Fallback function to register

This commit is contained in:
klemek
2020-11-06 18:44:25 +01:00
parent 33eb60474a
commit 5ed605ab7b
2 changed files with 16 additions and 0 deletions
+4
View File
@@ -14,6 +14,9 @@ import discord
async def hello(client: discord.client, message: discord.Message, *args: str):
await message.channel.send("Hello!")
async def mention(client: discord.client, message: discord.Message, *args: str):
await message.channel.send(f"Did you mention me {message.author.mention}?")
bot = Bot(
"test-app", # name
@@ -29,6 +32,7 @@ bot.register_command(
f"\tSays 'Hello!'.\n"
f"```"
)
bot.register_fallback(mention) # the bot was mentioned or the alias was used
bot.start()
# this bot respond to "|help", "|info" and "|hello"
```