milan
BodgeMaster 2022-02-19 20:35:57 +01:00
parent e0e42f92d2
commit 91fe6cc9da
1 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,25 @@
package linux.general.hackyquizbot;
import org.javacord.api.DiscordApi;
import org.javacord.api.DiscordApiBuilder;
public class Main {
public static void main(String[] args) {
// Insert your bot's token here
String token = args[0];
DiscordApi api = new DiscordApiBuilder().setToken(token).login().join();
// Add a listener which answers with "Pong!" if someone writes "!ping"
api.addMessageCreateListener(event -> {
if (event.getMessageContent().equalsIgnoreCase("!ping")) {
event.getChannel().sendMessage("Pong!");
}
});
// Print the invite url of your bot
System.out.println("You can invite the bot by using the following url: " + api.createBotInvite());
}
}