MoBot is a modular bot framework for Discord. It allows developers to create, extend, and manage custom modules that hook into the bot to add rich, interactive features.
📋 Table of Contents
To create a module for MoBot, follow these steps:
- Create a Java Project (Maven/Gradle):
-
Maven: Add the MoBot dependency in
pom.xml
:<dependency> <groupId>net.vitacraft</groupId> <artifactId>MoBot</artifactId> <version>VERSION</version> <!-- Replace VERSION --> </dependency>
-
Gradle: Add the dependency in
build.gradle
:dependencies { implementation "net.vitacraft:MoBot:VERSION" // Replace VERSION }
Find the latest version here.
-
Create Main Module Class: Extend the
MBModule
class:public class WelcomeModule extends MBModule { @Override public void onEnable() { getLogger().info("WelcomeModule enabled!"); } @Override public void onDisable() { getLogger().info("WelcomeModule disabled!"); } }
-
Create Service File: Create
resources/META-INF/services/net.vitacraft.api.MBModule
, and to this file add one line to it: the fully qualified name of your main module class, for example:com.example.WelcomeModule
-
Install MoBot by adding it as a dependency in your Maven or Gradle project (see the Setup Project section).
-
Create
bot.yml
file inside theresources
folder to configure your bot:name: WelcomeModule version: '1.0.0' description: A Test Module dependencies: [] authors: [Your Name] priority: DEFAULT
-
Extend
MBModule
: In your Java class, overrideonEnable()
andonDisable()
:public class WelcomeModule extends MBModule { @Override public void onEnable() { getLogger().info("Module enabled!"); } @Override public void onDisable() { getLogger().info("Module disabled!"); } }