DiscordBot.mainJDA=event.getJDA();// refresh it? //no need, everything's getJDA() is the same jda basis but audioplayer's still using it; need to migrate to store in guildmusicmanager
//String[] words = event.getMessage().getContentDisplay().split(" ");
Stringperms=cmd.hasSubCommand()?null:MiscUtils.getMissingPerms(perm,cmd.getRequiredBotUserLevel(),event.getMember(),channel);//pass it to the subcommand handler to handle instead
if(cmd.isDisabled())perms="DISABLED";//override if disabled by code
if(perms==null||event.getAuthor().getId().equals(DiscordBot.OwnerID)){//owner overrides perms for convenience
+msg.getContentDisplay()+(r.getRemarks()==null?".":". ("+r.getRemarks()+")"));//logging has to be before sendMessage, or else if no permission it will just quit
eb.setDescription("[This image]("+origPic+")"+(origPic.equals(pic)?"":"([source]("+pic+"))")+" is a repost of [this message]("+m.getJumpUrl()+") by `"+m.getAuthor().getName()+"#"+m.getAuthor().getDiscriminator()+"` at **"+m.getTimeCreated().format(DateTimeFormatter.RFC_1123_DATE_TIME)+"**.\n");
eb.setThumbnail(origPic);
channel.sendMessage(eb.build()).queue();
continue;
}catch(NullPointerExceptione){//if the message is deleted
eb.appendDescription("Total members (cached): `"+DiscordBot.mainJDA.getUserCache().size()+(DiscordBot.mainJDA.getShardManager()==null?"":"/"+DiscordBot.mainJDA.getShardManager().getShards().stream().mapToLong(jda->jda.getUserCache().size()).sum())+"`\n");
eb.appendDescription("DM `"+DiscordBot.mainJDA.getUserById(DiscordBot.OwnerID).getAsTag()+"` if you have any questions!\n");
eb.appendDescription("To get a list of commands, do `"+prefix+"help`.");
DiscordBot.logger.trace("[EDIT] "+guildinfo+System.lineSeparator()+" "+msg+System.lineSeparator()+" Full edited msg: "+msg.getContentDisplay());
}
}
@Override
publicvoidonUserActivityStart(UserActivityStartEventevent){//store presence for checking osu pp
Activityosu=event.getNewActivity();
if(osu!=null&&osu.getName().equals("osu!")&&osu.isRich()//if need to include other games and details, just remove this if clause and change sGame below
long ms = Math.abs(timesent.until(timeReceived, ChronoUnit.MILLIS));
System.out.println("Time taken: " + ms + "ms");*/
try(Connectioncon=DiscordBot.db.getConnection()){//DONE do i need to close the statement?
PreparedStatements=con.prepareStatement("INSERT INTO users(id, game) VALUES ("+event.getUser().getId()+", ?) ON CONFLICT(id) DO UPDATE SET game = ? WHERE game <> ?;");//prevent blank updates
publicvoidonGuildVoiceLeave(GuildVoiceLeaveEventevent){// theoretically i dont need to check if lastMusicCmd has the entry or not, as it must have one to trigger this
ap.stopAndClearQueue(event.getGuild());//can double fire on normal end; shouldnt be too big of a problem
}
}
}
@Override
publicvoidonGuildVoiceMove(GuildVoiceMoveEventevent){// theoretically i dont need to check if lastMusicCmd has the entry or not, as it must have one to trigger this
"The bot has been moved to an empty channel, the player is now paused.\nThe queue will be cleared in 1 minute if there is no activity.")
.queue();
waitActivity(event.getGuild());
}else{//moved bot to channel with ppl
event.getGuild().getAudioManager().openAudioConnection(event.getChannelJoined());//seems to need explicit reconnect on bot move, it gets stuck on attempting to reconnect otherwise; probably would be fixed soon but hot patch for now