Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main {
- public static void main(String[] args) throws LoginException, InterruptedException {
- // Bot token
- final String token = "DISCORD_TOKEN";
- JDA jda = JDABuilder.createDefault(token)
- .setStatus(OnlineStatus.ONLINE)
- // Event Listeners
- .addEventListeners(
- new HelloWorld()
- )
- .enableCache(CacheFlag.VOICE_STATE)
- .enableIntents(GatewayIntent.MESSAGE_CONTENT, GatewayIntent.GUILD_MEMBERS)
- .setMemberCachePolicy(MemberCachePolicy.ALL)
- .build()
- .awaitReady();
- }
- }
- // Triggers for EVERY message sent
- public class HelloWorld extends ListenerAdapter {
- @Override
- public void onMessageReceived(@NotNull MessageReceivedEvent event) {
- event.getMessage().reply("Hello, world!").queue();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment