Handlers

Functions to handle specific events and commands

wsirc.handlers.COMMANDS

A dictionary of command-word and function pairs

wsirc.handlers.check_owner(wsirc, msg)

Check if the message sender is the owner of the current channel.

Parameters:
  • wsirc – The WS_IRC object connected to a channel.
  • msg – The message to check the owner of.
Returns:

True if the sender of the message is the owner of the channel.

wsirc.handlers.compare_url(a, b)

Compare two urls to see if they’re from the same domain(ish).

Parameters:
  • a – A string containing a URL.
  • b – A string containing a URL.
Returns:

True if the URL domains are similar enough.

wsirc.handlers.compose_url(groups)

Converts a tuple of groups from a Message.link object into a possibly valid URL.

Parameters:groups – The tuple from the links member in a Message object.
Returns:A string that is possibly a valid URL.
wsirc.handlers.permissions(mod=False, sub=False)

Decorator to restrict the use of a command.

Channel owners are always allowed to use a command.

Parameters:
  • mod – Whether or not to allow mods to use the command
  • sub – Whether or not to allow subscribers to use the command
Returns:

A function that only runs only if the message sender meets specific requirements.