more minor updates
This commit is contained in:
@@ -33,9 +33,9 @@ import com.jagrosh.jdautilities.commons.waiter.EventWaiter;
|
||||
import com.jagrosh.jmusicbot.audio.AudioHandler;
|
||||
import com.jagrosh.jmusicbot.gui.GUI;
|
||||
import com.jagrosh.jmusicbot.utils.FormatUtil;
|
||||
import com.jagrosh.jmusicbot.utils.Pair;
|
||||
import com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioSourceManager;
|
||||
import java.util.Objects;
|
||||
import javafx.util.Pair;
|
||||
import net.dv8tion.jda.core.JDA;
|
||||
import net.dv8tion.jda.core.Permission;
|
||||
import net.dv8tion.jda.core.entities.Game;
|
||||
@@ -47,7 +47,7 @@ import net.dv8tion.jda.core.entities.VoiceChannel;
|
||||
import net.dv8tion.jda.core.events.ReadyEvent;
|
||||
import net.dv8tion.jda.core.events.ShutdownEvent;
|
||||
import net.dv8tion.jda.core.events.guild.GuildJoinEvent;
|
||||
import net.dv8tion.jda.core.events.message.MessageDeleteEvent;
|
||||
import net.dv8tion.jda.core.events.message.guild.GuildMessageDeleteEvent;
|
||||
import net.dv8tion.jda.core.exceptions.PermissionException;
|
||||
import net.dv8tion.jda.core.hooks.ListenerAdapter;
|
||||
import org.json.JSONException;
|
||||
@@ -185,7 +185,7 @@ public class Bot extends ListenerAdapter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessageDelete(MessageDeleteEvent event) {
|
||||
public void onGuildMessageDelete(GuildMessageDeleteEvent event) {
|
||||
if(lastNP.containsKey(event.getGuild().getIdLong()))
|
||||
{
|
||||
Pair<Long,Long> pair = lastNP.get(event.getGuild().getIdLong());
|
||||
@@ -240,10 +240,12 @@ public class Bot extends ListenerAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
public void shutdown(){
|
||||
public void shutdown()
|
||||
{
|
||||
manager.shutdown();
|
||||
threadpool.shutdownNow();
|
||||
jda.getGuilds().stream().forEach(g -> {
|
||||
jda.getGuilds().stream().forEach(g ->
|
||||
{
|
||||
g.getAudioManager().closeAudioConnection();
|
||||
AudioHandler ah = (AudioHandler)g.getAudioManager().getSendingHandler();
|
||||
if(ah!=null)
|
||||
@@ -262,13 +264,15 @@ public class Bot extends ListenerAdapter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShutdown(ShutdownEvent event) {
|
||||
public void onShutdown(ShutdownEvent event)
|
||||
{
|
||||
if(gui!=null)
|
||||
gui.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReady(ReadyEvent event) {
|
||||
public void onReady(ReadyEvent event)
|
||||
{
|
||||
this.jda = event.getJDA();
|
||||
if(jda.getGuilds().isEmpty())
|
||||
{
|
||||
@@ -277,7 +281,8 @@ public class Bot extends ListenerAdapter {
|
||||
log.warn(event.getJDA().asBot().getInviteUrl(JMusicBot.RECOMMENDED_PERMS));
|
||||
}
|
||||
credit(event.getJDA());
|
||||
jda.getGuilds().forEach((guild) -> {
|
||||
jda.getGuilds().forEach((guild) ->
|
||||
{
|
||||
try
|
||||
{
|
||||
String defpl = getSettings(guild).getDefaultPlaylist();
|
||||
@@ -293,7 +298,8 @@ public class Bot extends ListenerAdapter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGuildJoin(GuildJoinEvent event) {
|
||||
public void onGuildJoin(GuildJoinEvent event)
|
||||
{
|
||||
credit(event.getJDA());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user