Make bot token a startup argument
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:
parent
d75aa7ad19
commit
58963d2653
@ -10,21 +10,31 @@ import javax.security.auth.login.LoginException;
|
||||
public class HidekoBot
|
||||
{
|
||||
private static Logger logger = new Logger(HidekoBot.class);
|
||||
private static String botToken;
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
|
||||
// check if bot token was specified as a startup argument
|
||||
if(args.length < 1)
|
||||
{
|
||||
logger.log("Please specify your bot token!");
|
||||
return;
|
||||
}
|
||||
|
||||
botToken = args[0];
|
||||
|
||||
JDABuilder jdaBuilder;
|
||||
JDA jda;
|
||||
|
||||
try
|
||||
{
|
||||
jdaBuilder = JDABuilder.createDefault("");
|
||||
jdaBuilder = JDABuilder.createDefault(botToken);
|
||||
jdaBuilder.setActivity(Activity.playing("the piano"));
|
||||
jda = jdaBuilder.build();
|
||||
} catch (LoginException e)
|
||||
{
|
||||
logger.log(e.getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user