> For the complete documentation index, see [llms.txt](https://discord-super-utils.gitbook.io/discord-super-utils/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://discord-super-utils.gitbook.io/discord-super-utils/managers/base.md).

# Base

## EventManager

#### **class discordSuperUtils.Base.EventManager()**

Initializer of [**`EventManager`**](/discord-super-utils/managers/base.md#eventmanager), represents an event manager that manages events for classes of discord-super-utils.

| [**Attributes**](/discord-super-utils/managers/base.md#attributes) | [**Methods**](/discord-super-utils/managers/base.md#methods) |
| ------------------------------------------------------------------ | ------------------------------------------------------------ |
| **`events`**                                                       | **`remove_event`**                                           |
|                                                                    | **`add_event`**                                              |
|                                                                    | **`event`**                                                  |
|                                                                    | **`call_event`**                                             |

### **Attributes**

* **`events` (dict)**
  * The events used by the [**EventManager**](/discord-super-utils/managers/base.md#eventmanager).

### Methods

* **`remove_event(func, name=None)`**\
  Removes an event from the event list.\
  \
  **Parameters**
  * **`func` (function)**
    * &#x20;Function to remove.
  * **`name` (str)**

    * &#x20;Name of event to remove, defaults to `None`&#x20;

* **`add_event(func, name=None)`**\
  Adds an event to the event list.\
  \
  **Parameters**

  * **`func` (function)**
    * &#x20;Function to add.
  * **`name` (str)**

    * &#x20;Name of event to add, defaults to `None`&#x20;

  **Raises**

  * **TypeError**

    * &#x20;Function passed is not coroutine.

* **`event(func, name=None)`**\
  Decorator, adds an event to the event list, use this to register events.\
  \
  **Parameters**

  * **`func` (function)**
    * &#x20;Function to register as an event. Must be async.
  * **`name` (str)**
    * &#x20;Name of event to register, defaults to `None`&#x20;

  **Raises**

  * **TypeError**
    * &#x20;Function passed is not coroutine.

* **`call_event(name, *args, **kwargs)`**\
  Calls the event **name** with the **arguments**.\
  This method is a coroutine.\
  \
  **Parameters**
  * **`name` (str)**
    * &#x20;Name of the event to call.
  * **`*args, **kwargs`**
    * &#x20;Arguments to call the event with.

## CogManager

#### **class discordSuperUtils.Base.CogManager()**

Initializer of [**`CogManager`**](/discord-super-utils/managers/base.md#cogmanager), represents a class which supports the user to create a cog.

| [**Attributes**](/discord-super-utils/managers/base.md#attributes-1) | [**Methods**](/discord-super-utils/managers/base.md#methods-1) |
| -------------------------------------------------------------------- | -------------------------------------------------------------- |
| **`Cog`**                                                            | **`event`**                                                    |

### **Attributes**

* **`Cog` (discordSuperUtils.Base.CogManager.Cog)**
  * Initializer of **`CogManager.Cog`**, represents a class which supports the user to create a cog.
  * This class must be inherited by the user's cog.
  * **`CogManager.Cog`** must be initialized after defining all the managers in the cog.

### Methods

* **`event(func, manager_type)`**\
  Adds an event and binds it to the manager\_type.\
  This method is static.\
  \
  **Parameters**
  * **`func` (function)**
    * &#x20;Function to add.
  * **`manager_type` (class)**
    * &#x20;Type of manager that should bind to the event.
    * Examples:
      * discordSuperUtils.RoleManager
      * discordSuperUtils.LevelingManager

## DatabaseChecker

#### **class discordSuperUtils.Base.**&#x44;atabaseChecke&#x72;**(**&#x74;ables\_column\_data, table\_identifier&#x73;**)**

Initializer of [**DatabaseChecker**](/discord-super-utils/managers/base.md#databasechecker), represents a class which ensures that a database is connected to a manager.

Inherits [**EventManager**](/discord-super-utils/managers/base.md#eventmanager).

| [**Attributes**](/discord-super-utils/managers/base.md#attributes-2) | [**Methods**](/discord-super-utils/managers/base.md#methods-2) | [Events](/discord-super-utils/managers/base.md#events) |
| -------------------------------------------------------------------- | -------------------------------------------------------------- | ------------------------------------------------------ |
| **`database`**                                                       | **`connect_to_database`**                                      | **`on_database_connect`**                              |
| **`tables`**                                                         |                                                                |                                                        |
| **`table_identifiers`**                                              |                                                                |                                                        |
| **`tables_column_data`**                                             |                                                                |                                                        |

### **Attributes**

* **`database` (**[**DatabaseManager**](/discord-super-utils/managers/database-manager.md#databasemanager)**)**

  * The database the [**DatabaseChecker**](/discord-super-utils/managers/base.md#databasechecker) will use.

* **`tables` (Dict\[str, str])**

  * The tables the checker will use.

* **`table_identifiers` (List\[str])**

  * The table names of the tables of [**DatabaseChecker**](/discord-super-utils/managers/base.md#databasechecker).

* **`tables_column_data` (List\[Dict\[str, str]])**
  * The column types of the tables that the [**DatabaseChecker**](/discord-super-utils/managers/base.md#databasechecker) will make.

### Methods

* **`connect_to_database(database, tables)`**\
  Connects to the database and tables specified.\
  \
  **Parameters**
  * **`database`(**[**DatabaseManager**](/discord-super-utils/managers/database-manager.md#databasemanager)**)**
    * &#x20;The database to connect to.
  * **`tables` (List\[str])**
    * &#x20;The tables the database will create.

### Events

* **`on_database_connect()`**

  This event is called when the database connects.
