diff --git a/build.gradle b/build.gradle index a3eab58..125d2aa 100644 --- a/build.gradle +++ b/build.gradle @@ -57,7 +57,7 @@ dependencies { compile("com.sedmelluq:lavaplayer:1.3.21") - compile 'net.dv8tion:JDA:3.8.3_463' + compile 'net.dv8tion:JDA:4.0.0_46' compile group: 'org.json', name: 'json', version: '20160810' compile 'org.springframework.security:spring-security-web:5.0.1.RELEASE' // JPA Data (We are going to use Repositories, Entities, Hibernate, etc...) diff --git a/src/main/java/net/Broken/BotListener.java b/src/main/java/net/Broken/BotListener.java index 7d1b3d4..5c68d45 100644 --- a/src/main/java/net/Broken/BotListener.java +++ b/src/main/java/net/Broken/BotListener.java @@ -12,17 +12,17 @@ import net.Broken.Tools.Moderateur; import net.Broken.Tools.PrivateMessage; import net.Broken.Tools.UserManager.Stats.UserStatsUtils; import net.Broken.audio.AudioM; -import net.dv8tion.jda.core.EmbedBuilder; -import net.dv8tion.jda.core.entities.*; -import net.dv8tion.jda.core.events.ReadyEvent; -import net.dv8tion.jda.core.events.guild.GuildJoinEvent; -import net.dv8tion.jda.core.events.guild.member.GuildMemberJoinEvent; -import net.dv8tion.jda.core.events.guild.member.GuildMemberRoleRemoveEvent; -import net.dv8tion.jda.core.events.guild.voice.GuildVoiceJoinEvent; -import net.dv8tion.jda.core.events.guild.voice.GuildVoiceLeaveEvent; -import net.dv8tion.jda.core.events.message.MessageReceivedEvent; -import net.dv8tion.jda.core.hooks.ListenerAdapter; -import net.dv8tion.jda.core.managers.GuildManager; +import net.dv8tion.jda.api.EmbedBuilder; +import net.dv8tion.jda.api.entities.*; +import net.dv8tion.jda.api.events.ReadyEvent; +import net.dv8tion.jda.api.events.guild.GuildJoinEvent; +import net.dv8tion.jda.api.events.guild.member.GuildMemberJoinEvent; +import net.dv8tion.jda.api.events.guild.member.GuildMemberRoleRemoveEvent; +import net.dv8tion.jda.api.events.guild.voice.GuildVoiceJoinEvent; +import net.dv8tion.jda.api.events.guild.voice.GuildVoiceLeaveEvent; +import net.dv8tion.jda.api.events.message.MessageReceivedEvent; +import net.dv8tion.jda.api.hooks.ListenerAdapter; +import net.dv8tion.jda.api.managers.GuildManager; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.context.ApplicationContext; diff --git a/src/main/java/net/Broken/Commande.java b/src/main/java/net/Broken/Commande.java index ec0f29d..1846c49 100644 --- a/src/main/java/net/Broken/Commande.java +++ b/src/main/java/net/Broken/Commande.java @@ -1,7 +1,7 @@ package net.Broken; -import net.dv8tion.jda.core.events.message.MessageReceivedEvent; +import net.dv8tion.jda.api.events.message.MessageReceivedEvent; /** * Interface that define command structure. diff --git a/src/main/java/net/Broken/Commands/Cat.java b/src/main/java/net/Broken/Commands/Cat.java index 6d9a746..fca08d7 100644 --- a/src/main/java/net/Broken/Commands/Cat.java +++ b/src/main/java/net/Broken/Commands/Cat.java @@ -2,8 +2,8 @@ package net.Broken.Commands; import net.Broken.Commande; -import net.dv8tion.jda.core.entities.ChannelType; -import net.dv8tion.jda.core.events.message.MessageReceivedEvent; +import net.dv8tion.jda.api.entities.ChannelType; +import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import org.json.JSONObject; import java.io.BufferedReader; diff --git a/src/main/java/net/Broken/Commands/Code.java b/src/main/java/net/Broken/Commands/Code.java index 2b6d08f..928b2db 100644 --- a/src/main/java/net/Broken/Commands/Code.java +++ b/src/main/java/net/Broken/Commands/Code.java @@ -10,10 +10,10 @@ import net.Broken.SpringContext; import net.Broken.Tools.EmbedMessageUtils; import net.Broken.Tools.MessageTimeOut; import net.Broken.Tools.PrivateMessage; -import net.dv8tion.jda.core.EmbedBuilder; -import net.dv8tion.jda.core.entities.ChannelType; -import net.dv8tion.jda.core.entities.Message; -import net.dv8tion.jda.core.events.message.MessageReceivedEvent; +import net.dv8tion.jda.api.EmbedBuilder; +import net.dv8tion.jda.api.entities.ChannelType; +import net.dv8tion.jda.api.entities.Message; +import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.context.ApplicationContext; diff --git a/src/main/java/net/Broken/Commands/DayTrigger.java b/src/main/java/net/Broken/Commands/DayTrigger.java index 820e1af..c62fb41 100644 --- a/src/main/java/net/Broken/Commands/DayTrigger.java +++ b/src/main/java/net/Broken/Commands/DayTrigger.java @@ -2,8 +2,8 @@ package net.Broken.Commands; import net.Broken.Commande; import net.Broken.Tools.DayListener.DayListener; -import net.dv8tion.jda.core.entities.ChannelType; -import net.dv8tion.jda.core.events.message.MessageReceivedEvent; +import net.dv8tion.jda.api.entities.ChannelType; +import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/main/java/net/Broken/Commands/Flush.java b/src/main/java/net/Broken/Commands/Flush.java index 36d7c03..5f6aa76 100644 --- a/src/main/java/net/Broken/Commands/Flush.java +++ b/src/main/java/net/Broken/Commands/Flush.java @@ -2,11 +2,11 @@ package net.Broken.Commands; import net.Broken.Commande; import net.Broken.Tools.EmbedMessageUtils; -import net.dv8tion.jda.core.Permission; -import net.dv8tion.jda.core.entities.Message; -import net.dv8tion.jda.core.entities.MessageChannel; -import net.dv8tion.jda.core.entities.MessageHistory; -import net.dv8tion.jda.core.events.message.MessageReceivedEvent; +import net.dv8tion.jda.api.Permission; +import net.dv8tion.jda.api.entities.Message; +import net.dv8tion.jda.api.entities.MessageChannel; +import net.dv8tion.jda.api.entities.MessageHistory; +import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/main/java/net/Broken/Commands/Help.java b/src/main/java/net/Broken/Commands/Help.java index bb76167..5b5803d 100644 --- a/src/main/java/net/Broken/Commands/Help.java +++ b/src/main/java/net/Broken/Commands/Help.java @@ -6,13 +6,13 @@ import net.Broken.Tools.EmbedMessageUtils; import net.Broken.Tools.MessageTimeOut; import net.Broken.Tools.PrivateMessage; import net.Broken.Tools.TableRenderer; -import net.dv8tion.jda.core.EmbedBuilder; -import net.dv8tion.jda.core.Permission; -import net.dv8tion.jda.core.entities.ChannelType; -import net.dv8tion.jda.core.entities.Guild; -import net.dv8tion.jda.core.entities.Message; -import net.dv8tion.jda.core.entities.MessageEmbed; -import net.dv8tion.jda.core.events.message.MessageReceivedEvent; +import net.dv8tion.jda.api.EmbedBuilder; +import net.dv8tion.jda.api.Permission; +import net.dv8tion.jda.api.entities.ChannelType; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.Message; +import net.dv8tion.jda.api.entities.MessageEmbed; +import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/main/java/net/Broken/Commands/Invite.java b/src/main/java/net/Broken/Commands/Invite.java index 19c7917..2358ac7 100644 --- a/src/main/java/net/Broken/Commands/Invite.java +++ b/src/main/java/net/Broken/Commands/Invite.java @@ -2,7 +2,7 @@ package net.Broken.Commands; import net.Broken.Commande; import net.Broken.Tools.PrivateMessage; -import net.dv8tion.jda.core.events.message.MessageReceivedEvent; +import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import org.apache.logging.log4j.LogManager; public class Invite implements Commande{ diff --git a/src/main/java/net/Broken/Commands/ListRoles.java b/src/main/java/net/Broken/Commands/ListRoles.java index 5f693f8..720370c 100644 --- a/src/main/java/net/Broken/Commands/ListRoles.java +++ b/src/main/java/net/Broken/Commands/ListRoles.java @@ -1,9 +1,9 @@ package net.Broken.Commands; import net.Broken.Commande; -import net.dv8tion.jda.core.EmbedBuilder; -import net.dv8tion.jda.core.entities.Role; -import net.dv8tion.jda.core.events.message.MessageReceivedEvent; +import net.dv8tion.jda.api.EmbedBuilder; +import net.dv8tion.jda.api.entities.Role; +import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import java.awt.*; import java.util.List; diff --git a/src/main/java/net/Broken/Commands/Move.java b/src/main/java/net/Broken/Commands/Move.java index 5cf6109..35579ab 100644 --- a/src/main/java/net/Broken/Commands/Move.java +++ b/src/main/java/net/Broken/Commands/Move.java @@ -4,11 +4,10 @@ import net.Broken.Commande; import net.Broken.MainBot; import net.Broken.Tools.EmbedMessageUtils; import net.Broken.Tools.MessageTimeOut; -import net.dv8tion.jda.core.entities.*; -import net.dv8tion.jda.core.events.message.MessageReceivedEvent; -import net.dv8tion.jda.core.exceptions.HierarchyException; -import net.dv8tion.jda.core.managers.GuildController; -import net.dv8tion.jda.core.managers.GuildManager; +import net.dv8tion.jda.api.entities.*; +import net.dv8tion.jda.api.events.message.MessageReceivedEvent; +import net.dv8tion.jda.api.exceptions.HierarchyException; +import net.dv8tion.jda.api.managers.GuildManager; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -28,8 +27,6 @@ public class Move implements Commande { public Member user; public Guild serveur; public GuildManager serveurManager; - public GuildController guildController; - /** Perform a move (Reset is role and add target(s) role(s) * * @param user User to move @@ -42,7 +39,6 @@ public class Move implements Commande { public boolean exc(Member user, List cible , boolean reset, Guild serveur, GuildManager serveurManager) throws HierarchyException { MainBot.roleFlag = true; - guildController = new GuildController(serveur); boolean erreur = false; List allRoll = serveur.getRoles(); @@ -63,7 +59,7 @@ public class Move implements Commande { //on fait ensuite les modif - guildController.modifyMemberRoles(user,cible).complete(); + serveur.modifyMemberRoles(user,cible).complete(); logger.info("Give " + cible + " role to " + user.getEffectiveName()); diff --git a/src/main/java/net/Broken/Commands/Music.java b/src/main/java/net/Broken/Commands/Music.java index 43b1b2d..824e376 100644 --- a/src/main/java/net/Broken/Commands/Music.java +++ b/src/main/java/net/Broken/Commands/Music.java @@ -5,9 +5,9 @@ import net.Broken.MainBot; import net.Broken.Tools.EmbedMessageUtils; import net.Broken.Tools.MessageTimeOut; import net.Broken.audio.AudioM; -import net.dv8tion.jda.core.entities.Message; -import net.dv8tion.jda.core.entities.VoiceChannel; -import net.dv8tion.jda.core.events.message.MessageReceivedEvent; +import net.dv8tion.jda.api.entities.Message; +import net.dv8tion.jda.api.entities.VoiceChannel; +import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/main/java/net/Broken/Commands/Over18/Madame.java b/src/main/java/net/Broken/Commands/Over18/Madame.java index 1be37e1..390d8ce 100644 --- a/src/main/java/net/Broken/Commands/Over18/Madame.java +++ b/src/main/java/net/Broken/Commands/Over18/Madame.java @@ -1,13 +1,9 @@ package net.Broken.Commands.Over18; -import net.Broken.Commande; import net.Broken.Tools.Command.NoDev; import net.Broken.Tools.Command.NumberedCommande; -import net.Broken.Tools.EmbedMessageUtils; import net.Broken.Tools.FindContentOnWebPage; -import net.Broken.Tools.Redirection; -import net.Broken.Tools.TrueRandom; -import net.dv8tion.jda.core.events.message.MessageReceivedEvent; +import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/main/java/net/Broken/Commands/Over18/SM.java b/src/main/java/net/Broken/Commands/Over18/SM.java index 02194f3..2cb4137 100644 --- a/src/main/java/net/Broken/Commands/Over18/SM.java +++ b/src/main/java/net/Broken/Commands/Over18/SM.java @@ -3,7 +3,7 @@ package net.Broken.Commands.Over18; import net.Broken.Commande; import net.Broken.Tools.FindContentOnWebPage; import net.Broken.Tools.Redirection; -import net.dv8tion.jda.core.events.message.MessageReceivedEvent; +import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/main/java/net/Broken/Commands/Over18/Suicide.java b/src/main/java/net/Broken/Commands/Over18/Suicide.java index fc3f233..f351ddc 100644 --- a/src/main/java/net/Broken/Commands/Over18/Suicide.java +++ b/src/main/java/net/Broken/Commands/Over18/Suicide.java @@ -4,7 +4,7 @@ import net.Broken.Commande; import net.Broken.Tools.EmbedMessageUtils; import net.Broken.Tools.FindContentOnWebPage; import net.Broken.Tools.Redirection; -import net.dv8tion.jda.core.events.message.MessageReceivedEvent; +import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/main/java/net/Broken/Commands/Ping.java b/src/main/java/net/Broken/Commands/Ping.java index 213f2e0..de32e73 100644 --- a/src/main/java/net/Broken/Commands/Ping.java +++ b/src/main/java/net/Broken/Commands/Ping.java @@ -3,9 +3,9 @@ package net.Broken.Commands; import net.Broken.Commande; import net.Broken.MainBot; import net.Broken.Tools.MessageTimeOut; -import net.dv8tion.jda.core.entities.ChannelType; -import net.dv8tion.jda.core.entities.Message; -import net.dv8tion.jda.core.events.message.MessageReceivedEvent; +import net.dv8tion.jda.api.entities.ChannelType; +import net.dv8tion.jda.api.entities.Message; +import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import org.apache.logging.log4j.LogManager; @@ -16,7 +16,7 @@ public class Ping implements Commande { @Override public void action(String[] args, MessageReceivedEvent event) { - long ping = event.getJDA().getPing(); + long ping = event.getJDA().getGatewayPing(); // long receivedTime = Timestamp.valueOf(LocalDateTime.ofInstant(event.getMessage().getCreationTime().toInstant(), ZoneId.systemDefault())).getTime(); if(event.isFromType(ChannelType.PRIVATE)) event.getPrivateChannel().sendMessage(":arrow_right: Pong! `" + ping+ "ms`").queue(); diff --git a/src/main/java/net/Broken/Commands/Rank.java b/src/main/java/net/Broken/Commands/Rank.java index dc3f3ab..dbddd30 100644 --- a/src/main/java/net/Broken/Commands/Rank.java +++ b/src/main/java/net/Broken/Commands/Rank.java @@ -2,8 +2,8 @@ package net.Broken.Commands; import net.Broken.Commande; import net.Broken.Tools.UserManager.Stats.UserStatsUtils; -import net.dv8tion.jda.core.entities.MessageEmbed; -import net.dv8tion.jda.core.events.message.MessageReceivedEvent; +import net.dv8tion.jda.api.entities.MessageEmbed; +import net.dv8tion.jda.api.events.message.MessageReceivedEvent; public class Rank implements Commande { @Override diff --git a/src/main/java/net/Broken/Commands/Settings.java b/src/main/java/net/Broken/Commands/Settings.java index 6c4823e..ebf6124 100644 --- a/src/main/java/net/Broken/Commands/Settings.java +++ b/src/main/java/net/Broken/Commands/Settings.java @@ -12,9 +12,9 @@ import net.Broken.audio.AudioM; import net.Broken.audio.NotConnectedException; import net.Broken.audio.NullMusicManager; import net.Broken.audio.Youtube.YoutubeTools; -import net.dv8tion.jda.core.EmbedBuilder; -import net.dv8tion.jda.core.entities.*; -import net.dv8tion.jda.core.events.message.MessageReceivedEvent; +import net.dv8tion.jda.api.EmbedBuilder; +import net.dv8tion.jda.api.entities.*; +import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.context.ApplicationContext; diff --git a/src/main/java/net/Broken/Commands/Spam.java b/src/main/java/net/Broken/Commands/Spam.java index 7f8c432..b97159b 100644 --- a/src/main/java/net/Broken/Commands/Spam.java +++ b/src/main/java/net/Broken/Commands/Spam.java @@ -6,12 +6,12 @@ import net.Broken.Tools.AntiSpam; import net.Broken.Tools.EmbedMessageUtils; import net.Broken.Tools.MessageTimeOut; import net.Broken.Tools.UserSpamUtils; -import net.dv8tion.jda.core.entities.Guild; -import net.dv8tion.jda.core.entities.Member; -import net.dv8tion.jda.core.entities.Message; -import net.dv8tion.jda.core.entities.User; -import net.dv8tion.jda.core.events.message.MessageReceivedEvent; -import net.dv8tion.jda.core.exceptions.RateLimitedException; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.Member; +import net.dv8tion.jda.api.entities.Message; +import net.dv8tion.jda.api.entities.User; +import net.dv8tion.jda.api.events.message.MessageReceivedEvent; +import net.dv8tion.jda.api.exceptions.RateLimitedException; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/main/java/net/Broken/Commands/SpamInfo.java b/src/main/java/net/Broken/Commands/SpamInfo.java index 1d92302..048f270 100644 --- a/src/main/java/net/Broken/Commands/SpamInfo.java +++ b/src/main/java/net/Broken/Commands/SpamInfo.java @@ -6,12 +6,12 @@ import net.Broken.Tools.EmbedMessageUtils; import net.Broken.Tools.MessageTimeOut; import net.Broken.Tools.PrivateMessage; import net.Broken.Tools.UserSpamUtils; -import net.dv8tion.jda.core.EmbedBuilder; -import net.dv8tion.jda.core.entities.ChannelType; -import net.dv8tion.jda.core.entities.Member; -import net.dv8tion.jda.core.entities.Message; -import net.dv8tion.jda.core.entities.User; -import net.dv8tion.jda.core.events.message.MessageReceivedEvent; +import net.dv8tion.jda.api.EmbedBuilder; +import net.dv8tion.jda.api.entities.ChannelType; +import net.dv8tion.jda.api.entities.Member; +import net.dv8tion.jda.api.entities.Message; +import net.dv8tion.jda.api.entities.User; +import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/main/java/net/Broken/Commands/YtSearch.java b/src/main/java/net/Broken/Commands/YtSearch.java index c8296ab..2eb9961 100644 --- a/src/main/java/net/Broken/Commands/YtSearch.java +++ b/src/main/java/net/Broken/Commands/YtSearch.java @@ -7,10 +7,10 @@ import net.Broken.Tools.EmbedMessageUtils; import net.Broken.Tools.MessageTimeOut; import net.Broken.audio.Youtube.SearchResult; import net.Broken.audio.Youtube.YoutubeTools; -import net.dv8tion.jda.core.EmbedBuilder; -import net.dv8tion.jda.core.entities.Message; -import net.dv8tion.jda.core.entities.MessageEmbed; -import net.dv8tion.jda.core.events.message.MessageReceivedEvent; +import net.dv8tion.jda.api.EmbedBuilder; +import net.dv8tion.jda.api.entities.Message; +import net.dv8tion.jda.api.entities.MessageEmbed; +import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/main/java/net/Broken/DB/Entity/GuildPreferenceEntity.java b/src/main/java/net/Broken/DB/Entity/GuildPreferenceEntity.java index c57f4a0..37b076a 100644 --- a/src/main/java/net/Broken/DB/Entity/GuildPreferenceEntity.java +++ b/src/main/java/net/Broken/DB/Entity/GuildPreferenceEntity.java @@ -1,7 +1,7 @@ package net.Broken.DB.Entity; -import net.dv8tion.jda.core.entities.Guild; -import net.dv8tion.jda.core.entities.VoiceChannel; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.VoiceChannel; import javax.persistence.*; import java.util.ArrayList; diff --git a/src/main/java/net/Broken/DB/Entity/UserEntity.java b/src/main/java/net/Broken/DB/Entity/UserEntity.java index 644f57e..8e28316 100644 --- a/src/main/java/net/Broken/DB/Entity/UserEntity.java +++ b/src/main/java/net/Broken/DB/Entity/UserEntity.java @@ -2,7 +2,7 @@ package net.Broken.DB.Entity; import com.fasterxml.jackson.annotation.JsonIgnore; import net.Broken.Tools.UserManager.UserUtils; -import net.dv8tion.jda.core.entities.User; +import net.dv8tion.jda.api.entities.User; import org.springframework.security.crypto.password.PasswordEncoder; import javax.persistence.*; diff --git a/src/main/java/net/Broken/Init.java b/src/main/java/net/Broken/Init.java index 6de5b31..a7a373c 100644 --- a/src/main/java/net/Broken/Init.java +++ b/src/main/java/net/Broken/Init.java @@ -8,12 +8,12 @@ import net.Broken.Tools.DayListener.DayListener; import net.Broken.Tools.DayListener.Listeners.DailyMadame; import net.Broken.Tools.DayListener.Listeners.ResetSpam; import net.Broken.Tools.UserManager.Stats.UserStatsUtils; -import net.dv8tion.jda.core.AccountType; -import net.dv8tion.jda.core.JDA; -import net.dv8tion.jda.core.JDABuilder; -import net.dv8tion.jda.core.OnlineStatus; -import net.dv8tion.jda.core.entities.Game; -import net.dv8tion.jda.core.entities.Guild; +import net.dv8tion.jda.api.AccountType; +import net.dv8tion.jda.api.JDA; +import net.dv8tion.jda.api.JDABuilder; +import net.dv8tion.jda.api.OnlineStatus; +import net.dv8tion.jda.api.entities.Activity; +import net.dv8tion.jda.api.entities.Guild; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.context.ApplicationContext; @@ -55,8 +55,14 @@ public class Init { /************************************* * Definition des commande * *************************************/ - jda.getPresence().setPresence(OnlineStatus.DO_NOT_DISTURB, Game.playing("Loading...")); - jda.getTextChannels().forEach(textChannel -> textChannel.sendTyping().queue()); + jda.getPresence().setPresence(OnlineStatus.DO_NOT_DISTURB, Activity.playing("Loading...")); + + jda.getTextChannels().forEach(textChannel -> { + try { + textChannel.sendTyping().queue(); + }catch (Exception ignored){} + + }); //On recupere le l'id serveur @@ -90,7 +96,7 @@ public class Init { dayListener.addListener(new DailyMadame()); dayListener.start(); jda.addEventListener(new BotListener()); - jda.getPresence().setPresence(OnlineStatus.ONLINE, Game.playing(MainBot.url)); + jda.getPresence().setPresence(OnlineStatus.ONLINE, Activity.playing(MainBot.url)); logger.info("-----------------------END INIT-----------------------"); diff --git a/src/main/java/net/Broken/MainBot.java b/src/main/java/net/Broken/MainBot.java index ec102c9..a821ad2 100644 --- a/src/main/java/net/Broken/MainBot.java +++ b/src/main/java/net/Broken/MainBot.java @@ -3,15 +3,13 @@ package net.Broken; import net.Broken.DB.Entity.UserEntity; import net.Broken.Tools.Command.CommandParser; import net.Broken.Tools.EmbedMessageUtils; -import net.Broken.Tools.MessageTimeOut; import net.Broken.Tools.PrivateMessage; import net.Broken.Tools.UserSpamUtils; -import net.dv8tion.jda.core.JDA; -import net.dv8tion.jda.core.Permission; -import net.dv8tion.jda.core.entities.ChannelType; -import net.dv8tion.jda.core.entities.Member; -import net.dv8tion.jda.core.entities.Message; -import net.dv8tion.jda.core.events.message.MessageReceivedEvent; +import net.dv8tion.jda.api.JDA; +import net.dv8tion.jda.api.Permission; +import net.dv8tion.jda.api.entities.ChannelType; +import net.dv8tion.jda.api.entities.Member; +import net.dv8tion.jda.api.entities.Message; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.boot.ExitCodeGenerator; diff --git a/src/main/java/net/Broken/RestApi/CommandInterface.java b/src/main/java/net/Broken/RestApi/CommandInterface.java index 381f9f2..53a5e24 100644 --- a/src/main/java/net/Broken/RestApi/CommandInterface.java +++ b/src/main/java/net/Broken/RestApi/CommandInterface.java @@ -3,8 +3,8 @@ package net.Broken.RestApi; import net.Broken.Commands.Music; import net.Broken.RestApi.Data.CommandPostData; import net.Broken.RestApi.Data.CommandResponseData; -import net.dv8tion.jda.core.entities.Guild; -import net.dv8tion.jda.core.entities.User; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.User; import org.springframework.http.ResponseEntity; diff --git a/src/main/java/net/Broken/RestApi/Commands/Add.java b/src/main/java/net/Broken/RestApi/Commands/Add.java index 748b414..26320b6 100644 --- a/src/main/java/net/Broken/RestApi/Commands/Add.java +++ b/src/main/java/net/Broken/RestApi/Commands/Add.java @@ -4,8 +4,8 @@ import net.Broken.RestApi.CommandInterface; import net.Broken.RestApi.Data.CommandPostData; import net.Broken.RestApi.Data.CommandResponseData; import net.Broken.audio.WebLoadUtils; -import net.dv8tion.jda.core.entities.Guild; -import net.dv8tion.jda.core.entities.User; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.User; import org.springframework.http.ResponseEntity; /** diff --git a/src/main/java/net/Broken/RestApi/Commands/AutoFlowOff.java b/src/main/java/net/Broken/RestApi/Commands/AutoFlowOff.java index df5b33a..843efc7 100644 --- a/src/main/java/net/Broken/RestApi/Commands/AutoFlowOff.java +++ b/src/main/java/net/Broken/RestApi/Commands/AutoFlowOff.java @@ -6,8 +6,8 @@ import net.Broken.RestApi.Data.CommandPostData; import net.Broken.RestApi.Data.CommandResponseData; import net.Broken.audio.AudioM; import net.Broken.audio.TrackScheduler; -import net.dv8tion.jda.core.entities.Guild; -import net.dv8tion.jda.core.entities.User; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.User; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/src/main/java/net/Broken/RestApi/Commands/AutoFlowOn.java b/src/main/java/net/Broken/RestApi/Commands/AutoFlowOn.java index a48ed5d..a13f081 100644 --- a/src/main/java/net/Broken/RestApi/Commands/AutoFlowOn.java +++ b/src/main/java/net/Broken/RestApi/Commands/AutoFlowOn.java @@ -6,8 +6,8 @@ import net.Broken.RestApi.Data.CommandPostData; import net.Broken.RestApi.Data.CommandResponseData; import net.Broken.audio.AudioM; import net.Broken.audio.TrackScheduler; -import net.dv8tion.jda.core.entities.Guild; -import net.dv8tion.jda.core.entities.User; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.User; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/src/main/java/net/Broken/RestApi/Commands/Connect.java b/src/main/java/net/Broken/RestApi/Commands/Connect.java index 8db6fb0..6c00ca3 100644 --- a/src/main/java/net/Broken/RestApi/Commands/Connect.java +++ b/src/main/java/net/Broken/RestApi/Commands/Connect.java @@ -5,9 +5,9 @@ import net.Broken.RestApi.CommandInterface; import net.Broken.RestApi.Data.CommandPostData; import net.Broken.RestApi.Data.CommandResponseData; import net.Broken.audio.AudioM; -import net.dv8tion.jda.core.entities.Guild; -import net.dv8tion.jda.core.entities.User; -import net.dv8tion.jda.core.entities.VoiceChannel; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.User; +import net.dv8tion.jda.api.entities.VoiceChannel; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/src/main/java/net/Broken/RestApi/Commands/Dell.java b/src/main/java/net/Broken/RestApi/Commands/Dell.java index 1c232bb..1840da6 100644 --- a/src/main/java/net/Broken/RestApi/Commands/Dell.java +++ b/src/main/java/net/Broken/RestApi/Commands/Dell.java @@ -6,8 +6,8 @@ import net.Broken.RestApi.CommandInterface; import net.Broken.RestApi.Data.CommandPostData; import net.Broken.RestApi.Data.CommandResponseData; import net.Broken.audio.AudioM; -import net.dv8tion.jda.core.entities.Guild; -import net.dv8tion.jda.core.entities.User; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.User; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/src/main/java/net/Broken/RestApi/Commands/Disconnect.java b/src/main/java/net/Broken/RestApi/Commands/Disconnect.java index 6838f41..a3a2281 100644 --- a/src/main/java/net/Broken/RestApi/Commands/Disconnect.java +++ b/src/main/java/net/Broken/RestApi/Commands/Disconnect.java @@ -1,13 +1,11 @@ package net.Broken.RestApi.Commands; -import net.Broken.Commands.Music; -import net.Broken.MainBot; import net.Broken.RestApi.CommandInterface; import net.Broken.RestApi.Data.CommandPostData; import net.Broken.RestApi.Data.CommandResponseData; import net.Broken.audio.AudioM; -import net.dv8tion.jda.core.entities.Guild; -import net.dv8tion.jda.core.entities.User; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.User; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/src/main/java/net/Broken/RestApi/Commands/Flush.java b/src/main/java/net/Broken/RestApi/Commands/Flush.java index fc4d038..595c84c 100644 --- a/src/main/java/net/Broken/RestApi/Commands/Flush.java +++ b/src/main/java/net/Broken/RestApi/Commands/Flush.java @@ -5,8 +5,8 @@ import net.Broken.RestApi.CommandInterface; import net.Broken.RestApi.Data.CommandPostData; import net.Broken.RestApi.Data.CommandResponseData; import net.Broken.audio.AudioM; -import net.dv8tion.jda.core.entities.Guild; -import net.dv8tion.jda.core.entities.User; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.User; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/src/main/java/net/Broken/RestApi/Commands/Next.java b/src/main/java/net/Broken/RestApi/Commands/Next.java index 5f3031e..0e49bbf 100644 --- a/src/main/java/net/Broken/RestApi/Commands/Next.java +++ b/src/main/java/net/Broken/RestApi/Commands/Next.java @@ -5,8 +5,8 @@ import net.Broken.RestApi.CommandInterface; import net.Broken.RestApi.Data.CommandPostData; import net.Broken.RestApi.Data.CommandResponseData; import net.Broken.audio.AudioM; -import net.dv8tion.jda.core.entities.Guild; -import net.dv8tion.jda.core.entities.User; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.User; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/src/main/java/net/Broken/RestApi/Commands/Pause.java b/src/main/java/net/Broken/RestApi/Commands/Pause.java index 3e392d5..e6c9e08 100644 --- a/src/main/java/net/Broken/RestApi/Commands/Pause.java +++ b/src/main/java/net/Broken/RestApi/Commands/Pause.java @@ -5,8 +5,8 @@ import net.Broken.RestApi.CommandInterface; import net.Broken.RestApi.Data.CommandPostData; import net.Broken.RestApi.Data.CommandResponseData; import net.Broken.audio.AudioM; -import net.dv8tion.jda.core.entities.Guild; -import net.dv8tion.jda.core.entities.User; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.User; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/src/main/java/net/Broken/RestApi/Commands/Play.java b/src/main/java/net/Broken/RestApi/Commands/Play.java index afcc994..198ca3a 100644 --- a/src/main/java/net/Broken/RestApi/Commands/Play.java +++ b/src/main/java/net/Broken/RestApi/Commands/Play.java @@ -5,8 +5,8 @@ import net.Broken.RestApi.CommandInterface; import net.Broken.RestApi.Data.CommandPostData; import net.Broken.RestApi.Data.CommandResponseData; import net.Broken.audio.AudioM; -import net.dv8tion.jda.core.entities.Guild; -import net.dv8tion.jda.core.entities.User; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.User; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/src/main/java/net/Broken/RestApi/Commands/Stop.java b/src/main/java/net/Broken/RestApi/Commands/Stop.java index 79a9af1..8189e96 100644 --- a/src/main/java/net/Broken/RestApi/Commands/Stop.java +++ b/src/main/java/net/Broken/RestApi/Commands/Stop.java @@ -5,9 +5,9 @@ import net.Broken.RestApi.CommandInterface; import net.Broken.RestApi.Data.CommandPostData; import net.Broken.RestApi.Data.CommandResponseData; import net.Broken.audio.AudioM; -import net.dv8tion.jda.core.entities.Guild; -import net.dv8tion.jda.core.entities.User; -import net.dv8tion.jda.core.events.message.MessageReceivedEvent; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.User; +import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/src/main/java/net/Broken/RestApi/MusicWebAPIController.java b/src/main/java/net/Broken/RestApi/MusicWebAPIController.java index bc5235a..db88068 100644 --- a/src/main/java/net/Broken/RestApi/MusicWebAPIController.java +++ b/src/main/java/net/Broken/RestApi/MusicWebAPIController.java @@ -14,8 +14,8 @@ import net.Broken.audio.AudioM; import net.Broken.audio.GetVoiceChanels; import net.Broken.audio.Youtube.SearchResult; import net.Broken.audio.Youtube.YoutubeTools; -import net.dv8tion.jda.core.entities.Guild; -import net.dv8tion.jda.core.entities.VoiceChannel; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.VoiceChannel; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; diff --git a/src/main/java/net/Broken/RestApi/SettingAPIController.java b/src/main/java/net/Broken/RestApi/SettingAPIController.java index 91589a2..af83eb8 100644 --- a/src/main/java/net/Broken/RestApi/SettingAPIController.java +++ b/src/main/java/net/Broken/RestApi/SettingAPIController.java @@ -12,12 +12,12 @@ import net.Broken.RestApi.Data.Settings.Value; import net.Broken.Tools.SettingsUtils; import net.Broken.Tools.UserManager.Exceptions.UnknownTokenException; import net.Broken.Tools.UserManager.UserUtils; -import net.dv8tion.jda.core.JDA; -import net.dv8tion.jda.core.Permission; -import net.dv8tion.jda.core.entities.Guild; -import net.dv8tion.jda.core.entities.Role; -import net.dv8tion.jda.core.entities.TextChannel; -import net.dv8tion.jda.core.entities.User; +import net.dv8tion.jda.api.JDA; +import net.dv8tion.jda.api.Permission; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.Role; +import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.User; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; diff --git a/src/main/java/net/Broken/RestApi/UserManagerAPIController.java b/src/main/java/net/Broken/RestApi/UserManagerAPIController.java index 0ea30f2..4f14afe 100644 --- a/src/main/java/net/Broken/RestApi/UserManagerAPIController.java +++ b/src/main/java/net/Broken/RestApi/UserManagerAPIController.java @@ -12,9 +12,9 @@ import net.Broken.Tools.UserManager.Oauth; import net.Broken.Tools.UserManager.Stats.GuildStatsPack; import net.Broken.Tools.UserManager.Stats.UserStatsUtils; import net.Broken.Tools.UserManager.UserUtils; -import net.dv8tion.jda.core.Permission; -import net.dv8tion.jda.core.entities.Guild; -import net.dv8tion.jda.core.entities.User; +import net.dv8tion.jda.api.Permission; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.User; import org.apache.http.HttpResponse; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/main/java/net/Broken/Tools/AntiSpam.java b/src/main/java/net/Broken/Tools/AntiSpam.java index c7780fd..b3ffaba 100644 --- a/src/main/java/net/Broken/Tools/AntiSpam.java +++ b/src/main/java/net/Broken/Tools/AntiSpam.java @@ -2,10 +2,10 @@ package net.Broken.Tools; import net.Broken.MainBot; import net.Broken.Commands.Move; -import net.dv8tion.jda.core.entities.*; -import net.dv8tion.jda.core.events.message.MessageReceivedEvent; -import net.dv8tion.jda.core.exceptions.HierarchyException; -import net.dv8tion.jda.core.managers.GuildManager; +import net.dv8tion.jda.api.entities.*; +import net.dv8tion.jda.api.events.message.MessageReceivedEvent; +import net.dv8tion.jda.api.exceptions.HierarchyException; +import net.dv8tion.jda.api.managers.GuildManager; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/main/java/net/Broken/Tools/Command/CommandParser.java b/src/main/java/net/Broken/Tools/Command/CommandParser.java index 4d3a174..72ffad7 100644 --- a/src/main/java/net/Broken/Tools/Command/CommandParser.java +++ b/src/main/java/net/Broken/Tools/Command/CommandParser.java @@ -1,6 +1,6 @@ package net.Broken.Tools.Command; -import net.dv8tion.jda.core.events.message.MessageReceivedEvent; +import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/main/java/net/Broken/Tools/Command/NumberedCommande.java b/src/main/java/net/Broken/Tools/Command/NumberedCommande.java index a846de1..3882c66 100644 --- a/src/main/java/net/Broken/Tools/Command/NumberedCommande.java +++ b/src/main/java/net/Broken/Tools/Command/NumberedCommande.java @@ -3,7 +3,7 @@ import net.Broken.Commande; import net.Broken.Tools.FindContentOnWebPage; import net.Broken.Tools.LimitChecker; import net.Broken.Tools.TrueRandom; -import net.dv8tion.jda.core.events.message.MessageReceivedEvent; +import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/main/java/net/Broken/Tools/DayListener/DayListener.java b/src/main/java/net/Broken/Tools/DayListener/DayListener.java index 300ea19..9954de1 100644 --- a/src/main/java/net/Broken/Tools/DayListener/DayListener.java +++ b/src/main/java/net/Broken/Tools/DayListener/DayListener.java @@ -1,6 +1,6 @@ package net.Broken.Tools.DayListener; import net.Broken.Commands.Spam; -import net.dv8tion.jda.core.exceptions.RateLimitedException; +import net.dv8tion.jda.api.exceptions.RateLimitedException; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/main/java/net/Broken/Tools/DayListener/Listeners/DailyMadame.java b/src/main/java/net/Broken/Tools/DayListener/Listeners/DailyMadame.java index 2d0ad80..6c6b467 100644 --- a/src/main/java/net/Broken/Tools/DayListener/Listeners/DailyMadame.java +++ b/src/main/java/net/Broken/Tools/DayListener/Listeners/DailyMadame.java @@ -7,8 +7,8 @@ import net.Broken.SpringContext; import net.Broken.Tools.DayListener.NewDayListener; import net.Broken.Tools.FindContentOnWebPage; import net.Broken.Tools.Redirection; -import net.dv8tion.jda.core.entities.Guild; -import net.dv8tion.jda.core.entities.TextChannel; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.TextChannel; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.context.ApplicationContext; diff --git a/src/main/java/net/Broken/Tools/DayListener/Listeners/ResetSpam.java b/src/main/java/net/Broken/Tools/DayListener/Listeners/ResetSpam.java index 3382a24..ca41ece 100644 --- a/src/main/java/net/Broken/Tools/DayListener/Listeners/ResetSpam.java +++ b/src/main/java/net/Broken/Tools/DayListener/Listeners/ResetSpam.java @@ -2,7 +2,7 @@ package net.Broken.Tools.DayListener.Listeners; import net.Broken.Commands.Spam; import net.Broken.Tools.DayListener.NewDayListener; -import net.dv8tion.jda.core.exceptions.RateLimitedException; +import net.dv8tion.jda.api.exceptions.RateLimitedException; import java.util.GregorianCalendar; diff --git a/src/main/java/net/Broken/Tools/EmbedMessageUtils.java b/src/main/java/net/Broken/Tools/EmbedMessageUtils.java index 46336c9..a87ba1d 100644 --- a/src/main/java/net/Broken/Tools/EmbedMessageUtils.java +++ b/src/main/java/net/Broken/Tools/EmbedMessageUtils.java @@ -4,9 +4,9 @@ import net.Broken.DB.Entity.GuildPreferenceEntity; import net.Broken.MainBot; import net.Broken.audio.Youtube.SearchResult; import net.Broken.audio.Youtube.YoutubeTools; -import net.dv8tion.jda.core.EmbedBuilder; -import net.dv8tion.jda.core.entities.Member; -import net.dv8tion.jda.core.entities.MessageEmbed; +import net.dv8tion.jda.api.EmbedBuilder; +import net.dv8tion.jda.api.entities.Member; +import net.dv8tion.jda.api.entities.MessageEmbed; import java.awt.*; import java.io.FileNotFoundException; diff --git a/src/main/java/net/Broken/Tools/MessageTimeOut.java b/src/main/java/net/Broken/Tools/MessageTimeOut.java index dd806eb..10d345a 100644 --- a/src/main/java/net/Broken/Tools/MessageTimeOut.java +++ b/src/main/java/net/Broken/Tools/MessageTimeOut.java @@ -1,7 +1,7 @@ package net.Broken.Tools; -import net.dv8tion.jda.core.entities.Message; -import net.dv8tion.jda.core.exceptions.ErrorResponseException; +import net.dv8tion.jda.api.entities.Message; +import net.dv8tion.jda.api.exceptions.ErrorResponseException; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/main/java/net/Broken/Tools/Moderateur.java b/src/main/java/net/Broken/Tools/Moderateur.java index 5cfb58a..6be44b4 100644 --- a/src/main/java/net/Broken/Tools/Moderateur.java +++ b/src/main/java/net/Broken/Tools/Moderateur.java @@ -3,11 +3,11 @@ package net.Broken.Tools; import net.Broken.MainBot; -import net.dv8tion.jda.core.entities.Guild; -import net.dv8tion.jda.core.entities.Member; -import net.dv8tion.jda.core.entities.Message; -import net.dv8tion.jda.core.events.message.MessageReceivedEvent; -import net.dv8tion.jda.core.managers.GuildManager; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.Member; +import net.dv8tion.jda.api.entities.Message; +import net.dv8tion.jda.api.events.message.MessageReceivedEvent; +import net.dv8tion.jda.api.managers.GuildManager; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/main/java/net/Broken/Tools/PrivateMessage.java b/src/main/java/net/Broken/Tools/PrivateMessage.java index 5e890d2..a5c2ca1 100644 --- a/src/main/java/net/Broken/Tools/PrivateMessage.java +++ b/src/main/java/net/Broken/Tools/PrivateMessage.java @@ -1,8 +1,8 @@ package net.Broken.Tools; -import net.dv8tion.jda.core.entities.Message; -import net.dv8tion.jda.core.entities.MessageEmbed; -import net.dv8tion.jda.core.entities.User; +import net.dv8tion.jda.api.entities.Message; +import net.dv8tion.jda.api.entities.MessageEmbed; +import net.dv8tion.jda.api.entities.User; import org.apache.logging.log4j.Logger; /** diff --git a/src/main/java/net/Broken/Tools/SettingsUtils.java b/src/main/java/net/Broken/Tools/SettingsUtils.java index 7963cd7..2a5420e 100644 --- a/src/main/java/net/Broken/Tools/SettingsUtils.java +++ b/src/main/java/net/Broken/Tools/SettingsUtils.java @@ -12,8 +12,8 @@ import net.Broken.RestApi.Data.Settings.Value; import net.Broken.SpringContext; import net.Broken.Tools.UserManager.Exceptions.UnknownTokenException; import net.Broken.Tools.UserManager.UserUtils; -import net.dv8tion.jda.core.Permission; -import net.dv8tion.jda.core.entities.*; +import net.dv8tion.jda.api.Permission; +import net.dv8tion.jda.api.entities.*; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.context.ApplicationContext; diff --git a/src/main/java/net/Broken/Tools/UserManager/Oauth.java b/src/main/java/net/Broken/Tools/UserManager/Oauth.java index 312efff..3171790 100644 --- a/src/main/java/net/Broken/Tools/UserManager/Oauth.java +++ b/src/main/java/net/Broken/Tools/UserManager/Oauth.java @@ -4,7 +4,7 @@ import jdk.nashorn.internal.parser.JSONParser; import net.Broken.DB.Entity.UserEntity; import net.Broken.DB.Repository.UserRepository; import net.Broken.MainBot; -import net.dv8tion.jda.core.entities.User; +import net.dv8tion.jda.api.entities.User; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.json.JSONObject; diff --git a/src/main/java/net/Broken/Tools/UserManager/Stats/UserStatsUtils.java b/src/main/java/net/Broken/Tools/UserManager/Stats/UserStatsUtils.java index 157dbfb..d780ebe 100644 --- a/src/main/java/net/Broken/Tools/UserManager/Stats/UserStatsUtils.java +++ b/src/main/java/net/Broken/Tools/UserManager/Stats/UserStatsUtils.java @@ -9,11 +9,11 @@ import net.Broken.SpringContext; import net.Broken.Tools.EmbedMessageUtils; import net.Broken.Tools.UserManager.Exceptions.UnknownTokenException; import net.Broken.Tools.UserManager.UserUtils; -import net.dv8tion.jda.core.EmbedBuilder; -import net.dv8tion.jda.core.entities.Guild; -import net.dv8tion.jda.core.entities.Member; -import net.dv8tion.jda.core.entities.MessageEmbed; -import net.dv8tion.jda.core.entities.User; +import net.dv8tion.jda.api.EmbedBuilder; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.Member; +import net.dv8tion.jda.api.entities.MessageEmbed; +import net.dv8tion.jda.api.entities.User; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.context.ApplicationContext; diff --git a/src/main/java/net/Broken/Tools/UserManager/UserUtils.java b/src/main/java/net/Broken/Tools/UserManager/UserUtils.java index 8e4ea2d..30dfc62 100644 --- a/src/main/java/net/Broken/Tools/UserManager/UserUtils.java +++ b/src/main/java/net/Broken/Tools/UserManager/UserUtils.java @@ -10,8 +10,8 @@ import net.Broken.Tools.EmbedMessageUtils; import net.Broken.Tools.PrivateMessage; import net.Broken.Tools.ResourceLoader; import net.Broken.Tools.UserManager.Exceptions.*; -import net.dv8tion.jda.core.entities.MessageEmbed; -import net.dv8tion.jda.core.entities.User; +import net.dv8tion.jda.api.entities.MessageEmbed; +import net.dv8tion.jda.api.entities.User; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.security.crypto.password.PasswordEncoder; diff --git a/src/main/java/net/Broken/Tools/UserSpamUtils.java b/src/main/java/net/Broken/Tools/UserSpamUtils.java index 37d646f..37b7163 100644 --- a/src/main/java/net/Broken/Tools/UserSpamUtils.java +++ b/src/main/java/net/Broken/Tools/UserSpamUtils.java @@ -1,7 +1,7 @@ package net.Broken.Tools; -import net.dv8tion.jda.core.entities.Member; -import net.dv8tion.jda.core.entities.Message; +import net.dv8tion.jda.api.entities.Member; +import net.dv8tion.jda.api.entities.Message; import java.util.List; diff --git a/src/main/java/net/Broken/audio/AudioM.java b/src/main/java/net/Broken/audio/AudioM.java index e430b63..49fc2fb 100644 --- a/src/main/java/net/Broken/audio/AudioM.java +++ b/src/main/java/net/Broken/audio/AudioM.java @@ -11,16 +11,13 @@ import com.sedmelluq.discord.lavaplayer.track.AudioTrackInfo; import net.Broken.MainBot; import net.Broken.RestApi.Data.UserAudioTrackData; import net.Broken.Tools.EmbedMessageUtils; -import net.Broken.Tools.MessageTimeOut; -import net.dv8tion.jda.core.entities.Guild; -import net.dv8tion.jda.core.entities.Message; -import net.dv8tion.jda.core.entities.User; -import net.dv8tion.jda.core.entities.VoiceChannel; -import net.dv8tion.jda.core.events.message.MessageReceivedEvent; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.User; +import net.dv8tion.jda.api.entities.VoiceChannel; +import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; diff --git a/src/main/java/net/Broken/audio/AudioPlayerSendHandler.java b/src/main/java/net/Broken/audio/AudioPlayerSendHandler.java index 89fe125..bbe27c0 100644 --- a/src/main/java/net/Broken/audio/AudioPlayerSendHandler.java +++ b/src/main/java/net/Broken/audio/AudioPlayerSendHandler.java @@ -2,9 +2,9 @@ package net.Broken.audio; import com.sedmelluq.discord.lavaplayer.player.AudioPlayer; import com.sedmelluq.discord.lavaplayer.track.playback.AudioFrame; -import com.sedmelluq.discord.lavaplayer.player.AudioPlayer; -import com.sedmelluq.discord.lavaplayer.track.playback.AudioFrame; -import net.dv8tion.jda.core.audio.AudioSendHandler; +import net.dv8tion.jda.api.audio.AudioSendHandler; + +import java.nio.ByteBuffer; /** * This is a wrapper around AudioPlayer which makes it behave as an AudioSendHandler for JDA. As JDA calls canProvide @@ -32,15 +32,8 @@ public class AudioPlayerSendHandler implements AudioSendHandler { } @Override - public byte[] provide20MsAudio() { - if (lastFrame == null) { - lastFrame = audioPlayer.provide(); - } - - byte[] data = lastFrame != null ? lastFrame.getData() : null; - lastFrame = null; - - return data; + public ByteBuffer provide20MsAudio() { + return ByteBuffer.wrap(lastFrame.getData()); } @Override diff --git a/src/main/java/net/Broken/audio/GetVoiceChanels.java b/src/main/java/net/Broken/audio/GetVoiceChanels.java index 353cf2c..025b8ac 100644 --- a/src/main/java/net/Broken/audio/GetVoiceChanels.java +++ b/src/main/java/net/Broken/audio/GetVoiceChanels.java @@ -1,17 +1,12 @@ package net.Broken.audio; import net.Broken.DB.Entity.GuildPreferenceEntity; -import net.Broken.DB.Repository.GuildPreferenceRepository; -import net.Broken.DB.Repository.UserRepository; -import net.Broken.SpringContext; import net.Broken.Tools.SettingsUtils; -import net.dv8tion.jda.core.entities.Category; -import net.dv8tion.jda.core.entities.Channel; -import net.dv8tion.jda.core.entities.Guild; -import net.dv8tion.jda.core.entities.VoiceChannel; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.GuildChannel; +import net.dv8tion.jda.api.entities.VoiceChannel; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.springframework.context.ApplicationContext; import java.util.ArrayList; import java.util.Comparator; @@ -55,7 +50,7 @@ public class GetVoiceChanels { } - list.sort(Comparator.comparingInt(Channel::getPositionRaw)); + list.sort(Comparator.comparingInt(GuildChannel::getPositionRaw)); return list; diff --git a/src/main/java/net/Broken/audio/GuildMusicManager.java b/src/main/java/net/Broken/audio/GuildMusicManager.java index 0207fa0..d3536a1 100644 --- a/src/main/java/net/Broken/audio/GuildMusicManager.java +++ b/src/main/java/net/Broken/audio/GuildMusicManager.java @@ -2,7 +2,7 @@ package net.Broken.audio; import com.sedmelluq.discord.lavaplayer.player.AudioPlayer; import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager; -import net.dv8tion.jda.core.entities.Guild; +import net.dv8tion.jda.api.entities.Guild; /** * Holder for both the player and a track scheduler for one guild. diff --git a/src/main/java/net/Broken/audio/Playlist/PlaylistManager.java b/src/main/java/net/Broken/audio/Playlist/PlaylistManager.java index 9eeed74..ac26b5a 100644 --- a/src/main/java/net/Broken/audio/Playlist/PlaylistManager.java +++ b/src/main/java/net/Broken/audio/Playlist/PlaylistManager.java @@ -16,7 +16,7 @@ import net.Broken.Tools.UserManager.Exceptions.UnknownTokenException; import net.Broken.Tools.UserManager.UserUtils; import net.Broken.audio.Playlist.Exception.PlaylistNotFoundException; import net.Broken.audio.WebLoadUtils; -import net.dv8tion.jda.core.entities.User; +import net.dv8tion.jda.api.entities.User; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.context.ApplicationContext; diff --git a/src/main/java/net/Broken/audio/TrackScheduler.java b/src/main/java/net/Broken/audio/TrackScheduler.java index 4de5cfe..8ba54b9 100644 --- a/src/main/java/net/Broken/audio/TrackScheduler.java +++ b/src/main/java/net/Broken/audio/TrackScheduler.java @@ -9,7 +9,7 @@ import com.sedmelluq.discord.lavaplayer.track.AudioTrackInfo; import net.Broken.MainBot; import net.Broken.RestApi.Data.UserAudioTrackData; import net.Broken.audio.Youtube.YoutubeTools; -import net.dv8tion.jda.core.entities.Guild; +import net.dv8tion.jda.api.entities.Guild; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/main/java/net/Broken/audio/UserAudioTrack.java b/src/main/java/net/Broken/audio/UserAudioTrack.java index 84df3db..45b53c7 100644 --- a/src/main/java/net/Broken/audio/UserAudioTrack.java +++ b/src/main/java/net/Broken/audio/UserAudioTrack.java @@ -1,7 +1,7 @@ package net.Broken.audio; import com.sedmelluq.discord.lavaplayer.track.AudioTrack; -import net.dv8tion.jda.core.entities.User; +import net.dv8tion.jda.api.entities.User; /** * Container that link AudioTrack to who submit it (User) diff --git a/src/main/java/net/Broken/audio/WebLoadUtils.java b/src/main/java/net/Broken/audio/WebLoadUtils.java index 01c6f94..302450d 100644 --- a/src/main/java/net/Broken/audio/WebLoadUtils.java +++ b/src/main/java/net/Broken/audio/WebLoadUtils.java @@ -7,8 +7,8 @@ import com.sedmelluq.discord.lavaplayer.track.AudioPlaylist; import com.sedmelluq.discord.lavaplayer.track.AudioTrack; import net.Broken.RestApi.Data.CommandPostData; import net.Broken.RestApi.Data.CommandResponseData; -import net.dv8tion.jda.core.entities.Guild; -import net.dv8tion.jda.core.entities.User; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.User; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.http.HttpStatus; diff --git a/src/main/java/net/Broken/webView/GeneralWebView.java b/src/main/java/net/Broken/webView/GeneralWebView.java index 45a2c72..c6fd4a2 100644 --- a/src/main/java/net/Broken/webView/GeneralWebView.java +++ b/src/main/java/net/Broken/webView/GeneralWebView.java @@ -8,8 +8,8 @@ import net.Broken.Tools.UserManager.Exceptions.UnknownTokenException; import net.Broken.Tools.UserManager.Stats.GuildStatsPack; import net.Broken.Tools.UserManager.Stats.UserStatsUtils; import net.Broken.Tools.UserManager.UserUtils; -import net.dv8tion.jda.core.entities.Guild; -import net.dv8tion.jda.core.entities.User; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.User; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; diff --git a/src/main/java/net/Broken/webView/MusicWebView.java b/src/main/java/net/Broken/webView/MusicWebView.java index 05a9804..571dafe 100644 --- a/src/main/java/net/Broken/webView/MusicWebView.java +++ b/src/main/java/net/Broken/webView/MusicWebView.java @@ -6,8 +6,8 @@ import net.Broken.MainBot; import net.Broken.Tools.SettingsUtils; import net.Broken.Tools.UserManager.Exceptions.UnknownTokenException; import net.Broken.Tools.UserManager.UserUtils; -import net.dv8tion.jda.core.entities.Guild; -import net.dv8tion.jda.core.entities.User; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.User; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; diff --git a/src/main/java/net/Broken/webView/MyErrorController.java b/src/main/java/net/Broken/webView/MyErrorController.java index 5f76858..42a8f94 100644 --- a/src/main/java/net/Broken/webView/MyErrorController.java +++ b/src/main/java/net/Broken/webView/MyErrorController.java @@ -1,7 +1,7 @@ package net.Broken.webView; import net.Broken.MainBot; -import net.dv8tion.jda.core.entities.Guild; +import net.dv8tion.jda.api.entities.Guild; import org.springframework.boot.autoconfigure.web.ErrorController; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Controller;