From 91fe6cc9dad1572b065ce425be49895d76e701d2 Mon Sep 17 00:00:00 2001 From: BodgeMaster <> Date: Sat, 19 Feb 2022 20:35:57 +0100 Subject: [PATCH] test bot --- .../java/linux/general/hackyquizbot/Main.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/main/java/linux/general/hackyquizbot/Main.java diff --git a/src/main/java/linux/general/hackyquizbot/Main.java b/src/main/java/linux/general/hackyquizbot/Main.java new file mode 100644 index 0000000..0b2eeab --- /dev/null +++ b/src/main/java/linux/general/hackyquizbot/Main.java @@ -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()); + } + +}