Triggers

class sopel.trigger.Trigger

A line from the server, which has matched a callable’s rules.

Note that CTCP messages (PRIVMSG`es and `NOTICE`es which start and end with `’x01’) will have the ‘x01’ bytes stripped, and the command (e.g. ACTION) placed mapped to the ‘intent’ key in Trigger.tags.

property account

The account name of the user sending the message.

This is only available if either the account-tag or the account-notify and extended-join capabilites are available. If this isn’t the case, or the user sending the message isn’t logged in, this will be None.

property admin

True if the nick which triggered the command is one of the bot’s admins.

property args

A tuple containing each of the arguments to an event. These are the strings passed between the event name and the colon. For example, setting mode -m on the channel #example, args would be ('#example', '-m')

property event

The IRC event (e.g. PRIVMSG or MODE) which triggered the message.

property group

The group function of the match attribute.

See Python re documentation for details.

property groupdict

The groupdict function of the match attribute.

See Python re documentation for details.

property groups

The groups function of the match attribute.

See Python re documentation for details.

property host

The hostname of the person who sent the message

property hostmask

Hostmask of the person who sent the message as <nick>!<user>@<host>

property is_privmsg

True if the trigger is from a user, False if it’s from a channel.

property match

The regular expression re.MatchObject for the triggering line.

property nick

The sopel.tools.Identifier of the person who sent the message.

property owner

True if the nick which triggered the command is the bot’s owner.

property raw

The entire message, as sent from the server. This includes the CTCP x01 bytes and command, if they were included.

property sender

The channel from which the message was sent.

In a private message, this is the nick that sent the message.

property tags

A map of the IRCv3 message tags on the message.

property time

A datetime object at which the message was received by the IRC server.

If the server does not support server-time, then time will be the time that the message was received by Sopel

property user

Local username of the person who sent the message