Events/exchange_roles

From Werewolf Wiki
Jump to navigation Jump to search

The exchange_roles event is called whenever someone swaps roles (usually due to an exchange totem).

Event callback

def on_exchange_roles(event: Event, cli: IRCClient, var: module, actor: str, nick: str, actor_role: str, nick_role: str) -> None
  • prevent_default has no effect for this event
  • event: The event object
  • cli: The IRC connection
  • var: Reference to the src.settings module
  • actor: Person that triggered the exchange
  • nick: Person that is being exchanged with
  • actor_role: actor's role
  • nick_role: nick's role

Event data

{
    "actor_messages": list(str),
    "nick_messages": list(str)
}

The actor_messages and nick_messages data keys are initialized to an empty list. Adding strings to this will cause those strings to be sent to the actor or nick respectively after they are informed that their role has been swapped. It is preferable to make use of these lists as opposed to directly calling pm yourself, as the event is run before the players are informed that their roles have swapped.