Skip to content

Channel Link handler class

This class is named DBChannelLink and is stored at classes/db_channel_link_handler.py.

When initiated a connection to the endurabot.db database is made and, if the table does not already exist, the channel_link table is created.

check_status()

This method accepts the following arguments:

  • id: Any valid channel ID, voice or text.

This method checks to see if the given id is anywhere in columns text_channel_id or voice_channel_id.

If it is in either column, it returns the bool value True. If not, it returns False.

This method accepts the following arguments:

  • text_id: A valid text channel ID.
  • voice_id: A valid voice channel ID.

This links 2 channels by placing them together in the same table row.

This method accepts the following arguments:

  • id: An autoincrementing ID for any row in table channel_link.

This methods deletes a given row by autoincrementing ID, deleting the link between the 2 channels.

get_text_id()

This method accepts the following arguments:

  • voice_id: A valid voice channel ID.

This method returns the linked text_channel_id associated with the provided voice_id.

This method accepts no arguments.

This method returns a list of tuples containing the autoincrementing ID, voice_channel_id, and text_channel_id for every row in table channel_link.

This method accepts the following arguments:

  • id: An autoincrementing ID for any row in table channel_link.

This method returns a tuple containing the voice_channel_id and text_channel_id of the row that has the provided autoincrementing ID. If no link is found for the ID, a ValueError is raised.