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.

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.

admin

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

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

event

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

group

The group function of the match attribute.

See Python re documentation for details.

groupdict

The groupdict function of the match attribute.

See Python re documentation for details.

groups

The groups function of the match attribute.

See Python re documentation for details.

host

The hostname of the person who sent the message

hostmask

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

is_privmsg

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

match

The regular expression re.MatchObject for the triggering line.

nick

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

owner

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

raw

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

sender

The channel from which the message was sent.

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

tags

A map of the IRCv3 message tags on the message.

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

user

Local username of the person who sent the message