Creating an extension for RelyBot

Creating an extension for RelyBot

Creating an extension for RelyBot

Noah M.
Last Updated:

This article will guide you through the process of customizing and adding extensions to your bot. Extensions provide additional functionality and can be tailored to suit your specific requirements. By following these steps, you'll be able to download an extension template, make modifications, build the extension, and integrate it into your bot project.

Step 1: Download Visual Studio

If you do not have Visual Studio installed, visit the official website and download the appropriate version for your operating system. Follow the installation instructions to set up Visual Studio on your machine.

Step 2: Download the Extension Template

Download the extension template that will serve as the foundation for your extension. You can find the template attached at the bottom of this page. Download the extension that best matches your requirements.

Step 3: Open the Extension Template Solution

Launch Visual Studio and open the ExtensionTemplate.sln file that was included in the downloaded template. This will open the solution in Visual Studio, allowing you to modify and build your extension.

Step 4: Rename the Project

To personalize your extension, right-click on the project name in the Solution Explorer and select the "Rename" option. Alternatively, you can click on the project name and press the F2 key on your keyboard. Rename the project to reflect the purpose of your extension. For example, if your extension is for an Auto-Moderation feature, you can rename it to AutoModExtension.

Step 5: Customize the Extension Name

Locate the ExtensionName.cs file within your project. This file represents your extension's main code. Rename this file to match the name you want for your extension. For instance, change it to AutoModExtension.cs if you have chosen "AutoMod" as your extension name.

Step 6: Update the Namespace

In the main code file (AutoModExtension.cs or your chosen name), modify the "namespace" declaration to match your desired namespace. Replace RelyBot.ExtensionLib.YOUREXTENSIONNAME with your own namespace, such as RelyBot.ExtensionLib.AutoMod.

Step 7: Modify the Class Name

Within the main code file, change the "class name" from ExtensionNameExtension to your preferred class name. For example, if your extension is named "AutoMod", rename the class to AutoModExtension.

Step 8: Customize the Code

Utilize the Discord client's capabilities within your extension's code. Implement the desired functionality and make any necessary modifications to the provided code to meet your specific requirements.

Step 9: Build the Solution

When you have finished coding your extension, right-click on "Solution 'ExtensionTemplate'" in the Solution Explorer and select "Build Solution." This will compile your extension and ensure that it is ready for integration.

Step 10: Move the Extension File

Once the build process is complete, navigate to the template folder you downloaded. Locate the "ExtensionTemplate" -> "bin" -> "Release" -> "net6.0" directory. Move the generated "YOUREXTENSIONNAMEExtension.dll" file (e.g., AutoModExtension.dll) to the "extensions" folder in your Discord bot.

Step 11: Restart and Enjoy

Restart your Discord bot to apply the changes. Your newly created extension, such as the Auto-Moderation feature, will now be active and ready to enhance your bot's capabilities. Enjoy exploring and utilizing the added functionality!


Was this article helpful?