Rename Enso to EnsoBot

java-rewrite
Hammy 3 years ago
parent e78f080e18
commit 64610061c0

@ -1,13 +1,13 @@
package me.goudham;
import io.micronaut.context.ApplicationContext;
import me.goudham.bot.Enso;
import me.goudham.bot.EnsoBot;
public class Application {
public static void main(String[] args) {
public static void main(String[] args) throws InterruptedException {
ApplicationContext applicationContext = ApplicationContext.run();
Enso enso = applicationContext.getBean(Enso.class);
enso.startup();
EnsoBot ensoBot = applicationContext.getBean(EnsoBot.class);
ensoBot.startup();
// GuildsRepository bean = run.getBean(GuildsRepository.class);
// bean.saveOnConflictDoNothing(new Guilds(1234L, "to", null, 1));

@ -1,5 +1,5 @@
package me.goudham.bot;
public interface Bot {
void startup();
void startup() throws InterruptedException;
}

@ -7,20 +7,21 @@ import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.entities.Guild;
@Singleton
public class Enso implements Bot {
private final JDA bot;
public class EnsoBot implements Bot {
private final JDA jda;
private final Guild guild;
private final CommandManager commandManager;
@Inject
public Enso(JDA bot, Guild guild, CommandManager commandManager) {
this.bot = bot;
public EnsoBot(JDA jda, Guild guild, CommandManager commandManager) {
this.jda = jda;
this.guild = guild;
this.commandManager = commandManager;
}
@Override
public void startup() {
public void startup() throws InterruptedException {
jda.awaitReady();
commandManager.registerSlashCommands(guild);
}
}

@ -28,7 +28,7 @@ public class BotConfig {
}
@Singleton
public Guild guild(JDA jda) {
public Guild ownerGuild(JDA jda) {
Guild ownerGuild = jda.getGuildById(guildId);
if (ownerGuild == null) {
throw new RuntimeException("Owner Guild Not Found");
@ -37,7 +37,7 @@ public class BotConfig {
}
@Singleton
public JDA jda() throws LoginException, InterruptedException {
public JDA jda() throws LoginException {
return JDABuilder
.createDefault(token)
.setActivity(Activity.playing("With Hamothy"))
@ -52,7 +52,6 @@ public class BotConfig {
GatewayIntent.GUILD_MESSAGE_REACTIONS
)
).enableCache(CacheFlag.VOICE_STATE)
.build()
.awaitReady();
.build();
}
}

Loading…
Cancel
Save