From 10f0823efc9bab0332317f82192e034297b8217d Mon Sep 17 00:00:00 2001 From: Hammy Date: Sun, 19 Sep 2021 04:14:05 +0100 Subject: [PATCH] Add OnReadyListener.java --- src/main/java/me/goudham/config/BotConfig.java | 2 ++ .../me/goudham/listener/OnReadyListener.java | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 src/main/java/me/goudham/listener/OnReadyListener.java diff --git a/src/main/java/me/goudham/config/BotConfig.java b/src/main/java/me/goudham/config/BotConfig.java index 71ec6d2d..c8169062 100644 --- a/src/main/java/me/goudham/config/BotConfig.java +++ b/src/main/java/me/goudham/config/BotConfig.java @@ -8,6 +8,7 @@ import jakarta.inject.Inject; import jakarta.inject.Singleton; import java.util.List; import javax.security.auth.login.LoginException; +import me.goudham.listener.OnReadyListener; import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.JDABuilder; import net.dv8tion.jda.api.entities.Activity; @@ -46,6 +47,7 @@ public class BotConfig { return JDABuilder .createDefault(token) .setActivity(Activity.playing("With Hamothy")) + .addEventListeners(new OnReadyListener()) .enableIntents( List.of( GatewayIntent.GUILD_MEMBERS, diff --git a/src/main/java/me/goudham/listener/OnReadyListener.java b/src/main/java/me/goudham/listener/OnReadyListener.java new file mode 100644 index 00000000..7292fc57 --- /dev/null +++ b/src/main/java/me/goudham/listener/OnReadyListener.java @@ -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!"); + } +}