Add basic ping response
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -3,6 +3,8 @@ package wtf.beatrice.hidekobot;
|
||||
import net.dv8tion.jda.api.JDA;
|
||||
import net.dv8tion.jda.api.JDABuilder;
|
||||
import net.dv8tion.jda.api.entities.Activity;
|
||||
import net.dv8tion.jda.api.requests.GatewayIntent;
|
||||
import wtf.beatrice.hidekobot.listeners.MessageListener;
|
||||
import wtf.beatrice.hidekobot.utils.Logger;
|
||||
|
||||
import javax.security.auth.login.LoginException;
|
||||
@@ -38,8 +40,13 @@ public class HidekoBot
|
||||
// try to create the bot object and authenticate it with discord.
|
||||
jdaBuilder = JDABuilder.createDefault(botToken);
|
||||
jdaBuilder.setActivity(Activity.playing("the piano"));
|
||||
jda = jdaBuilder.build();
|
||||
} catch (LoginException e)
|
||||
|
||||
jdaBuilder.enableIntents(GatewayIntent.MESSAGE_CONTENT,
|
||||
GatewayIntent.DIRECT_MESSAGES,
|
||||
GatewayIntent.GUILD_MESSAGES);
|
||||
|
||||
jda = jdaBuilder.build().awaitReady();
|
||||
} catch (LoginException | InterruptedException e)
|
||||
{
|
||||
logger.log(e.getMessage()); // print the error message, omit the stack trace.
|
||||
return; // if we failed connecting and authenticating, then quit.
|
||||
@@ -55,6 +62,10 @@ public class HidekoBot
|
||||
// log the invite-link to console so noob users can just click on it.
|
||||
logger.log("Bot User ID: " + botUserId, 4);
|
||||
logger.log("Invite Link: " + standardInviteLink, 5);
|
||||
|
||||
// register listeners
|
||||
jda.addEventListener(new MessageListener());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user