Fix SQL query
This commit is contained in:
1 parent
8638b75258
commit
e0767ed31a
3 files changed
+8
-3
No files matched your search
@@ -12,6 +12,7 @@ import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import netneutrality.db.DBController;
|
||||
import netneutrality.db.controllers.DBGuild;
|
||||
import netneutrality.db.controllers.DBMessage;
|
||||
import netneutrality.db.entities.OGuild;
|
||||
import netneutrality.handler.ratelimiter.IMessageRateLimiter;
|
||||
import netneutrality.handler.ratelimiter.MessageRateLimiterImpl;
|
||||
@@ -130,7 +131,9 @@ public class GuildManager {
|
||||
}
|
||||
|
||||
public void checkAndLogMessage(Message message, Member member, TextChannel channel) {
|
||||
//((DBMessage) DBController.get("message")).log(guild, channel, member, message);
|
||||
if (guildEntity.isLogging()) {
|
||||
((DBMessage) DBController.get("message")).log(guild, channel, member, message);
|
||||
}
|
||||
}
|
||||
|
||||
public void checkBlacklist(Message message, Member member, TextChannel channel) {
|
||||
|
||||
@@ -12,13 +12,13 @@ public class DBGuild extends AbstractController {
|
||||
|
||||
public void insertGuildInDB(Guild g) {
|
||||
if (!database.exists("guilds", "guild_id", g.getId())) {
|
||||
database.prepareAndExecuteAsync("INSERT INTO guilds VALUES(?, ?, ?)", g.getId(), "0", null).blocking();
|
||||
database.prepareAndExecuteAsync("INSERT INTO guilds VALUES(?, ?, ?, ?)", g.getId(), "0", null, null).blocking();
|
||||
}
|
||||
}
|
||||
|
||||
public void removeGuildInDB(Guild g) {
|
||||
if (database.exists("guilds", "guild_id", g.getId())) {
|
||||
database.prepareAndExecuteAsync("INSERT INTO guilds VALUES(?, ?, ?)", g.getId(), "0", null).blocking();
|
||||
database.prepareAndExecuteAsync("DELETE FROM guilds WHERE guild_id = ?", g.getId()).blocking();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ package netneutrality.handler;
|
||||
* https://discord.gg/CdFcyQ
|
||||
*/
|
||||
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import netneutrality.GuildManager;
|
||||
import netneutrality.MusicBot;
|
||||
import netneutrality.command.CommandContext;
|
||||
@@ -69,6 +70,7 @@ public class LogHandler {
|
||||
.getTextChannels()
|
||||
.stream()
|
||||
.filter(textChannel -> textChannel.getName().equals("debug") || textChannel.getName().equals("log"))
|
||||
.filter(TextChannel::canTalk)
|
||||
.forEach(textChannel -> textChannel.sendMessageEmbeds(MessageFunction.buildDebugMessage(context, error)).queue());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user