Skip to content

Handling Events

Handling events in Phillip is very, very easy. What is required is to inherit base Handler class and override the functions you want to.


phillip.handlers.Handler

Handler base for Phillip

on_group_added(self, user) async

Function to be called when someone gets added to a group.

Source code in phillip\handlers.py
async def on_group_added(self, user: GroupUser):
    """Function to be called when someone gets added to a group.
    """
    pass

on_group_alumni(self, user) async

Function to be called when someone gets added/removed to/from Alumni.

Source code in phillip\handlers.py
async def on_group_alumni(self, user: GroupUser):
    """Function to be called when someone gets added/removed to/from Alumni.
    """
    pass

on_group_bng(self, user) async

Function to be called when someone gets added/removed to/from BNG.

Source code in phillip\handlers.py
async def on_group_bng(self, user: GroupUser):
    """Function to be called when someone gets added/removed to/from  BNG.
    """
    pass

on_group_gmt(self, user) async

Function to be called when someone gets added/removed to/from GMT.

Source code in phillip\handlers.py
async def on_group_gmt(self, user: GroupUser):
    """Function to be called when someone gets added/removed to/from GMT.
    """
    pass

on_group_nat(self, user) async

Function to be called when someone gets added/removed to/from NAT.

Source code in phillip\handlers.py
async def on_group_nat(self, user: GroupUser):
    """Function to be called when someone gets added/removed to/from NAT.
    """
    pass

on_group_probation(self, user) async

Function to be called when someone gets added/removed to/from the probation.

Source code in phillip\handlers.py
async def on_group_probation(self, user: GroupUser):
    """Function to be called when someone gets added/removed to/from the probation.
    """

on_group_removed(self, user) async

Function to be called when someone gets removed from a group.

Source code in phillip\handlers.py
async def on_group_removed(self, user: GroupUser):
    """Function to be called when someone gets removed from a group.
    """
    pass

on_map_bubbled(self, event) async

Function to be called when a beatmap is bubbled.

Source code in phillip\handlers.py
async def on_map_bubbled(self, event: "EventBase"):
    """Function to be called when a beatmap is bubbled.
    """
    pass

on_map_disqualified(self, event) async

Function to be called when a beatmap is disqualified.

Source code in phillip\handlers.py
async def on_map_disqualified(self, event: "EventBase"):
    """Function to be called when a beatmap is disqualified.
    """
    pass

on_map_event(self, event) async

Function to be called when any beatmap event happens.

Source code in phillip\handlers.py
async def on_map_event(self, event: "EventBase"):
    """Function to be called when any beatmap event happens.
    """
    pass

on_map_loved(self, event) async

Function to be called when a beatmap is loved.

Source code in phillip\handlers.py
async def on_map_loved(self, event: "EventBase"):
    """Function to be called when a beatmap is loved.
    """
    pass

on_map_popped(self, event) async

Function to be called when a beatmap is popped.

Source code in phillip\handlers.py
async def on_map_popped(self, event: "EventBase"):
    """Function to be called when a beatmap is popped.
    """
    pass

on_map_qualified(self, event) async

Function to be called when a beatmap is qualified.

Source code in phillip\handlers.py
async def on_map_qualified(self, event: "EventBase"):
    """Function to be called when a beatmap is qualified.
    """
    pass

on_map_ranked(self, event) async

Function to be called when a beatmap is ranked.

Source code in phillip\handlers.py
async def on_map_ranked(self, event: "EventBase"):
    """Function to be called when a beatmap is ranked.
    """
    pass

register_emitter(self, emitter)

Registers an emitter to the handler

Parameters:

  • emitter - pyee.AsyncIOEventEmitter -- Emitter to register.
Source code in phillip\handlers.py
def register_emitter(self, emitter: AsyncIOEventEmitter):
    """Registers an emitter to the handler

    **Parameters:**

    * emitter - `pyee.AsyncIOEventEmitter` -- Emitter to register.
    """
    self.emitter = emitter
    self._register_events()

All of the functions started with on_ are event handlers. You only need to override to work with them. All of the event registration are all happens in the background--so don't sweat it.

All map events will give you EventBase argument, while all user events will give you GroupUser argument.


Discord

A discord handler is already provided as an example. You may use it by setting webhook_url to Phillip's constructor.