test bot
parent
e0e42f92d2
commit
91fe6cc9da
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue