From 25acb234887780938935b5bda8350febdb2a0e32 Mon Sep 17 00:00:00 2001 From: thmsdy Date: Sat, 19 Apr 2025 17:36:00 -0500 Subject: [PATCH] begin update to newer JDA --- .classpath | 8 + .settings/org.eclipse.jdt.core.prefs | 2 + config.properties | 140 ++++++++++++++++++ dependency-reduced-pom.xml | 21 +-- pom.xml | 111 +++++--------- src/main/java/com/fpghoti/biscuit/Main.java | 9 +- .../fpghoti/biscuit/audio/AudioScheduler.java | 2 +- .../biscuit/audio/PlayCommandUtil.java | 6 +- .../biscuit/audio/queue/AudioQueue.java | 2 +- .../biscuit/audio/queue/QueuedTrack.java | 2 +- .../biscuit/audio/request/PlayRequest.java | 6 +- .../request/soundcloud/SCPriorityRequest.java | 4 +- .../audio/request/soundcloud/SCRequest.java | 4 +- .../request/youtube/YTImmediateRequest.java | 3 +- .../request/youtube/YTPriorityRequest.java | 4 +- .../audio/request/youtube/YTRequest.java | 5 +- .../com/fpghoti/biscuit/biscuit/Biscuit.java | 10 +- .../com/fpghoti/biscuit/captcha/Captcha.java | 12 +- .../biscuit/captcha/HandleCaptcha.java | 4 +- .../biscuit/commands/CommandManager.java | 2 +- .../commands/console/GuildSayCommand.java | 3 +- .../biscuit/commands/console/SayCommand.java | 3 +- .../biscuit/commands/discord/AddCommand.java | 3 +- .../commands/discord/ChanIDCommand.java | 2 +- .../commands/discord/DivideCommand.java | 2 +- .../commands/discord/GetConfigCommand.java | 11 +- .../commands/discord/GuildIDCommand.java | 2 +- .../biscuit/commands/discord/HelpCommand.java | 8 +- .../commands/discord/MakeInviteCommand.java | 7 +- .../commands/discord/MultiplyCommand.java | 2 +- .../commands/discord/NotSpammerCommand.java | 4 +- .../biscuit/commands/discord/PingCommand.java | 2 +- .../commands/discord/PowerCommand.java | 2 +- .../discord/RecentSpammersCommand.java | 2 +- .../commands/discord/SaveConfigCommand.java | 8 +- .../commands/discord/SoftMuteCommand.java | 6 +- .../commands/discord/SquareRootCommand.java | 2 +- .../commands/discord/SubtractCommand.java | 2 +- .../commands/discord/ToggleRoleCommand.java | 12 +- .../biscuit/commands/discord/UIDCommand.java | 4 +- .../commands/discord/UnSoftMuteCommand.java | 4 +- .../biscuit/commands/discord/WikiCommand.java | 2 +- .../commands/discord/music/ClearCommand.java | 2 +- .../discord/music/ClearUserSongsCommand.java | 4 +- .../discord/music/ForceSkipCommand.java | 4 +- .../discord/music/ForceSkipToCommand.java | 4 +- .../discord/music/LoopMusicCommand.java | 4 +- .../commands/discord/music/MoveToCommand.java | 2 +- .../discord/music/NowPlayingCommand.java | 4 +- .../commands/discord/music/PauseCommand.java | 4 +- .../discord/music/PlayFirstCommand.java | 5 +- .../commands/discord/music/QueueCommand.java | 12 +- .../commands/discord/music/RemoveCommand.java | 2 +- .../discord/music/ShuffleCommand.java | 4 +- .../discord/music/SkipAllCommand.java | 4 +- .../commands/discord/music/SkipCommand.java | 8 +- .../discord/music/TogglePauseCommand.java | 4 +- .../discord/music/UnpauseCommand.java | 4 +- .../commands/discord/music/VolumeCommand.java | 4 +- .../fpghoti/biscuit/config/BiscuitConfig.java | 6 +- .../biscuit/config/BiscuitProperties.java | 5 + .../biscuit/listener/CommandListener.java | 10 +- .../fpghoti/biscuit/listener/DMListener.java | 2 +- .../listener/MessageDeleteListener.java | 2 +- .../biscuit/listener/MessageEditListener.java | 2 +- .../listener/MessageReceiveListener.java | 12 +- .../biscuit/listener/ReactionListener.java | 10 +- .../fpghoti/biscuit/logging/BiscuitLog.java | 48 ------ .../biscuit/logging/BiscuitLogger.java | 58 ++++++++ .../fpghoti/biscuit/plugin/BiscuitPlugin.java | 4 +- .../com/fpghoti/biscuit/rest/MessageText.java | 4 +- .../com/fpghoti/biscuit/user/CaptchaUser.java | 2 +- .../com/fpghoti/biscuit/util/ChatFilter.java | 4 +- .../java/com/fpghoti/biscuit/util/Util.java | 2 +- src/main/resources/logback.xml | 4 +- 75 files changed, 416 insertions(+), 284 deletions(-) create mode 100644 config.properties delete mode 100644 src/main/java/com/fpghoti/biscuit/logging/BiscuitLog.java create mode 100644 src/main/java/com/fpghoti/biscuit/logging/BiscuitLogger.java diff --git a/.classpath b/.classpath index 2e6518a..a664e84 100644 --- a/.classpath +++ b/.classpath @@ -9,6 +9,7 @@ + @@ -28,5 +29,12 @@ + + + + + + + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index e24b722..9de2ed6 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -7,7 +7,9 @@ org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore org.eclipse.jdt.core.compiler.release=disabled org.eclipse.jdt.core.compiler.source=1.8 diff --git a/config.properties b/config.properties new file mode 100644 index 0000000..ddf57d5 --- /dev/null +++ b/config.properties @@ -0,0 +1,140 @@ +#This doesn't do anything, but is set by the program to help users identify the guild associated with the file +Guild-Identifier = Main Config + +#Change this to redefine the main command signifier character/String +Command-Signifier = - + +#Set to false to disable chat logging +ChatLog = true + +#Automatically places spammers in spam mode +AllowSpamPunish = true + +Channels-To-Not-Chatlog = ignore_me,ignore_me2,ignore_me3 + +#Bot token provided by Discord +Bot-Token = + +#Normal channels will have messages with these words deleted by the bot +NaughtyList = piff,word123,another1 + +#Set to true if you want to limit the channels bot commands can be done in +#Admins will be able to bypass this +Restrict-Cmd-Channels = false + +#Channels to restrict bot commands to +CmdChannels = bot,bot2,bot3 + +#Allow users to toggle these roles +ToggleRoles = role1,role2,role3 + +#Restrict these toggle roles to boosters. Will be removed on boost cancel +Boost-Exclusive-Roles = role2,role3 + +#Treat these roles like booster. +Treat-Like-Booster = Nitro Booster,silver,gold + +#Bot can automatically assign role upon user join +UseCustomDefaultRole = true + +#This role will give Biscuit mod commands to users with the role +ModRole = biscuit-key + +#This role will give complete admin bot access to users with the role +AdminRole = biscuit-admin + +#In these channels, the bot will toggle roles for the ToggleRoles for anyone +#who reacts to a message with [Toggle ] +Toggle-Role-React-Channels = toggleroles1,toggleroles2,toggleroles3 + +#Does nothing if UseCustomDefaultRole is off +DefaultRoleName = Standard + +#Custom Emote to react with when action is complete +Done-Emote = ActionComplete + +#Set true to enable captcha +#Use with UseCustomDefaultRole enabled +#Will require user to have that role for captcha check +#Role will be replaced with reward role on clear +Captcha = false + +#All channels listed here will allow for users in these channels +#to initiate captcha with the bot. +Captcha-Channels = captcha,verification + +#Reward this role when captcha cleared +Captcha-Reward-Role = cleared + +#Kick if Captcha is not completed in a timely manner +No-Captcha-Kick = false + +#Kick user after this number of minutes has passed without captcha clear +#Due to the way the countdown works, the kick may not happen until at most one minute after +No-Captcha-Kick-Time = 10 + +#Messages with these unicode emotes will be removed +Block-Unicode-Emotes = baby,snake,squid + +#Messages with these custom emotes will be removed +Block-Custom-Emotes = badfish,fix,bigleaf + +#Disable these commands for ALL users +DisabledCommands = cmd1,cmd2,cmd3 + +#Disabled these commands for normal users +DisabledUserCommands = cmd4,cmd5,cmd6 + +#Checks which invite users join with. Requires bot to have Manage Server permission. +Check-Join-Invite = false + +#Enables the captcha text-channel logging. +#Logs join, complete captcha, invite joined with, and time-out kick +LogCaptcha = false + +#Put the name of the text channel you want to log captcha information to. +Captcha-Log-Channel = verify-log + +#DM the user before kicking for captcha. +DM-Before-Kick = true + +#Send an invite to the server when dm-ing kicked users +#Does nothing when blank +#Use full link +Kick-DM-Invite = + +#Enable Music Bot functionality. +#This command is for the bot admin only. If disabled, no guild +#Will be allowed to enable and use the Music bot commands. +Enable-Music-Bot = true + +#Individual guild owners can enable/disable this to allow/disallow +#Music bot features in their server. Defaults to the setting +#Set in the main config.properties. This will do nothing if +#Enable-Music-Bot is already set to false. +Allow-Music-Bot = true + +#This logs music player events to the terminal. +#The music player logs may be annoyance. Disable them here. +#Errors will still be logged. +Log-Music-Player = true + +#To restrict music to certain channels, add them here. +#i.e: +#Music-Channels = Room 1, Room 2 +Music-Channels = + +#Users with this role have complete control over the music player. +#Automatically granted to Mods and Admins. +Music-Controller-Role = music-key + +#List your custom commands here. This line will always generate blank. +#Example - Custom-Command-Names = hello,botcheck,apple +Custom-Command-Names = + +#Placeholder(s): +# - Mentions the sender +#Setting up custom commands works like this: +# +#cc-hello-message = Hello, ! +#cc-hello-description = Greets the sender. \ No newline at end of file diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml index b3f3f6d..76ce9d7 100644 --- a/dependency-reduced-pom.xml +++ b/dependency-reduced-pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.fpghoti Biscuit - 1.11 + 1.13 src/main/java @@ -13,20 +13,10 @@ - - maven-compiler-plugin - 3.5.1 - - UTF-8 - 1.8 - 1.8 - - maven-jar-plugin 2.4 - UTF-8 com.fpghoti.biscuit.Main @@ -44,7 +34,6 @@ shade - UTF-8 true @@ -96,13 +85,15 @@ - org.bukkit - bukkit - 1.16.4-R0.1-SNAPSHOT + org.spigotmc + spigot-api + 1.21.4-R0.1-SNAPSHOT provided + 8 + 8 UTF-8 UTF-8 diff --git a/pom.xml b/pom.xml index 1ba2bb3..cad92dd 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,15 @@ 4.0.0 com.fpghoti Biscuit - 1.12 + 2.0 Beta + + + UTF-8 + UTF-8 + 8 + 8 + + src/main/java @@ -15,32 +23,10 @@ - - maven-compiler-plugin - 3.5.1 - - UTF-8 - 1.8 - 1.8 - - - - org.apache.maven.plugins - maven-jar-plugin - 2.4 - - UTF-8 - - - com.fpghoti.biscuit.Main - - - - org.apache.maven.plugins maven-shade-plugin - 3.2.4 + 3.6.0 package @@ -48,38 +34,23 @@ shade - UTF-8 - true - - - org.tuxdude.logback.extensions:logback-colorizer - - ** - - - - commons-logging:commons-logging - - ** - - - + + + com.fpghoti.biscuit.Main + + + + false + - - UTF-8 - UTF-8 - + - - dv8tion - m2-dv8tion - https://m2.dv8tion.net/releases - spigot-repo https://hub.spigotmc.org/nexus/content/repositories/snapshots/ @@ -92,26 +63,17 @@ oss.sonatype.org https://oss.sonatype.org/content/repositories/snapshots/ - - jcenter - jcenter-bintray - https://jcenter.bintray.com - jitpack.io https://jitpack.io + org.fusesource.jansi jansi - 1.18 - - - org.tuxdude.logback.extensions - logback-colorizer - 1.0.1 + 2.4.1 com.github.GhotiMayo @@ -121,43 +83,38 @@ org.apache.commons commons-configuration2 - 2.7 + 2.11.0 - org.bukkit - bukkit - 1.16.4-R0.1-SNAPSHOT + org.spigotmc + spigot-api + 1.21.4-R0.1-SNAPSHOT provided com.squareup.okio okio - 2.4.0 - - - ch.qos.logback - logback-core - 1.2.3 + 3.10.2 ch.qos.logback logback-classic - 1.2.3 + 1.5.17 com.jcabi jcabi-aspects - 0.22.6 + 0.26.0 joda-time joda-time - 2.3 + 2.13.1 net.dv8tion JDA - 5.0.0-alpha.11 + 5.3.0 com.github.cage @@ -175,14 +132,14 @@ 1.4.7 - com.sedmelluq + dev.arbjerg lavaplayer - 1.3.77 + 2.2.3 org.pf4j pf4j - 3.4.1 + 3.13.0 \ No newline at end of file diff --git a/src/main/java/com/fpghoti/biscuit/Main.java b/src/main/java/com/fpghoti/biscuit/Main.java index aff65ab..992f6f3 100644 --- a/src/main/java/com/fpghoti/biscuit/Main.java +++ b/src/main/java/com/fpghoti/biscuit/Main.java @@ -65,7 +65,7 @@ import com.fpghoti.biscuit.listener.NicknameListener; import com.fpghoti.biscuit.listener.ReactionListener; import com.fpghoti.biscuit.listener.RoleListener; import com.fpghoti.biscuit.logging.BColor; -import com.fpghoti.biscuit.logging.BiscuitLog; +import com.fpghoti.biscuit.logging.BiscuitLogger; import com.fpghoti.biscuit.plugin.PluginController; import com.github.cage.Cage; import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager; @@ -90,7 +90,7 @@ public class Main { public RollingFileAppender we; public SizeAndTimeBasedRollingPolicy wes; - private static final BiscuitLog log = new BiscuitLog(); + private static final BiscuitLogger log = new BiscuitLogger(); private static ArrayList biscuits; private static Biscuit mainBiscuit; @@ -224,8 +224,7 @@ public class Main { shardm = DefaultShardManagerBuilder.createDefault(token) .setChunkingFilter(ChunkingFilter.ALL) .setMemberCachePolicy(MemberCachePolicy.ALL) - .enableIntents(GatewayIntent.getIntents(GatewayIntent.DEFAULT)) - .enableIntents(GatewayIntent.GUILD_MEMBERS) + .enableIntents(GatewayIntent.getIntents(GatewayIntent.ALL_INTENTS)) .build(); jda = shardm.getShardById(0); try { @@ -297,7 +296,7 @@ public class Main { return cage; } - public static BiscuitLog getLogger() { + public static BiscuitLogger getLogger() { return log; } diff --git a/src/main/java/com/fpghoti/biscuit/audio/AudioScheduler.java b/src/main/java/com/fpghoti/biscuit/audio/AudioScheduler.java index 52a3bcb..ae5de78 100644 --- a/src/main/java/com/fpghoti/biscuit/audio/AudioScheduler.java +++ b/src/main/java/com/fpghoti/biscuit/audio/AudioScheduler.java @@ -18,7 +18,7 @@ import com.sedmelluq.discord.lavaplayer.track.AudioTrack; import com.sedmelluq.discord.lavaplayer.track.AudioTrackEndReason; import net.dv8tion.jda.api.entities.MessageEmbed; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; public class AudioScheduler extends AudioEventAdapter { diff --git a/src/main/java/com/fpghoti/biscuit/audio/PlayCommandUtil.java b/src/main/java/com/fpghoti/biscuit/audio/PlayCommandUtil.java index d0eab3c..a4d97b8 100644 --- a/src/main/java/com/fpghoti/biscuit/audio/PlayCommandUtil.java +++ b/src/main/java/com/fpghoti/biscuit/audio/PlayCommandUtil.java @@ -4,8 +4,8 @@ import com.fpghoti.biscuit.biscuit.Biscuit; import com.fpghoti.biscuit.rest.MessageText; import net.dv8tion.jda.api.entities.Guild; -import net.dv8tion.jda.api.entities.TextChannel; -import net.dv8tion.jda.api.entities.VoiceChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.VoiceChannel; import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import net.dv8tion.jda.api.managers.AudioManager; @@ -17,7 +17,7 @@ public class PlayCommandUtil { } Guild guild = event.getGuild(); Biscuit biscuit = Biscuit.getBiscuit(guild); - TextChannel textChannel = event.getTextChannel(); + TextChannel textChannel = event.getChannel().asTextChannel(); String vcname = ""; if(!event.getMember().getVoiceState().inAudioChannel()) { diff --git a/src/main/java/com/fpghoti/biscuit/audio/queue/AudioQueue.java b/src/main/java/com/fpghoti/biscuit/audio/queue/AudioQueue.java index 4cc9b6e..d05083a 100644 --- a/src/main/java/com/fpghoti/biscuit/audio/queue/AudioQueue.java +++ b/src/main/java/com/fpghoti/biscuit/audio/queue/AudioQueue.java @@ -8,7 +8,7 @@ import com.fpghoti.biscuit.rest.MessageText; import com.sedmelluq.discord.lavaplayer.track.AudioTrack; import net.dv8tion.jda.api.entities.MessageEmbed; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; public class AudioQueue { diff --git a/src/main/java/com/fpghoti/biscuit/audio/queue/QueuedTrack.java b/src/main/java/com/fpghoti/biscuit/audio/queue/QueuedTrack.java index 8a4ea76..d4634b9 100644 --- a/src/main/java/com/fpghoti/biscuit/audio/queue/QueuedTrack.java +++ b/src/main/java/com/fpghoti/biscuit/audio/queue/QueuedTrack.java @@ -10,7 +10,7 @@ import com.sedmelluq.discord.lavaplayer.track.AudioTrack; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.MessageEmbed; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; public class QueuedTrack { diff --git a/src/main/java/com/fpghoti/biscuit/audio/request/PlayRequest.java b/src/main/java/com/fpghoti/biscuit/audio/request/PlayRequest.java index 5068ba8..213c4ec 100644 --- a/src/main/java/com/fpghoti/biscuit/audio/request/PlayRequest.java +++ b/src/main/java/com/fpghoti/biscuit/audio/request/PlayRequest.java @@ -8,7 +8,7 @@ import com.fpghoti.biscuit.audio.request.youtube.YTRequest; import com.fpghoti.biscuit.biscuit.Biscuit; import net.dv8tion.jda.api.entities.Message; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; public abstract class PlayRequest { @@ -42,7 +42,7 @@ public abstract class PlayRequest { case YOUTUBE_PRIORITY: return new YTPriorityRequest(message, searchPhrase, insertSlot); case YOUTUBE_IMMEDIATE: - return new YTImmediateRequest(message.getTextChannel(), message.getAuthor().getId(), searchPhrase); + return new YTImmediateRequest(message.getChannel().asTextChannel(), message.getAuthor().getId(), searchPhrase); case SOUNDCLOUD: return new SCRequest(message, searchPhrase); case SOUNDCLOUD_PRIORITY: @@ -58,7 +58,7 @@ public abstract class PlayRequest { private String identifier; public PlayRequest(Message message, String identifier) { - this(message.getTextChannel(), message.getAuthor().getId(), identifier); + this(message.getChannel().asTextChannel(), message.getAuthor().getId(), identifier); } public PlayRequest(TextChannel channel, String authorId, String identifier) { diff --git a/src/main/java/com/fpghoti/biscuit/audio/request/soundcloud/SCPriorityRequest.java b/src/main/java/com/fpghoti/biscuit/audio/request/soundcloud/SCPriorityRequest.java index 70af567..956a185 100644 --- a/src/main/java/com/fpghoti/biscuit/audio/request/soundcloud/SCPriorityRequest.java +++ b/src/main/java/com/fpghoti/biscuit/audio/request/soundcloud/SCPriorityRequest.java @@ -3,14 +3,14 @@ package com.fpghoti.biscuit.audio.request.soundcloud; import com.fpghoti.biscuit.audio.request.RequestType; import net.dv8tion.jda.api.entities.Message; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; public class SCPriorityRequest extends SCRequest{ int insertSlot; public SCPriorityRequest(Message message, String identifier, int insertSlot) { - this(message.getTextChannel(), message.getAuthor().getId(), identifier, insertSlot); + this(message.getChannel().asTextChannel(), message.getAuthor().getId(), identifier, insertSlot); } public SCPriorityRequest(TextChannel channel, String authorId, String identifier, int insertSlot) { diff --git a/src/main/java/com/fpghoti/biscuit/audio/request/soundcloud/SCRequest.java b/src/main/java/com/fpghoti/biscuit/audio/request/soundcloud/SCRequest.java index a6d8cf0..8826756 100644 --- a/src/main/java/com/fpghoti/biscuit/audio/request/soundcloud/SCRequest.java +++ b/src/main/java/com/fpghoti/biscuit/audio/request/soundcloud/SCRequest.java @@ -4,14 +4,14 @@ import com.fpghoti.biscuit.audio.request.PlayRequest; import com.fpghoti.biscuit.audio.request.RequestType; import net.dv8tion.jda.api.entities.Message; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; public class SCRequest extends PlayRequest{ private boolean searchMode; public SCRequest(Message message, String identifier) { - this(message.getTextChannel(), message.getAuthor().getId(), identifier); + this(message.getChannel().asTextChannel(), message.getAuthor().getId(), identifier); } public SCRequest(TextChannel channel, String authorId, String identifier) { diff --git a/src/main/java/com/fpghoti/biscuit/audio/request/youtube/YTImmediateRequest.java b/src/main/java/com/fpghoti/biscuit/audio/request/youtube/YTImmediateRequest.java index 8c6507f..11767fe 100644 --- a/src/main/java/com/fpghoti/biscuit/audio/request/youtube/YTImmediateRequest.java +++ b/src/main/java/com/fpghoti/biscuit/audio/request/youtube/YTImmediateRequest.java @@ -3,7 +3,8 @@ package com.fpghoti.biscuit.audio.request.youtube; import com.fpghoti.biscuit.audio.request.RequestType; import net.dv8tion.jda.api.entities.Message; -import net.dv8tion.jda.api.entities.TextChannel; +//import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; public class YTImmediateRequest extends YTRequest{ diff --git a/src/main/java/com/fpghoti/biscuit/audio/request/youtube/YTPriorityRequest.java b/src/main/java/com/fpghoti/biscuit/audio/request/youtube/YTPriorityRequest.java index 487a542..d2fcbf1 100644 --- a/src/main/java/com/fpghoti/biscuit/audio/request/youtube/YTPriorityRequest.java +++ b/src/main/java/com/fpghoti/biscuit/audio/request/youtube/YTPriorityRequest.java @@ -3,14 +3,14 @@ package com.fpghoti.biscuit.audio.request.youtube; import com.fpghoti.biscuit.audio.request.RequestType; import net.dv8tion.jda.api.entities.Message; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; public class YTPriorityRequest extends YTRequest{ int insertSlot; public YTPriorityRequest(Message message, String identifier, int insertSlot) { - this(message.getTextChannel(), message.getAuthor().getId(), identifier, insertSlot); + this(message.getChannel().asTextChannel(), message.getAuthor().getId(), identifier, insertSlot); } public YTPriorityRequest(TextChannel channel, String authorId, String identifier, int insertSlot) { diff --git a/src/main/java/com/fpghoti/biscuit/audio/request/youtube/YTRequest.java b/src/main/java/com/fpghoti/biscuit/audio/request/youtube/YTRequest.java index 9783442..e630826 100644 --- a/src/main/java/com/fpghoti/biscuit/audio/request/youtube/YTRequest.java +++ b/src/main/java/com/fpghoti/biscuit/audio/request/youtube/YTRequest.java @@ -4,14 +4,15 @@ import com.fpghoti.biscuit.audio.request.PlayRequest; import com.fpghoti.biscuit.audio.request.RequestType; import net.dv8tion.jda.api.entities.Message; -import net.dv8tion.jda.api.entities.TextChannel; +//import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; public class YTRequest extends PlayRequest{ private boolean searchMode; public YTRequest(Message message, String identifier) { - this(message.getTextChannel(), message.getAuthor().getId(), identifier); + this(message.getChannel().asTextChannel(), message.getAuthor().getId(), identifier); } public YTRequest(TextChannel channel, String authorId, String identifier) { diff --git a/src/main/java/com/fpghoti/biscuit/biscuit/Biscuit.java b/src/main/java/com/fpghoti/biscuit/biscuit/Biscuit.java index e396c34..02b223b 100644 --- a/src/main/java/com/fpghoti/biscuit/biscuit/Biscuit.java +++ b/src/main/java/com/fpghoti/biscuit/biscuit/Biscuit.java @@ -13,7 +13,7 @@ import com.fpghoti.biscuit.audio.AudioScheduler; import com.fpghoti.biscuit.config.BiscuitConfig; import com.fpghoti.biscuit.config.BiscuitProperties; import com.fpghoti.biscuit.logging.BColor; -import com.fpghoti.biscuit.logging.BiscuitLog; +import com.fpghoti.biscuit.logging.BiscuitLogger; import com.fpghoti.biscuit.rest.MessageText; import com.fpghoti.biscuit.timer.BiscuitTimer; import com.fpghoti.biscuit.timer.task.ChatCountTimer; @@ -29,9 +29,11 @@ import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.Invite; import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Role; -import net.dv8tion.jda.api.entities.TextChannel; +//import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.entities.User; + public class Biscuit { public static Biscuit getBiscuit(Guild g) { @@ -77,7 +79,7 @@ public class Biscuit { private boolean isMain; private JDA jda; - private BiscuitLog logger; + private BiscuitLogger logger; private Timer timer; private List timers; private File captchaDir; @@ -93,7 +95,7 @@ public class Biscuit { private CopyOnWriteArrayList users = new CopyOnWriteArrayList(); private HashMap rolequeue; - public Biscuit(JDA jda, Guild guild, BiscuitLog log) { + public Biscuit(JDA jda, Guild guild, BiscuitLogger log) { this.jda = jda; this.guild = guild; this.logger = log; diff --git a/src/main/java/com/fpghoti/biscuit/captcha/Captcha.java b/src/main/java/com/fpghoti/biscuit/captcha/Captcha.java index 559f60f..e3b4bdf 100644 --- a/src/main/java/com/fpghoti/biscuit/captcha/Captcha.java +++ b/src/main/java/com/fpghoti/biscuit/captcha/Captcha.java @@ -17,10 +17,11 @@ import com.github.cage.Cage; import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.Member; -import net.dv8tion.jda.api.entities.MessageChannel; -import net.dv8tion.jda.api.entities.PrivateChannel; import net.dv8tion.jda.api.entities.Role; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.PrivateChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; +import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel; +import net.dv8tion.jda.api.utils.FileUpload; import net.dv8tion.jda.api.entities.User; public class Captcha { @@ -102,10 +103,11 @@ public class Captcha { genToken(); generateImage(); File captcha = getImageFile(); + FileUpload capUpload = FileUpload.fromData(captcha); respond("Respond with the exact text in this image."); - channel.sendFile(captcha).submit(); - + //channel.sendFile(captcha).submit(); + channel.sendFiles(capUpload); }else { boolean disable = false; if(captchaUser.inTestMode()) { diff --git a/src/main/java/com/fpghoti/biscuit/captcha/HandleCaptcha.java b/src/main/java/com/fpghoti/biscuit/captcha/HandleCaptcha.java index 1bbba76..5d5550c 100644 --- a/src/main/java/com/fpghoti/biscuit/captcha/HandleCaptcha.java +++ b/src/main/java/com/fpghoti/biscuit/captcha/HandleCaptcha.java @@ -8,9 +8,9 @@ import com.fpghoti.biscuit.util.PermUtil; import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.Member; -import net.dv8tion.jda.api.entities.MessageChannel; -import net.dv8tion.jda.api.entities.TextChannel; import net.dv8tion.jda.api.entities.User; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; +import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel; public class HandleCaptcha { diff --git a/src/main/java/com/fpghoti/biscuit/commands/CommandManager.java b/src/main/java/com/fpghoti/biscuit/commands/CommandManager.java index 8180506..64ad4fc 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/CommandManager.java +++ b/src/main/java/com/fpghoti/biscuit/commands/CommandManager.java @@ -120,7 +120,7 @@ public class CommandManager { public static void commandReply(MessageReceivedEvent event, String msg) { if(event != null) { - MessageText.send(event.getTextChannel(), msg); + MessageText.send(event.getChannel().asTextChannel(), msg); }else { Main.getLogger().info(msg); } diff --git a/src/main/java/com/fpghoti/biscuit/commands/console/GuildSayCommand.java b/src/main/java/com/fpghoti/biscuit/commands/console/GuildSayCommand.java index 37e4ea0..8046de2 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/console/GuildSayCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/console/GuildSayCommand.java @@ -6,7 +6,8 @@ import com.fpghoti.biscuit.commands.base.ConsoleCommand; import com.fpghoti.biscuit.rest.MessageText; import net.dv8tion.jda.api.entities.Guild; -import net.dv8tion.jda.api.entities.TextChannel; +//import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; public class GuildSayCommand extends ConsoleCommand{ diff --git a/src/main/java/com/fpghoti/biscuit/commands/console/SayCommand.java b/src/main/java/com/fpghoti/biscuit/commands/console/SayCommand.java index b73b7a9..5a077fa 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/console/SayCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/console/SayCommand.java @@ -6,7 +6,8 @@ import com.fpghoti.biscuit.commands.base.ConsoleCommand; import com.fpghoti.biscuit.rest.MessageText; import net.dv8tion.jda.api.entities.Guild; -import net.dv8tion.jda.api.entities.TextChannel; +//import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; public class SayCommand extends ConsoleCommand{ diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/AddCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/AddCommand.java index d581cfe..4fe5959 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/AddCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/AddCommand.java @@ -6,6 +6,7 @@ import com.fpghoti.biscuit.commands.base.ClientCommand; import com.fpghoti.biscuit.rest.MessageText; import com.fpghoti.biscuit.util.Util; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.events.message.MessageReceivedEvent; public class AddCommand extends ClientCommand{ @@ -31,7 +32,7 @@ public class AddCommand extends ClientCommand{ if(end.equals(".0")) { sum = sum.replace(".0",""); } - MessageText.send(event.getTextChannel(), args[0] + " + " + args[1] + " is **" + sum + "**."); + MessageText.send(event.getChannel().asTextChannel(), args[0] + " + " + args[1] + " is **" + sum + "**."); } } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/ChanIDCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/ChanIDCommand.java index 44f2989..3b6d548 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/ChanIDCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/ChanIDCommand.java @@ -23,7 +23,7 @@ public class ChanIDCommand extends ClientCommand{ Biscuit b = Biscuit.getBiscuit(event.getGuild()); b.log(event.getAuthor().getName() + " issued a command: -chanid"); String id = event.getChannel().getId(); - MessageText.send(event.getTextChannel(), id); + MessageText.send(event.getChannel().asTextChannel(), id); } } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/DivideCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/DivideCommand.java index f7ee797..96244fb 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/DivideCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/DivideCommand.java @@ -32,7 +32,7 @@ public class DivideCommand extends ClientCommand{ if(end.equals(".0")) { divide = divide.replace(".0",""); } - MessageText.send(event.getTextChannel(), args[0] + " / " + args[1] + " is **" + divide + "**."); + MessageText.send(event.getChannel().asTextChannel(), args[0] + " / " + args[1] + " is **" + divide + "**."); } } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/GetConfigCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/GetConfigCommand.java index b27ffa8..8c59f60 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/GetConfigCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/GetConfigCommand.java @@ -1,5 +1,7 @@ package com.fpghoti.biscuit.commands.discord; +import java.io.File; + import com.fpghoti.biscuit.Main; import com.fpghoti.biscuit.biscuit.Biscuit; import com.fpghoti.biscuit.commands.base.ClientCommand; @@ -8,6 +10,7 @@ import com.fpghoti.biscuit.rest.MessageText; import com.fpghoti.biscuit.util.PermUtil; import net.dv8tion.jda.api.events.message.MessageReceivedEvent; +import net.dv8tion.jda.api.utils.FileUpload; public class GetConfigCommand extends ClientCommand{ @@ -25,10 +28,14 @@ public class GetConfigCommand extends ClientCommand{ Biscuit b = Biscuit.getBiscuit(event.getGuild()); b.log(event.getAuthor().getName() + " issued a command: -getconfig"); if(PermUtil.isAdmin(event.getMember())) { - event.getChannel().sendFile(b.getConfig().getFile(), "config-" + b.getProperties().getGuildCode() + ".properties").queue(); + File config = b.getConfig().getFile(); + FileUpload confUpload = FileUpload.fromData(config); + confUpload.setName("config-" + b.getProperties().getGuildCode() + ".properties"); + //event.getChannel().sendFile(config, "config-" + b.getProperties().getGuildCode() + ".properties").queue(); + event.getChannel().asTextChannel().sendFiles(confUpload); }else { b.log(BColor.MAGENTA_BOLD + event.getAuthor().getName() + " lacks permission to view the config!"); - MessageText.sendTimed(event.getTextChannel(), event.getAuthor().getAsMention() + " You do not have " + MessageText.sendTimed(event.getChannel().asTextChannel(), event.getAuthor().getAsMention() + " You do not have " + "permission to view the config.", 5); } } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/GuildIDCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/GuildIDCommand.java index 8bb0fd0..62b508b 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/GuildIDCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/GuildIDCommand.java @@ -25,7 +25,7 @@ public class GuildIDCommand extends ClientCommand{ Biscuit b = Biscuit.getBiscuit(event.getGuild()); b.log(event.getAuthor().getName() + " issued a command: -guildid"); if(PermUtil.isMod(event.getMember())) { - MessageText.send(event.getTextChannel(), event.getGuild().getId()); + MessageText.send(event.getChannel().asTextChannel(), event.getGuild().getId()); } } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/HelpCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/HelpCommand.java index 64a99aa..07769cc 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/HelpCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/HelpCommand.java @@ -36,7 +36,7 @@ public class HelpCommand extends ClientCommand { if(Util.isDigit(args[0])) { pg = Integer.parseInt(args[0]); }else { - MessageText.send(event.getTextChannel(), "Usage: ``" + usage + "``"); + MessageText.send(event.getChannel().asTextChannel(), "Usage: ``" + usage + "``"); } } List commands = new ArrayList(); @@ -66,8 +66,8 @@ public class HelpCommand extends ClientCommand { pg = pageCount; } - MessageText.send(event.getTextChannel(), "**Use " + Main.getMainBiscuit().getProperties().getCommandSignifier() + "help [Page #] to navigate the different pages.**"); - MessageText.send(event.getTextChannel(), "[" + Integer.toString(pg) + "/" + Integer.toString(pageCount) + "] **Bot Commands:**"); + MessageText.send(event.getChannel().asTextChannel(), "**Use " + Main.getMainBiscuit().getProperties().getCommandSignifier() + "help [Page #] to navigate the different pages.**"); + MessageText.send(event.getChannel().asTextChannel(), "[" + Integer.toString(pg) + "/" + Integer.toString(pageCount) + "] **Bot Commands:**"); String msg = ""; for (int i = 0; i < 8; i++) { int index = (pg - 1) * 8 + i; @@ -82,7 +82,7 @@ public class HelpCommand extends ClientCommand { msg = msg + line; } } - MessageText.send(event.getTextChannel(), msg); + MessageText.send(event.getChannel().asTextChannel(), msg); } } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/MakeInviteCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/MakeInviteCommand.java index 388cdfa..a6aa522 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/MakeInviteCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/MakeInviteCommand.java @@ -8,7 +8,8 @@ import com.fpghoti.biscuit.util.PermUtil; import com.fpghoti.biscuit.util.Util; import net.dv8tion.jda.api.entities.Guild; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; +//import net.dv8tion.jda.api.entities.TextChannel; import net.dv8tion.jda.api.events.message.MessageReceivedEvent; public class MakeInviteCommand extends ClientCommand{ @@ -40,7 +41,7 @@ public class MakeInviteCommand extends ClientCommand{ } } if(doubAge > 86400) { - MessageText.send(event.getTextChannel(), "That length is longer than what Discord allows. Please try again. (Max 24 hours)"); + MessageText.send(event.getChannel().asTextChannel(), "That length is longer than what Discord allows. Please try again. (Max 24 hours)"); return; } final double db = doubAge; @@ -50,7 +51,7 @@ public class MakeInviteCommand extends ClientCommand{ if(db > 0) { exp = args[1] + " hour(s)"; } - MessageText.send(event.getTextChannel(), "Created invite **" + i.getCode() + "** Expiration: **" + exp + "**."); + MessageText.send(event.getChannel().asTextChannel(), "Created invite **" + i.getCode() + "** Expiration: **" + exp + "**."); }); } } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/MultiplyCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/MultiplyCommand.java index 519d99e..467f390 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/MultiplyCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/MultiplyCommand.java @@ -32,7 +32,7 @@ public class MultiplyCommand extends ClientCommand{ if(end.equals(".0")) { prod = prod.replace(".0",""); } - MessageText.send(event.getTextChannel(), args[0] + " x " + args[1] + " is **" + prod + "**."); + MessageText.send(event.getChannel().asTextChannel(), args[0] + " x " + args[1] + " is **" + prod + "**."); } } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/NotSpammerCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/NotSpammerCommand.java index 8be36f7..9e3af8f 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/NotSpammerCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/NotSpammerCommand.java @@ -25,12 +25,12 @@ public class NotSpammerCommand extends ClientCommand{ public void execute(String[] args, MessageReceivedEvent event) { Biscuit b = Biscuit.getBiscuit(event.getGuild()); b.log(event.getAuthor().getName() + " issued a command: -notspammer " + args[0]); - for(Member m : event.getMessage().getMentionedMembers()){ + for(Member m : event.getMessage().getMentions().getMembers()){ User u = m.getUser(); String s = u.getAsMention(); if(event.getChannel().getName().equals("public-spam-test") || (PermUtil.isMod(event.getMember()))) { b.getMessageStore().removeSpammer(u); - MessageText.send(event.getTextChannel(), s + " is no longer flagged as spam."); + MessageText.send(event.getChannel().asTextChannel(), s + " is no longer flagged as spam."); } } } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/PingCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/PingCommand.java index 9a1688e..81242c8 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/PingCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/PingCommand.java @@ -22,7 +22,7 @@ public class PingCommand extends ClientCommand{ public void execute(String[] args, MessageReceivedEvent event) { Biscuit b = Biscuit.getBiscuit(event.getGuild()); b.log(event.getAuthor().getName() + " issued a command: -ping"); - MessageText.send(event.getTextChannel(), "Pong!"); + MessageText.send(event.getChannel().asTextChannel(), "Pong!"); } } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/PowerCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/PowerCommand.java index 3040f17..ca30b37 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/PowerCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/PowerCommand.java @@ -32,7 +32,7 @@ public class PowerCommand extends ClientCommand{ if(end.equals(".0")) { pow = pow.replace(".0",""); } - MessageText.send(event.getTextChannel(), args[0] + "^" + args[1] + " is **" + pow + "**."); + MessageText.send(event.getChannel().asTextChannel(), args[0] + "^" + args[1] + " is **" + pow + "**."); } } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/RecentSpammersCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/RecentSpammersCommand.java index 5b7dbd9..8025194 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/RecentSpammersCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/RecentSpammersCommand.java @@ -23,7 +23,7 @@ public class RecentSpammersCommand extends ClientCommand{ Biscuit b = Biscuit.getBiscuit(event.getGuild()); b.log(event.getAuthor().getName() + " issued a command: -recentspammers"); String msg = b.getMessageStore().getSpammerList(); - MessageText.send(event.getTextChannel(), msg); + MessageText.send(event.getChannel().asTextChannel(), msg); } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/SaveConfigCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/SaveConfigCommand.java index e330c04..f60af56 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/SaveConfigCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/SaveConfigCommand.java @@ -32,21 +32,21 @@ public class SaveConfigCommand extends ClientCommand{ if(!attch.isEmpty()) { if(attch.size() == 1) { for(Attachment a : attch) { - b.getConfig().replaceConfig(a, event.getTextChannel()); + b.getConfig().replaceConfig(a, event.getChannel().asTextChannel()); b.remove(); b = Biscuit.loadGuild(event.getGuild()); } }else { - MessageText.sendTimed(event.getTextChannel(), event.getAuthor().getAsMention() + " Too many attachments added! " + MessageText.sendTimed(event.getChannel().asTextChannel(), event.getAuthor().getAsMention() + " Too many attachments added! " + "Please only include the config file you want to save.", 5); } }else { - MessageText.sendTimed(event.getTextChannel(), event.getAuthor().getAsMention() + " You need to send " + MessageText.sendTimed(event.getChannel().asTextChannel(), event.getAuthor().getAsMention() + " You need to send " + "a file in order to save the config.", 5); } }else { b.log(BColor.MAGENTA_BOLD + event.getAuthor().getName() + " lacks permission to save the config!"); - MessageText.sendTimed(event.getTextChannel(), event.getAuthor().getAsMention() + " You do not have " + MessageText.sendTimed(event.getChannel().asTextChannel(), event.getAuthor().getAsMention() + " You do not have " + "permission to save the config.", 5); } } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/SoftMuteCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/SoftMuteCommand.java index 8f2c156..fd4d0d1 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/SoftMuteCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/SoftMuteCommand.java @@ -25,17 +25,17 @@ public class SoftMuteCommand extends ClientCommand{ public void execute(String[] args, MessageReceivedEvent event) { Biscuit b = Biscuit.getBiscuit(event.getGuild()); b.log(event.getAuthor().getName() + " issued a command: -softmute " + args[0]); - for(Member m : event.getMessage().getMentionedMembers()){ + for(Member m : event.getMessage().getMentions().getMembers()){ User u = m.getUser(); String s = u.getAsMention(); if(b.getMessageStore().isSoftmuted(u)) { - MessageText.sendTimed(event.getTextChannel(), s + " is already softmuted.", 3); + MessageText.sendTimed(event.getChannel().asTextChannel(), s + " is already softmuted.", 3); return; } if(event.getChannel().getName().equals("public-softmute-test") || (PermUtil.isMod(event.getMember()))) { b.getMessageStore().addSoftmuted(u); u.openPrivateChannel().queue(); - MessageText.send(event.getTextChannel(), s + " is now soft-muted. They will now be only able to send one message every two minutes."); + MessageText.send(event.getChannel().asTextChannel(), s + " is now soft-muted. They will now be only able to send one message every two minutes."); } } } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/SquareRootCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/SquareRootCommand.java index e1444dd..5c46ebb 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/SquareRootCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/SquareRootCommand.java @@ -31,7 +31,7 @@ public class SquareRootCommand extends ClientCommand{ if(end.equals(".0")) { root = root.replace(".0",""); } - MessageText.send(event.getTextChannel(), "The sqaure root of " + args[0] + " is **" + root + "**."); + MessageText.send(event.getChannel().asTextChannel(), "The sqaure root of " + args[0] + " is **" + root + "**."); } } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/SubtractCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/SubtractCommand.java index 4541949..327715f 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/SubtractCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/SubtractCommand.java @@ -32,7 +32,7 @@ public class SubtractCommand extends ClientCommand{ if(end.equals(".0")) { sub = sub.replace(".0",""); } - MessageText.send(event.getTextChannel(), args[0] + " - " + args[1] + " is **" + sub + "**."); + MessageText.send(event.getChannel().asTextChannel(), args[0] + " - " + args[1] + " is **" + sub + "**."); } } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/ToggleRoleCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/ToggleRoleCommand.java index 3555496..41cd24e 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/ToggleRoleCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/ToggleRoleCommand.java @@ -6,8 +6,9 @@ import com.fpghoti.biscuit.commands.base.ClientCommand; import com.fpghoti.biscuit.rest.MessageText; import com.fpghoti.biscuit.util.PermUtil; -import net.dv8tion.jda.api.entities.Emote; import net.dv8tion.jda.api.entities.Role; +import net.dv8tion.jda.api.entities.emoji.Emoji; +import net.dv8tion.jda.api.entities.emoji.EmojiUnion; import net.dv8tion.jda.api.events.message.MessageReceivedEvent; public class ToggleRoleCommand extends ClientCommand{ @@ -38,7 +39,7 @@ public class ToggleRoleCommand extends ClientCommand{ } if(rolename.equals("")) { - MessageText.send(event.getTextChannel(), "Sorry! This role either cannot be toggled or does not exist!"); + MessageText.send(event.getChannel().asTextChannel(), "Sorry! This role either cannot be toggled or does not exist!"); return; } @@ -53,8 +54,8 @@ public class ToggleRoleCommand extends ClientCommand{ return; } - Emote done = null; - for(Emote e : event.getGuild().getEmotes()) { + Emoji done = null; + for(Emoji e : event.getMessage().getMentions().getCustomEmojis()) { if(e.getName().contains(b.getProperties().getDoneEmote())) { done = e; } @@ -80,7 +81,8 @@ public class ToggleRoleCommand extends ClientCommand{ if(foundEmote) { event.getMessage().addReaction(done).queue(); }else { - event.getMessage().addReaction("✔").queue(); + //event.getMessage().addReaction("✔").queue(); + event.getMessage().addReaction(Emoji.fromFormatted("U+2714")).queue(); } } } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/UIDCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/UIDCommand.java index a7c92e6..30f1038 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/UIDCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/UIDCommand.java @@ -25,10 +25,10 @@ public class UIDCommand extends ClientCommand{ public void execute(String[] args, MessageReceivedEvent event) { Biscuit b = Biscuit.getBiscuit(event.getGuild()); b.log(event.getAuthor().getName() + " issued a command: -uid " + args[0]); - for(Member m : event.getMessage().getMentionedMembers()){ + for(Member m : event.getMessage().getMentions().getMembers()){ User u = m.getUser(); if(PermUtil.isMod(event.getMember())) { - MessageText.send(event.getTextChannel(), u.getId()); + MessageText.send(event.getChannel().asTextChannel(), u.getId()); } } } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/UnSoftMuteCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/UnSoftMuteCommand.java index 7997663..0696d40 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/UnSoftMuteCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/UnSoftMuteCommand.java @@ -25,12 +25,12 @@ public class UnSoftMuteCommand extends ClientCommand{ public void execute(String[] args, MessageReceivedEvent event) { Biscuit b = Biscuit.getBiscuit(event.getGuild()); b.log(event.getAuthor().getName() + " issued a command: -unsoftmute " + args[0]); - for(Member m : event.getMessage().getMentionedMembers()){ + for(Member m : event.getMessage().getMentions().getMembers()){ User u = m.getUser(); String s = u.getAsMention(); if(event.getChannel().getName().equals("public-softmute-test") || (PermUtil.isMod(event.getMember()))) { b.getMessageStore().removeSoftmuted(u); - MessageText.send(event.getTextChannel(), s + " is no longer soft-muted."); + MessageText.send(event.getChannel().asTextChannel(), s + " is no longer soft-muted."); } } } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/WikiCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/WikiCommand.java index 47ad640..ba4ef07 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/WikiCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/WikiCommand.java @@ -24,7 +24,7 @@ public class WikiCommand extends ClientCommand{ Biscuit b = Biscuit.getBiscuit(event.getGuild()); b.log(event.getAuthor().getName() + " issued a command: -wiki"); if(PermUtil.isMod(event.getMember())) { - MessageText.send(event.getTextChannel(), "https://git.fpghoti.com/thmsdy/Biscuit/wiki"); + MessageText.send(event.getChannel().asTextChannel(), "https://git.fpghoti.com/thmsdy/Biscuit/wiki"); } } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/music/ClearCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/music/ClearCommand.java index 126d87c..41178e0 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/music/ClearCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/music/ClearCommand.java @@ -24,7 +24,7 @@ public class ClearCommand extends MusicClientCommand{ Biscuit b = Biscuit.getBiscuit(event.getGuild()); b.log(event.getAuthor().getName() + " issued a command: -clear"); if(PermUtil.hasMusicControl(event.getMember())) { - MessageText.send(event.getTextChannel(), "Cleared all upcoming songs from the queue."); + MessageText.send(event.getChannel().asTextChannel(), "Cleared all upcoming songs from the queue."); b.getAudioScheduler().getQueue().clear(); } } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/music/ClearUserSongsCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/music/ClearUserSongsCommand.java index 7922465..37e89da 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/music/ClearUserSongsCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/music/ClearUserSongsCommand.java @@ -26,8 +26,8 @@ public class ClearUserSongsCommand extends MusicClientCommand{ Biscuit b = Biscuit.getBiscuit(event.getGuild()); b.log(event.getAuthor().getName() + " issued a command: -clearusersongs " + args[0]); if(PermUtil.hasMusicControl(event.getMember())) { - for(Member m : event.getMessage().getMentionedMembers()) { - MessageText.send(event.getTextChannel(), "Clearing all upcoming tracks added by **" + m.getEffectiveName() + "**."); + for(Member m : event.getMessage().getMentions().getMembers()) { + MessageText.send(event.getChannel().asTextChannel(), "Clearing all upcoming tracks added by **" + m.getEffectiveName() + "**."); b.getAudioScheduler().getQueue().removeUserTracks(m.getId()); } } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/music/ForceSkipCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/music/ForceSkipCommand.java index 549968d..c880535 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/music/ForceSkipCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/music/ForceSkipCommand.java @@ -24,8 +24,8 @@ public class ForceSkipCommand extends MusicClientCommand{ Biscuit b = Biscuit.getBiscuit(event.getGuild()); b.log(event.getAuthor().getName() + " issued a command: -forceskip"); if(PermUtil.hasMusicControl(event.getMember())) { - MessageText.send(event.getTextChannel(), "Force skipping current song."); - b.getAudioScheduler().skip(event.getTextChannel()); + MessageText.send(event.getChannel().asTextChannel(), "Force skipping current song."); + b.getAudioScheduler().skip(event.getChannel().asTextChannel()); } } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/music/ForceSkipToCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/music/ForceSkipToCommand.java index 958649d..41c1605 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/music/ForceSkipToCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/music/ForceSkipToCommand.java @@ -28,9 +28,9 @@ public class ForceSkipToCommand extends MusicClientCommand{ if(PermUtil.hasMusicControl(event.getMember())) { if(Util.isDigit(args[0])) { int place = Integer.parseInt(args[0]); - MessageText.send(event.getTextChannel(), "Force skipping to queue position **" + place + "**."); + MessageText.send(event.getChannel().asTextChannel(), "Force skipping to queue position **" + place + "**."); b.getAudioScheduler().getQueue().removeTracksBefore(place); - b.getAudioScheduler().skip(event.getTextChannel()); + b.getAudioScheduler().skip(event.getChannel().asTextChannel()); } } } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/music/LoopMusicCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/music/LoopMusicCommand.java index d16a935..2c67b4c 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/music/LoopMusicCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/music/LoopMusicCommand.java @@ -25,10 +25,10 @@ public class LoopMusicCommand extends MusicClientCommand{ b.log(event.getAuthor().getName() + " issued a command: -loopmusic"); if(PermUtil.hasMusicControl(event.getMember())) { if(!b.getAudioScheduler().isLooping()) { - MessageText.send(event.getTextChannel(), "Setting all music to loop."); + MessageText.send(event.getChannel().asTextChannel(), "Setting all music to loop."); b.getAudioScheduler().setLooping(true); }else { - MessageText.send(event.getTextChannel(), "Disabling music looping."); + MessageText.send(event.getChannel().asTextChannel(), "Disabling music looping."); b.getAudioScheduler().setLooping(false); } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/music/MoveToCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/music/MoveToCommand.java index 637783f..5b6aceb 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/music/MoveToCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/music/MoveToCommand.java @@ -28,7 +28,7 @@ public class MoveToCommand extends MusicClientCommand{ if(Util.isDigit(args[0]) && Util.isDigit(args[1])) { int oldPlace = Integer.parseInt(args[0]); int newPlace = Integer.parseInt(args[1]); - MessageText.send(event.getTextChannel(), "The specified track was moved." ); + MessageText.send(event.getChannel().asTextChannel(), "The specified track was moved." ); b.getAudioScheduler().getQueue().moveToPlace(oldPlace, newPlace); } } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/music/NowPlayingCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/music/NowPlayingCommand.java index 102050a..74c8af2 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/music/NowPlayingCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/music/NowPlayingCommand.java @@ -25,9 +25,9 @@ public class NowPlayingCommand extends MusicClientCommand{ b.log(event.getAuthor().getName() + " issued a command: -nowplaying"); if(b.getAudioScheduler().getQueue().getLastTrack() != null ) { MessageEmbed next = b.getAudioScheduler().getQueue().getLastTrack().getEmbedMessage("Now Playing:", true); - MessageText.send(event.getTextChannel(), next); + MessageText.send(event.getChannel().asTextChannel(), next); }else { - MessageText.send(event.getTextChannel(), "No song is currently playing."); + MessageText.send(event.getChannel().asTextChannel(), "No song is currently playing."); } } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/music/PauseCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/music/PauseCommand.java index d63400a..9b01300 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/music/PauseCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/music/PauseCommand.java @@ -26,9 +26,9 @@ public class PauseCommand extends MusicClientCommand{ if(PermUtil.hasMusicControl(event.getMember())) { if(!b.getAudioPlayer().isPaused()) { b.getAudioPlayer().setPaused(true); - MessageText.send(event.getTextChannel(), "Paused the current track."); + MessageText.send(event.getChannel().asTextChannel(), "Paused the current track."); }else { - MessageText.send(event.getTextChannel(), "The music player is already paused."); + MessageText.send(event.getChannel().asTextChannel(), "The music player is already paused."); } } } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/music/PlayFirstCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/music/PlayFirstCommand.java index e395e1e..4c5d5b1 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/music/PlayFirstCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/music/PlayFirstCommand.java @@ -15,7 +15,8 @@ import com.fpghoti.biscuit.rest.MessageText; import com.fpghoti.biscuit.util.PermUtil; import net.dv8tion.jda.api.entities.Guild; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; +//import net.dv8tion.jda.api.entities.TextChannel; import net.dv8tion.jda.api.events.message.MessageReceivedEvent; public class PlayFirstCommand extends MusicClientCommand{ @@ -33,7 +34,7 @@ public class PlayFirstCommand extends MusicClientCommand{ public void execute(String[] args, MessageReceivedEvent event) { Guild guild = event.getGuild(); Biscuit b = Biscuit.getBiscuit(guild); - TextChannel tchannel = event.getTextChannel(); + TextChannel tchannel = event.getChannel().asTextChannel(); int searchArg = 0; boolean scSearch = false; diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/music/QueueCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/music/QueueCommand.java index 02251e5..014cf40 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/music/QueueCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/music/QueueCommand.java @@ -33,7 +33,7 @@ public class QueueCommand extends MusicClientCommand{ if(Util.isDigit(args[0])) { pg = Integer.parseInt(args[0]); }else { - MessageText.send(event.getTextChannel(), "Usage: ``" + usage + "``"); + MessageText.send(event.getChannel().asTextChannel(), "Usage: ``" + usage + "``"); } } @@ -46,15 +46,15 @@ public class QueueCommand extends MusicClientCommand{ if(queue.size() == 0) { if(biscuit.getAudioPlayer().getPlayingTrack() == null) { - MessageText.send(event.getTextChannel(), "There is currently no song playing."); + MessageText.send(event.getChannel().asTextChannel(), "There is currently no song playing."); }else { - MessageText.send(event.getTextChannel(), "Nothing is queued to play after the current track."); + MessageText.send(event.getChannel().asTextChannel(), "Nothing is queued to play after the current track."); } return; } - MessageText.send(event.getTextChannel(), "**Use " + Main.getMainBiscuit().getProperties().getCommandSignifier() + "queue [Page #] to navigate the different pages.**"); - MessageText.send(event.getTextChannel(), "[" + Integer.toString(pg) + "/" + Integer.toString(pageCount) + "] ** Upcoming Music Tracks:**"); + MessageText.send(event.getChannel().asTextChannel(), "**Use " + Main.getMainBiscuit().getProperties().getCommandSignifier() + "queue [Page #] to navigate the different pages.**"); + MessageText.send(event.getChannel().asTextChannel(), "[" + Integer.toString(pg) + "/" + Integer.toString(pageCount) + "] ** Upcoming Music Tracks:**"); String msg = ""; for (int i = 0; i < 8; i++) { int index = (pg - 1) * 8 + i; @@ -76,7 +76,7 @@ public class QueueCommand extends MusicClientCommand{ msg = msg + line; } } - MessageText.send(event.getTextChannel(), msg); + MessageText.send(event.getChannel().asTextChannel(), msg); } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/music/RemoveCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/music/RemoveCommand.java index 59347c4..8e88f10 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/music/RemoveCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/music/RemoveCommand.java @@ -27,7 +27,7 @@ public class RemoveCommand extends MusicClientCommand{ if(PermUtil.hasMusicControl(event.getMember())) { if(Util.isDigit(args[0])) { int place = Integer.parseInt(args[0]); - MessageText.send(event.getTextChannel(), "Removing track at position **" + place + "**."); + MessageText.send(event.getChannel().asTextChannel(), "Removing track at position **" + place + "**."); b.getAudioScheduler().getQueue().removeTrack(place); } } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/music/ShuffleCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/music/ShuffleCommand.java index 45de267..27bc5d9 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/music/ShuffleCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/music/ShuffleCommand.java @@ -24,9 +24,9 @@ public class ShuffleCommand extends MusicClientCommand{ b.log(event.getAuthor().getName() + " issued a command: -shuffle"); if(b.getAudioScheduler().getQueue().getLastTrack() != null ) { b.getAudioScheduler().getQueue().shuffleUserTracks(event.getAuthor().getId()); - MessageText.send(event.getTextChannel(), "All songs that you have added to the queue have been shuffled."); + MessageText.send(event.getChannel().asTextChannel(), "All songs that you have added to the queue have been shuffled."); }else { - MessageText.send(event.getTextChannel(), "No song is currently playing."); + MessageText.send(event.getChannel().asTextChannel(), "No song is currently playing."); } } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/music/SkipAllCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/music/SkipAllCommand.java index cb7abad..38fe57a 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/music/SkipAllCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/music/SkipAllCommand.java @@ -24,9 +24,9 @@ public class SkipAllCommand extends MusicClientCommand{ Biscuit b = Biscuit.getBiscuit(event.getGuild()); b.log(event.getAuthor().getName() + " issued a command: -skipall"); if(PermUtil.hasMusicControl(event.getMember())) { - MessageText.send(event.getTextChannel(), "Force skipping all songs."); + MessageText.send(event.getChannel().asTextChannel(), "Force skipping all songs."); b.getAudioScheduler().getQueue().clear(); - b.getAudioScheduler().skip(event.getTextChannel()); + b.getAudioScheduler().skip(event.getChannel().asTextChannel()); } } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/music/SkipCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/music/SkipCommand.java index 196e38d..58aac3d 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/music/SkipCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/music/SkipCommand.java @@ -8,10 +8,10 @@ import com.fpghoti.biscuit.biscuit.Biscuit; import com.fpghoti.biscuit.commands.base.MusicClientCommand; import com.fpghoti.biscuit.rest.MessageText; -import net.dv8tion.jda.api.entities.AudioChannel; import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.Member; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; +import net.dv8tion.jda.api.entities.channel.middleman.AudioChannel; import net.dv8tion.jda.api.events.message.MessageReceivedEvent; public class SkipCommand extends MusicClientCommand{ @@ -32,11 +32,11 @@ public class SkipCommand extends MusicClientCommand{ Biscuit biscuit = Biscuit.getBiscuit(guild); biscuit.log(event.getAuthor().getName() + " issued a command: -skip"); - TextChannel cmdChannel = event.getTextChannel(); + TextChannel cmdChannel = event.getChannel().asTextChannel(); //Bot is not connected to voice channel. Do nothing. if(!guild.getAudioManager().isConnected()) { - MessageText.send(event.getTextChannel(), "The music player is not connected to a voice channel!"); + MessageText.send(event.getChannel().asTextChannel(), "The music player is not connected to a voice channel!"); return; } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/music/TogglePauseCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/music/TogglePauseCommand.java index 1a8f181..8aaf563 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/music/TogglePauseCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/music/TogglePauseCommand.java @@ -27,10 +27,10 @@ public class TogglePauseCommand extends MusicClientCommand{ if(PermUtil.hasMusicControl(event.getMember())) { if(b.getAudioPlayer().isPaused()) { b.getAudioPlayer().setPaused(false); - MessageText.send(event.getTextChannel(), "Unpaused the current track."); + MessageText.send(event.getChannel().asTextChannel(), "Unpaused the current track."); }else { b.getAudioPlayer().setPaused(true); - MessageText.send(event.getTextChannel(), "Paused the current track."); + MessageText.send(event.getChannel().asTextChannel(), "Paused the current track."); } } } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/music/UnpauseCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/music/UnpauseCommand.java index 67b38a0..9c8f3ce 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/music/UnpauseCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/music/UnpauseCommand.java @@ -27,9 +27,9 @@ public class UnpauseCommand extends MusicClientCommand{ if(PermUtil.hasMusicControl(event.getMember())) { if(b.getAudioPlayer().isPaused()) { b.getAudioPlayer().setPaused(false); - MessageText.send(event.getTextChannel(), "Unpaused the current track."); + MessageText.send(event.getChannel().asTextChannel(), "Unpaused the current track."); }else { - MessageText.send(event.getTextChannel(), "The music player is not paused."); + MessageText.send(event.getChannel().asTextChannel(), "The music player is not paused."); } } } diff --git a/src/main/java/com/fpghoti/biscuit/commands/discord/music/VolumeCommand.java b/src/main/java/com/fpghoti/biscuit/commands/discord/music/VolumeCommand.java index 2f26699..65f65e5 100644 --- a/src/main/java/com/fpghoti/biscuit/commands/discord/music/VolumeCommand.java +++ b/src/main/java/com/fpghoti/biscuit/commands/discord/music/VolumeCommand.java @@ -27,7 +27,7 @@ public class VolumeCommand extends MusicClientCommand{ if(args.length < 1) { b.log(event.getAuthor().getName() + " issued a command: -volume"); - MessageText.send(event.getTextChannel(), "The current volume is: **" + b.getAudioPlayer().getVolume() + "**."); + MessageText.send(event.getChannel().asTextChannel(), "The current volume is: **" + b.getAudioPlayer().getVolume() + "**."); return; } @@ -42,7 +42,7 @@ public class VolumeCommand extends MusicClientCommand{ vol = 150; } b.getAudioPlayer().setVolume(vol); - MessageText.send(event.getTextChannel(), "The volume was set to **" + b.getAudioPlayer().getVolume() + "**."); + MessageText.send(event.getChannel().asTextChannel(), "The volume was set to **" + b.getAudioPlayer().getVolume() + "**."); } } } diff --git a/src/main/java/com/fpghoti/biscuit/config/BiscuitConfig.java b/src/main/java/com/fpghoti/biscuit/config/BiscuitConfig.java index 6be0e46..5d949c5 100644 --- a/src/main/java/com/fpghoti/biscuit/config/BiscuitConfig.java +++ b/src/main/java/com/fpghoti/biscuit/config/BiscuitConfig.java @@ -20,7 +20,7 @@ import com.jcabi.aspects.Async; import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.Message.Attachment; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; public class BiscuitConfig { @@ -74,7 +74,7 @@ public class BiscuitConfig { return; } File config = new File(biscuit.getConfigDir(), name); - a.downloadToFile(config).thenAccept(file -> { + a.getProxy().downloadToFile(config).thenAccept(file -> { updateConfig(file, true, code); MessageText.send(c, "**The config was successfully updated.**"); }).exceptionally(t -> { @@ -82,6 +82,7 @@ public class BiscuitConfig { MessageText.send(c, "**An Exception occurred while trying to read the file.**"); return null; }); + return; } @@ -135,6 +136,7 @@ public class BiscuitConfig { added = addProperty("Bot-Token", "", prop, added, silent); added = addProperty("Enable-Music-Bot", "true", prop, added, silent); added = addProperty("Log-Music-Player", "true", prop, added, silent); + added = addProperty("Powershell-Display-Mode", "false", prop, added, silent); } added = addProperty("Guild-Identifier", name, prop, added, silent); diff --git a/src/main/java/com/fpghoti/biscuit/config/BiscuitProperties.java b/src/main/java/com/fpghoti/biscuit/config/BiscuitProperties.java index ee242d9..afb8830 100644 --- a/src/main/java/com/fpghoti/biscuit/config/BiscuitProperties.java +++ b/src/main/java/com/fpghoti/biscuit/config/BiscuitProperties.java @@ -32,6 +32,11 @@ public class BiscuitProperties { return Main.getMainBiscuit().getConfig().getFromConfig(key).equalsIgnoreCase("true"); } + public boolean isPowerShell(){ + String key = "Powershell-Display-Mode"; + return Main.getMainBiscuit().getConfig().getFromConfig(key).equalsIgnoreCase("true"); + } + public boolean allowMusicBot(){ if(!musicBotEnabled()) { return false; diff --git a/src/main/java/com/fpghoti/biscuit/listener/CommandListener.java b/src/main/java/com/fpghoti/biscuit/listener/CommandListener.java index 8e54a50..129b20d 100644 --- a/src/main/java/com/fpghoti/biscuit/listener/CommandListener.java +++ b/src/main/java/com/fpghoti/biscuit/listener/CommandListener.java @@ -4,19 +4,19 @@ import java.util.Scanner; import com.fpghoti.biscuit.biscuit.Biscuit; import com.fpghoti.biscuit.commands.CommandManager; -import com.fpghoti.biscuit.logging.BiscuitLog; +import com.fpghoti.biscuit.logging.BiscuitLogger; import com.fpghoti.biscuit.util.PermUtil; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import net.dv8tion.jda.api.hooks.ListenerAdapter; public class CommandListener extends ListenerAdapter implements Runnable { private Scanner sc; - private BiscuitLog log; + private BiscuitLogger log; - public CommandListener(Scanner sc, BiscuitLog log) { + public CommandListener(Scanner sc, BiscuitLogger log) { this.sc = sc; this.log = log; } @@ -27,7 +27,7 @@ public class CommandListener extends ListenerAdapter implements Runnable { return; } Biscuit b = Biscuit.getBiscuit(event.getGuild()); - if(PermUtil.isAdmin(event.getMember()) || !b.getProperties().restrictCmdChannels() || (b.getProperties().restrictCmdChannels() && isBotChannel(event.getTextChannel()))) { + if(PermUtil.isAdmin(event.getMember()) || !b.getProperties().restrictCmdChannels() || (b.getProperties().restrictCmdChannels() && isBotChannel(event.getChannel().asTextChannel()))) { if(!event.getAuthor().isBot() && event.getMessage().getContentDisplay().startsWith(b.getProperties().getCommandSignifier()) && event.getMessage().getAuthor().getId() != event.getJDA().getSelfUser().getId()){ CommandManager.parse(event.getMessage().getContentRaw().toLowerCase(), event); } diff --git a/src/main/java/com/fpghoti/biscuit/listener/DMListener.java b/src/main/java/com/fpghoti/biscuit/listener/DMListener.java index 5e1f12e..109bb67 100644 --- a/src/main/java/com/fpghoti/biscuit/listener/DMListener.java +++ b/src/main/java/com/fpghoti/biscuit/listener/DMListener.java @@ -4,7 +4,7 @@ import com.fpghoti.biscuit.Main; import com.fpghoti.biscuit.captcha.HandleCaptcha; import com.fpghoti.biscuit.logging.BColor; -import net.dv8tion.jda.api.entities.ChannelType; +import net.dv8tion.jda.api.entities.channel.ChannelType; import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import net.dv8tion.jda.api.hooks.ListenerAdapter; diff --git a/src/main/java/com/fpghoti/biscuit/listener/MessageDeleteListener.java b/src/main/java/com/fpghoti/biscuit/listener/MessageDeleteListener.java index ac8383e..798b3f1 100644 --- a/src/main/java/com/fpghoti/biscuit/listener/MessageDeleteListener.java +++ b/src/main/java/com/fpghoti/biscuit/listener/MessageDeleteListener.java @@ -12,7 +12,7 @@ public class MessageDeleteListener extends ListenerAdapter { @Override public void onMessageDelete(MessageDeleteEvent event) { Biscuit biscuit = Biscuit.getBiscuit(event.getGuild()); - if(Util.isLoggable(event.getTextChannel())) { + if(Util.isLoggable(event.getChannel().asTextChannel())) { biscuit.log("[" + BColor.MAGENTA + "#" + event.getChannel().getName() + BColor.RESET + "] " + BColor.MAGENTA_BOLD + "Message " + event.getMessageId() + " was deleted."); } } diff --git a/src/main/java/com/fpghoti/biscuit/listener/MessageEditListener.java b/src/main/java/com/fpghoti/biscuit/listener/MessageEditListener.java index 0807361..d7d077b 100644 --- a/src/main/java/com/fpghoti/biscuit/listener/MessageEditListener.java +++ b/src/main/java/com/fpghoti/biscuit/listener/MessageEditListener.java @@ -12,7 +12,7 @@ public class MessageEditListener extends ListenerAdapter { @Override public void onMessageUpdate(MessageUpdateEvent event) { Biscuit biscuit = Biscuit.getBiscuit(event.getGuild()); - if(Util.isLoggable(event.getTextChannel()) && (!event.getAuthor().getName().equalsIgnoreCase("jbot") && !event.getAuthor().isBot())) { + if(Util.isLoggable(event.getChannel().asTextChannel()) && (!event.getAuthor().getName().equalsIgnoreCase("jbot") && !event.getAuthor().isBot())) { biscuit.log("[" + BColor.CYAN_BOLD + "MSG EDIT" + BColor.RESET + "] " + BColor.CYAN + "ID: " + BColor.RESET + event.getMessageId() + BColor.CYAN + " User: " + BColor.RESET + event.getAuthor().getAsMention()); biscuit.log("[" + BColor.CYAN_BOLD + "#" + event.getChannel().getName() + BColor.RESET + "] " + BColor.CYAN + event.getAuthor().getName() + ": " + BColor.WHITE_BOLD + event.getMessage().getContentDisplay()); diff --git a/src/main/java/com/fpghoti/biscuit/listener/MessageReceiveListener.java b/src/main/java/com/fpghoti/biscuit/listener/MessageReceiveListener.java index 6c7a4b6..6cc11a5 100644 --- a/src/main/java/com/fpghoti/biscuit/listener/MessageReceiveListener.java +++ b/src/main/java/com/fpghoti/biscuit/listener/MessageReceiveListener.java @@ -42,14 +42,14 @@ public class MessageReceiveListener extends ListenerAdapter{ } //Channel is a captcha channel - if(HandleCaptcha.isCaptchaChannel(event.getTextChannel())) { + if(HandleCaptcha.isCaptchaChannel(event.getChannel().asTextChannel())) { HandleCaptcha.handleCaptcha(event.getAuthor(), event.getChannel(), event.getMessage().getContentDisplay()); } } private void logBot(MessageReceivedEvent event, Biscuit biscuit) { - if(Util.isLoggable(event.getTextChannel())) { + if(Util.isLoggable(event.getChannel().asTextChannel())) { if(biscuit.getProperties().logChat()) { biscuit.log("[" + BColor.BLACK_BOLD + "BOT" + BColor.RESET + "] [" + BColor.RED + "#" + event.getChannel().getName() + BColor.RESET + "] " + BColor.RED_BOLD + event.getAuthor().getName() + ": " + BColor.RESET + event.getMessage().getContentDisplay()); @@ -58,7 +58,7 @@ public class MessageReceiveListener extends ListenerAdapter{ } private void logUser(MessageReceivedEvent event, Biscuit biscuit) { - if(Util.isLoggable(event.getTextChannel())) { + if(Util.isLoggable(event.getChannel().asTextChannel())) { if(biscuit.getProperties().logChat()) { biscuit.log("[" + BColor.CYAN_BOLD + "MSG" + BColor.RESET + "] " + BColor.GREEN + "ID: " + BColor.RESET + event.getMessageId() + BColor.GREEN + " Sender: " + BColor.RESET + event.getAuthor().getAsMention()); @@ -83,7 +83,7 @@ public class MessageReceiveListener extends ListenerAdapter{ private boolean isNaughty(MessageReceivedEvent event) { // TODO make staff filter configurable if(!event.getChannel().getName().toLowerCase().contains("staff") && ChatFilter.filter(event, false)){ - MessageText.sendTimed(event.getTextChannel(), event.getAuthor().getAsMention() + " This message contains words not appropriate for this channel.", 3); + MessageText.sendTimed(event.getChannel().asTextChannel(), event.getAuthor().getAsMention() + " This message contains words not appropriate for this channel.", 3); event.getMessage().delete().submit(); return true; } @@ -151,14 +151,14 @@ public class MessageReceiveListener extends ListenerAdapter{ store.addSpammer(event.getAuthor()); store.removeSpamWarned(event.getAuthor()); event.getMessage().delete().submit(); - MessageText.sendTimed(event.getTextChannel(), "*Flagging " + mention + " as spam!*", 3); + MessageText.sendTimed(event.getChannel().asTextChannel(), "*Flagging " + mention + " as spam!*", 3); biscuit.log(BColor.MAGENTA_BOLD + "User " + event.getAuthor().getName() + " has been flagged as spam!"); event.getMessage().delete().reason("Spam removal activated for " + mention).submit(); //User is spamming and has not been warned. Apply warning. }else if(!store.isSpammer(event.getAuthor()) && !store.isSpamWarned(event.getAuthor())){ store.removeMessageCount(event.getAuthor()); store.addSpamWarned(event.getAuthor()); - MessageText.sendTimed(event.getTextChannel(), "**STOP spamming, " + mention + "! You have been warned!**", 3); + MessageText.sendTimed(event.getChannel().asTextChannel(), "**STOP spamming, " + mention + "! You have been warned!**", 3); biscuit.log(BColor.MAGENTA_BOLD + "User " + event.getAuthor().getName() + " has been warned for spam!"); } } diff --git a/src/main/java/com/fpghoti/biscuit/listener/ReactionListener.java b/src/main/java/com/fpghoti/biscuit/listener/ReactionListener.java index e5474e8..a5229a8 100644 --- a/src/main/java/com/fpghoti/biscuit/listener/ReactionListener.java +++ b/src/main/java/com/fpghoti/biscuit/listener/ReactionListener.java @@ -21,7 +21,7 @@ public class ReactionListener extends ListenerAdapter{ if(event.getGuild() == null) { return; } - if(Util.contains(biscuit.getProperties().getToggleChannels(),event.getTextChannel().getName())) { + if(Util.contains(biscuit.getProperties().getToggleChannels(),event.getChannel().asTextChannel().getName())) { handleMessageRole(event, false); } } @@ -32,14 +32,14 @@ public class ReactionListener extends ListenerAdapter{ if(event.getGuild() == null) { return; } - if(Util.contains(biscuit.getProperties().getToggleChannels(),event.getTextChannel().getName())) { + if(Util.contains(biscuit.getProperties().getToggleChannels(),event.getChannel().asTextChannel().getName())) { handleMessageRole(event, true); } } private void handleMessageRole(GenericMessageReactionEvent event, boolean remove) { Biscuit biscuit = Biscuit.getBiscuit(event.getGuild()); - event.getTextChannel().retrieveMessageById(event.getMessageId()).queue((message) -> { + event.getChannel().asTextChannel().retrieveMessageById(event.getMessageId()).queue((message) -> { String msg = message.getContentDisplay(); for(String rolename : biscuit.getProperties().getToggleRoles()) { for(Role r : event.getGuild().getRoles()) { @@ -65,7 +65,7 @@ public class ReactionListener extends ListenerAdapter{ Member m = event.getMember(); if(remove) { if(PermUtil.hasRole(m, role)) { - biscuit.log(BColor.MAGENTA_BOLD + "REACTION TOGGLE (#" + event.getTextChannel().getName() + ") - " + BColor.RESET + "Removing role " + role.getName() + " from " + m.getUser().getName() + "(" + m.getId() + ")"); + biscuit.log(BColor.MAGENTA_BOLD + "REACTION TOGGLE (#" + event.getChannel().asTextChannel().getName() + ") - " + BColor.RESET + "Removing role " + role.getName() + " from " + m.getUser().getName() + "(" + m.getId() + ")"); guild.removeRoleFromMember(m, role).queue(); } }else { @@ -80,7 +80,7 @@ public class ReactionListener extends ListenerAdapter{ canAdd = true; } if(canAdd) { - biscuit.log(BColor.MAGENTA_BOLD + "REACTION TOGGLE (#" + event.getTextChannel().getName() + ") - " + BColor.RESET + " Adding role " + role.getName() + " to " + m.getUser().getName() + "(" + m.getId() + ")"); + biscuit.log(BColor.MAGENTA_BOLD + "REACTION TOGGLE (#" + event.getChannel().asTextChannel().getName() + ") - " + BColor.RESET + " Adding role " + role.getName() + " to " + m.getUser().getName() + "(" + m.getId() + ")"); guild.addRoleToMember(m, role).queue(); } } diff --git a/src/main/java/com/fpghoti/biscuit/logging/BiscuitLog.java b/src/main/java/com/fpghoti/biscuit/logging/BiscuitLog.java deleted file mode 100644 index 73c4b04..0000000 --- a/src/main/java/com/fpghoti/biscuit/logging/BiscuitLog.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.fpghoti.biscuit.logging; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.fpghoti.biscuit.Main; - -public class BiscuitLog { - - private final Logger console = LoggerFactory.getLogger("Biscuit"); - private final Logger file = LoggerFactory.getLogger("B-File"); - - public void debug(String msg) { - console.debug("[" + BColor.MAGENTA_BOLD + "DEBUG" + BColor.RESET + "] " + BColor.MAGENTA + msg + BColor.RESET); - if(!Main.isPlugin) { - file.debug(BColor.clear(msg)); - } - } - - public void error(String msg) { - console.error("[" + BColor.RED_BOLD + "ERROR" + BColor.RESET + "] " + BColor.RED + msg + BColor.RESET); - if(!Main.isPlugin) { - file.error(BColor.clear(msg)); - } - } - - public void info(String msg) { - console.info(msg + BColor.RESET); - if(!Main.isPlugin) { - file.info(BColor.clear(msg)); - } - } - - public void trace(String msg) { - console.trace("[" + BColor.CYAN_BOLD + "TRACE" + BColor.RESET + "] " + BColor.CYAN + msg + BColor.RESET); - if(!Main.isPlugin) { - file.trace(BColor.clear(msg)); - } - } - - public void warn(String msg) { - console.warn("[" + BColor.YELLOW_BOLD + "WARN" + BColor.RESET + "] " + BColor.YELLOW + msg + BColor.RESET); - if(!Main.isPlugin) { - file.warn(BColor.clear(msg)); - } - } - -} diff --git a/src/main/java/com/fpghoti/biscuit/logging/BiscuitLogger.java b/src/main/java/com/fpghoti/biscuit/logging/BiscuitLogger.java new file mode 100644 index 0000000..e1cc4e3 --- /dev/null +++ b/src/main/java/com/fpghoti/biscuit/logging/BiscuitLogger.java @@ -0,0 +1,58 @@ +package com.fpghoti.biscuit.logging; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.fpghoti.biscuit.Main; + +public class BiscuitLogger { + + private final Logger console = LoggerFactory.getLogger("Biscuit"); + private final Logger file = LoggerFactory.getLogger("B-File"); + + public void debug(String msg) { + console.debug(powerShellCompat("[" + BColor.MAGENTA_BOLD + "DEBUG" + BColor.RESET + "] " + BColor.MAGENTA + msg + BColor.RESET)); + if(!Main.isPlugin) { + file.debug(BColor.clear(msg)); + } + } + + public void error(String msg) { + console.error(powerShellCompat("[" + BColor.RED_BOLD + "ERROR" + BColor.RESET + "] " + BColor.RED + msg + BColor.RESET)); + if(!Main.isPlugin) { + file.error(BColor.clear(msg)); + } + } + + public void info(String msg) { + console.info(powerShellCompat(msg + BColor.RESET)); + if(!Main.isPlugin) { + file.info(BColor.clear(msg)); + } + } + + public void trace(String msg) { + console.trace(powerShellCompat("[" + BColor.CYAN_BOLD + "TRACE" + BColor.RESET + "] " + BColor.CYAN + msg + BColor.RESET)); + if(!Main.isPlugin) { + file.trace(BColor.clear(msg)); + } + } + + public void warn(String msg) { + console.warn(powerShellCompat("[" + BColor.YELLOW_BOLD + "WARN" + BColor.RESET + "] " + BColor.YELLOW + msg + BColor.RESET)); + if(!Main.isPlugin) { + file.warn(BColor.clear(msg)); + } + } + + private String powerShellCompat(String s) { + if(Main.getMainBiscuit() == null || Main.getMainBiscuit().getProperties() == null) { + return s; + } + if(Main.getMainBiscuit().getProperties().isPowerShell()) { + s = s.replace(BColor.MAGENTA + "", BColor.RED_BOLD + ""); + } + return s; + } + +} diff --git a/src/main/java/com/fpghoti/biscuit/plugin/BiscuitPlugin.java b/src/main/java/com/fpghoti/biscuit/plugin/BiscuitPlugin.java index c0c8bc7..9749a86 100644 --- a/src/main/java/com/fpghoti/biscuit/plugin/BiscuitPlugin.java +++ b/src/main/java/com/fpghoti/biscuit/plugin/BiscuitPlugin.java @@ -7,7 +7,7 @@ import org.pf4j.PluginWrapper; import com.fpghoti.biscuit.Main; import com.fpghoti.biscuit.biscuit.Biscuit; -import com.fpghoti.biscuit.logging.BiscuitLog; +import com.fpghoti.biscuit.logging.BiscuitLogger; import com.github.cage.Cage; import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager; @@ -59,7 +59,7 @@ public abstract class BiscuitPlugin extends Plugin { return Main.getPlayerManager(); } - public BiscuitLog getLogger() { + public BiscuitLogger getLogger() { return Main.getLogger(); } diff --git a/src/main/java/com/fpghoti/biscuit/rest/MessageText.java b/src/main/java/com/fpghoti/biscuit/rest/MessageText.java index 53bebe6..7099383 100644 --- a/src/main/java/com/fpghoti/biscuit/rest/MessageText.java +++ b/src/main/java/com/fpghoti/biscuit/rest/MessageText.java @@ -6,8 +6,8 @@ import com.fpghoti.biscuit.Main; import com.fpghoti.biscuit.biscuit.Biscuit; import net.dv8tion.jda.api.entities.MessageEmbed; -import net.dv8tion.jda.api.entities.PrivateChannel; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.PrivateChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;; public class MessageText { diff --git a/src/main/java/com/fpghoti/biscuit/user/CaptchaUser.java b/src/main/java/com/fpghoti/biscuit/user/CaptchaUser.java index 78b940f..0c3018b 100644 --- a/src/main/java/com/fpghoti/biscuit/user/CaptchaUser.java +++ b/src/main/java/com/fpghoti/biscuit/user/CaptchaUser.java @@ -9,8 +9,8 @@ import com.fpghoti.biscuit.captcha.Captcha; import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.entities.Guild; -import net.dv8tion.jda.api.entities.MessageChannel; import net.dv8tion.jda.api.entities.User; +import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel; public class CaptchaUser implements Iterable{ diff --git a/src/main/java/com/fpghoti/biscuit/util/ChatFilter.java b/src/main/java/com/fpghoti/biscuit/util/ChatFilter.java index 66dfa01..22abefe 100644 --- a/src/main/java/com/fpghoti/biscuit/util/ChatFilter.java +++ b/src/main/java/com/fpghoti/biscuit/util/ChatFilter.java @@ -4,7 +4,7 @@ import com.fpghoti.biscuit.biscuit.Biscuit; import com.fpghoti.biscuit.logging.BColor; import com.vdurmont.emoji.EmojiParser; -import net.dv8tion.jda.api.entities.Emote; +import net.dv8tion.jda.api.entities.emoji.Emoji; import net.dv8tion.jda.api.events.message.MessageReceivedEvent; public class ChatFilter { @@ -36,7 +36,7 @@ public class ChatFilter { } //Custom emote check - for(Emote e : event.getMessage().getEmotes()) { + for(Emoji e : event.getMessage().getMentions().getCustomEmojis()) { String name = e.getName(); for(String s : biscuit.getProperties().blockedCustomEmotes()) { diff --git a/src/main/java/com/fpghoti/biscuit/util/Util.java b/src/main/java/com/fpghoti/biscuit/util/Util.java index 7f20b46..59c1227 100644 --- a/src/main/java/com/fpghoti/biscuit/util/Util.java +++ b/src/main/java/com/fpghoti/biscuit/util/Util.java @@ -4,7 +4,7 @@ import java.util.Random; import com.fpghoti.biscuit.biscuit.Biscuit; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; public class Util { public static int randInt(int min, int max) { diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml index ac7fa63..0f89553 100644 --- a/src/main/resources/logback.xml +++ b/src/main/resources/logback.xml @@ -1,13 +1,11 @@ - - %colorize([%date{MM/dd/yyyy HH:mm:ss}]) %msg%n + [%date{MM/dd/yyyy HH:mm:ss}] %msg%n