Add OnReadyListener.java

java-rewrite
Hammy 3 years ago
parent b2260637bc
commit 10f0823efc

@ -8,6 +8,7 @@ import jakarta.inject.Inject;
import jakarta.inject.Singleton; import jakarta.inject.Singleton;
import java.util.List; import java.util.List;
import javax.security.auth.login.LoginException; import javax.security.auth.login.LoginException;
import me.goudham.listener.OnReadyListener;
import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.JDABuilder; import net.dv8tion.jda.api.JDABuilder;
import net.dv8tion.jda.api.entities.Activity; import net.dv8tion.jda.api.entities.Activity;
@ -46,6 +47,7 @@ public class BotConfig {
return JDABuilder return JDABuilder
.createDefault(token) .createDefault(token)
.setActivity(Activity.playing("With Hamothy")) .setActivity(Activity.playing("With Hamothy"))
.addEventListeners(new OnReadyListener())
.enableIntents( .enableIntents(
List.of( List.of(
GatewayIntent.GUILD_MEMBERS, GatewayIntent.GUILD_MEMBERS,

@ -0,0 +1,18 @@
package me.goudham.listener;
import jakarta.inject.Singleton;
import net.dv8tion.jda.api.events.ReadyEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Singleton
public class OnReadyListener extends ListenerAdapter {
private static final Logger logger = LoggerFactory.getLogger(OnReadyListener.class);
@Override
public void onReady(@NotNull ReadyEvent event) {
logger.info("\uD835\uDCE4\uD835\uDD00\uD835\uDCE4 Senpaii. Ready!");
}
}
Loading…
Cancel
Save