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.

… py:function:: match_event(event_type, **kwargs)

module:

opsdroid.matchers

Return event type matcher.

Decorator that calls skill based on passed event_type.

type event_type:
param event_type:

opsdroidstarted, message, typing, reaction, file, image

type event_type:

str

type **kwargs:
param **kwargs:

arbitrary kwargs to be added to the event matcher

type **kwargs:

dict

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"))