Regular Expression Parser

This is the simplest parser available in opsdroid. It matches the message from the user against a regular expression. If the regex matches the function is called.


from opsdroid.skills import match_regex

async def hello(opsdroid, message):
    await message.respond('Hey')

The above skill would be called on any message which matches the regex 'hi'.

Message object additional parameters


A re match object for the regular expression the message was matched against. This allows you to access any wildcard matches in the regex from within your skill.

from opsdroid.skills import match_regex

@match_regex(r'remember (.*)')
async def remember(opsdroid, message):
    remember =
    await opsdroid.memory.put("remember", remember)
    await message.respond("OK I'll remember that")