Skip to content

Commit

Permalink
Release 1.6.4
Browse files Browse the repository at this point in the history
= Fixed Command Cooldown.
= Updated JDA from alpha5 to alpha9
  • Loading branch information
DxsSucuk committed Feb 27, 2022
1 parent a80d8a3 commit 75685f8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<groupId>de.presti</groupId>
<artifactId>Ree6</artifactId>
<version>1.6.3</version>
<version>1.6.4</version>
<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -187,7 +187,7 @@
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.0.0-alpha.5</version>
<version>5.0.0-alpha.9</version>
</dependency>
<dependency>
<groupId>me.carleslc.Simple-YAML</groupId>
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/de/presti/ree6/commands/CommandManager.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package de.presti.ree6.commands;

import de.presti.ree6.bot.BotInfo;
import de.presti.ree6.bot.BotVersion;
import de.presti.ree6.commands.impl.community.*;
import de.presti.ree6.commands.impl.fun.*;
import de.presti.ree6.commands.impl.hidden.*;
Expand Down Expand Up @@ -184,7 +185,7 @@ public boolean perform(Member member, Guild guild, String messageContent, Messag
if (slashCommandInteractionEvent != null) {
sendMessage("You are on cooldown!", 5, textChannel, slashCommandInteractionEvent.getHook().setEphemeral(true));
deleteMessage(message, slashCommandInteractionEvent.getHook().setEphemeral(true));
} else {
} else if (messageContent.toLowerCase().startsWith(Main.getInstance().getSqlConnector().getSqlWorker().getSetting(guild.getId(), "chatprefix").getStringValue().toLowerCase())) {
sendMessage("You are on cooldown!", 5, textChannel, null);
deleteMessage(message, null);
}
Expand Down Expand Up @@ -226,7 +227,7 @@ public boolean perform(Member member, Guild guild, String messageContent, Messag
}

// Check if the message starts with the prefix.
if (!messageContent.toLowerCase().startsWith(Main.getInstance().getSqlConnector().getSqlWorker().getSetting(guild.getId(), "chatprefix").getStringValue()))
if (!messageContent.toLowerCase().startsWith(Main.getInstance().getSqlConnector().getSqlWorker().getSetting(guild.getId(), "chatprefix").getStringValue().toLowerCase()))
return false;

// Parse the Message and remove the prefix from it.
Expand Down Expand Up @@ -260,8 +261,8 @@ public boolean perform(Member member, Guild guild, String messageContent, Messag
StatsManager.addStatsForCommand(command, guild.getId());
}

// If the User isn't Presti (Ree6 owner) set Cooldown. Why not for the Owner? Because of tests.
if (!member.getUser().getId().equalsIgnoreCase("321580743488831490")) {
// Check if this is a Developer build, if not then cooldown the User.
if (BotInfo.version != BotVersion.DEV) {
new Thread(() -> {
try {
Thread.sleep(5000);
Expand All @@ -278,7 +279,7 @@ public boolean perform(Member member, Guild guild, String messageContent, Messag
}

// Add them to the Cooldown.
if (!ArrayUtil.commandCooldown.contains(member.getUser().getId()) && !member.getUser().getId().equalsIgnoreCase("321580743488831490")) {
if (!ArrayUtil.commandCooldown.contains(member.getUser().getId()) && BotInfo.version != BotVersion.DEV) {
ArrayUtil.commandCooldown.add(member.getUser().getId());
}

Expand Down
17 changes: 9 additions & 8 deletions src/main/java/de/presti/ree6/events/OtherEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,15 @@ public void onMessageReceived(@NotNull MessageReceivedEvent event) {
super.onMessageReceived(event);

if (event.isFromGuild() && event.isFromType(ChannelType.TEXT) && event.getMember() != null) {
if (ChatProtector.isChatProtectorSetup(event.getGuild().getId()) &&
ChatProtector.checkMessage(event.getGuild().getId(), event.getMessage().getContentRaw())) {
Main.getInstance().getCommandManager().deleteMessage(event.getMessage(), null);
event.getChannel().sendMessage("You can't write that!").queue();
return;
}

if (event.getAuthor().isBot()) return;

if (!ArrayUtil.messageIDwithMessage.containsKey(event.getMessageId())) {
ArrayUtil.messageIDwithMessage.put(event.getMessageId(), event.getMessage());
}
Expand All @@ -126,14 +135,6 @@ public void onMessageReceived(@NotNull MessageReceivedEvent event) {
ArrayUtil.messageIDwithUser.put(event.getMessageId(), event.getAuthor());
}

if (event.getAuthor().isBot()) return;

if (ChatProtector.isChatProtectorSetup(event.getGuild().getId()) &&
ChatProtector.checkMessage(event.getGuild().getId(), event.getMessage().getContentRaw())) {
Main.getInstance().getCommandManager().deleteMessage(event.getMessage(), null);
event.getChannel().sendMessage("You can't write that!").queue();
return;
}

if (!Main.getInstance().getCommandManager().perform(event.getMember(), event.getGuild(), event.getMessage().getContentRaw(), event.getMessage(), event.getTextChannel(), null)) {

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/de/presti/ree6/main/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public static void main(String[] args) {

// Create a new Instance of the Bot, as well as add the Events.
try {
BotUtil.createBot(BotVersion.PUBLIC, "1.6.3");
BotUtil.createBot(BotVersion.PUBLIC, "1.6.4");
instance.musicWorker = new MusicWorker();
instance.addEvents();
} catch (Exception ex) {
Expand Down

0 comments on commit 75685f8

Please sign in to comment.