> ## Documentation Index
> Fetch the complete documentation index at: https://developer.avenvault.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AeroDesk Base API: Extend AeroDeskAddon

> Learn how to extend AeroDeskAddon to hook into the AeroDesk system, access bot config, and implement onEnable and onDisable lifecycle methods.

To hook into the AeroDesk system, your main class must extend `AeroDeskAddon`. This base class provides access to the bot API, configuration, and lifecycle hooks so you can build custom addons that integrate seamlessly with AeroDesk. The examples below show a minimal implementation and a more detailed implementation with error handling.

<CodeGroup>
  ```java Minimal Example theme={null}
  package com.example.myaddon;

  import com.avenvault.discord.api.AeroDeskAddon;

  public class MyCustomAddon extends AeroDeskAddon {

      @Override
      public void onEnable() {
          // Prints custom log messages prefixed with the addon's name
          getLogger().info("Addon enabled and hooked into AeroDesk!");
          
          // Fetches the entire BotConfig object
          getApi().getConfig(); 
          
          // A quick shortcut inside the addon to grab the config
          getLogger().info("Current bot prefix is: " + getConfig().prefix);
      }
  }
  ```

  ```java Full Example with Error Handling theme={null}
  package com.example.myaddon;

  import com.avenvault.discord.api.AeroDeskAddon;

  public class HelloWorldMain2 extends AeroDeskAddon {

      @Override
      public void onEnable() {
          System.out.println("=================================");
          System.out.println("👋 HELLO WORLD ADDON ENABLED! 👋");

          try {
              if (getApi() != null && getApi().getConfig() != null) {
                  String dbType = getApi().getConfig().database.activeDatabase;
                  // dbType returns what is selected e.g MySQL
                  System.out.println("The bot is currently using database: " + dbType);
              } else {
                  System.out.println("The bot API or config was not ready yet, but addon loaded!");
              }
          } catch (Exception e) {
              // This will print the exact reason if something goes wrong here
              System.err.println("Error reading config in HelloWorld2:");
              e.printStackTrace();
          }

          System.out.println("=================================");
      }

      @Override
      public void onDisable() {
          System.out.println("🛑 Hello World2 Addon Shutting Down!");
      }
  }
  ```
</CodeGroup>


## Related topics

- [AeroDesk Developer API](/index.md)
- [Get Started with the AeroDesk Developer API](/getting-started.md)
