Event

The event matcher matches all events of a certain type. It can, for example, be used to write a skill that responds to images or files.

opsdroid.matchers.match_event(event_type, **kwargs)

Return event type matcher.

Decorator that calls skill based on passed event_type.

Parameters
  • event_type (str) – opsdroidstarted, message, typing, reaction, file, image

  • **kwargs (dict) – arbitrary kwargs to be added to the event matcher

Returns

Decorated function

Example

from opsdroid.skill import Skill
from opsdroid.matchers import match_event
from opsdroid.events import Image, Message

class ShoutyImagesSkill(Skill):
    @match_event(Image)
    async def loudimage(event):
        await event.respond(Message("THAT'S A PRETTY PICTURE"))