You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
overlisted 9db858f001 a fix of a fix 3 years ago
.idea some idea configurations 3 years ago
gradle/wrapper init 3 years ago
src/main/java/net/overlisted/botlib a fix of a fix 3 years ago
.gitignore gitignore 3 years ago
README.md Update README.md 3 years ago
build.gradle again i forgot to change the version in build.gradle 3 years ago
gradlew init 3 years ago
gradlew.bat init 3 years ago
settings.gradle init 3 years ago

README.md

botlib

Start by adding a class with commands:

package net.overlisted.mybot;

import net.overlisted.botlib.command.CommandTrigger;
import net.overlisted.botlib.command.CommandsController;

@CommandsController(
  token = "USE YOUR TOKEN",
  commandsGroup = "mybot"
)
public class MyBotCommands {
  @CommandTrigger
  public String test(Message message, String text) {
    return text;
  }
}

To initialize BotLib create a new instance of it:

package net.overlisted.mybot;

import net.overlisted.botlib.BotLib;

public class StaticRunner {
  public static void main(String... args) {
    new BotLib("net.overlisted.mybot");
  }
}

Then add your bot to a Discord server and send "/mybot test anyText", bot will answer "anyText".

You can add unlimited amount of arguments (you will have to separate them with space to use the command) to commands, for example:

@CommandTrigger
public void test(Message message, String text, String moreText, String text2) {
  message.getChannel().sendMessage(text).append(' ').append(moreText).append(' ').append(text2).submit();
}

Ad-Hoc also works for commands.