26 lines
780 B
Java
26 lines
780 B
Java
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());
|
|
}
|
|
|
|
}
|