Catchall¶
The catchall
matcher is a special case which is called only when no other skills were matched.
This matcher catches everything - messages and events, if you want to catch only messages you can set the flag messages_only
to True
.
It is useful for displaying a help message to the user to show available commands that the bot replies to, for example:
- opsdroid.matchers.match_catchall(func=None, messages_only=False)¶
Return catch-all match decorator.
Decorator that runs the function only if no other skills were matched for a message
- Parameters
messages_only (bool) – Whether to match only on messages, or on all events. Defaults to False.
- Returns
Decorated Function
Example¶
from opsdroid.skill import Skill
from opsdroid.matchers import match_catchall
class HelpMessageSkill(Skill):
@match_catchall
async def help_handler(self, message):
# Called when no other skills were matched