Skip to content

Commit

Permalink
Merge pull request #329 from KittyBot-Org/development
Browse files Browse the repository at this point in the history
bug fixes
  • Loading branch information
topi314 authored Jul 2, 2021
2 parents e516339 + 305ea3b commit 9cf10ec
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 47 deletions.
54 changes: 21 additions & 33 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,80 +1,68 @@
buildscript {
repositories {
maven {
url "https://dl.bintray.com/kittybot-org/gradle-jooq-plugin"
}
}
dependencies {
classpath 'de.kittybot.jooq:gradle-jooq-plugin:5.2.7'
}
}

plugins {
id 'java'
id 'application'
id 'com.github.johnrengelman.shadow' version '6.1.0'
id 'com.github.johnrengelman.shadow' version '7.0.0'
id 'nu.studer.jooq' version '5.2.2'
}

apply plugin: 'de.kittybot.jooq'

group 'de.kittybot'
mainClassName = 'de.kittybot.kittybot.main.Main'

repositories {
maven { url 'https://m2.dv8tion.net/releases' }
mavenCentral() // this is to receive updates from mvnrepository repos that are not synced with jcenter
jcenter()
maven { url 'https://jitpack.io' }
mavenCentral()
jcenter() // this is still required because of jda utilities
}

dependencies {
// discord/jda related
implementation('net.dv8tion:JDA:4.2.1_255') {
implementation('net.dv8tion:JDA:4.3.0_289') {
exclude group: 'club.minnced', module: 'opus-java'
}
implementation 'com.jagrosh:jda-utilities:3.0.5'
implementation 'club.minnced:discord-webhooks:0.5.6'
implementation 'com.github.caneleex:BotListHandler:1.0.12'
implementation 'club.minnced:discord-webhooks:0.5.7'
implementation 'dev.mlnr:BotListHandler-jda:2.0.0_7'

// audio
implementation('com.github.KittyBot-Org:Lavalink-Client:176ca86') {
exclude group: 'com.sedmelluq', module: 'lavaplayer'
}
implementation 'com.github.sedmelluq:lavaplayer:1.3.76'
implementation 'se.michaelthelin.spotify:spotify-web-api-java:6.5.2'
implementation 'com.sedmelluq:lavaplayer:1.3.78'
implementation 'se.michaelthelin.spotify:spotify-web-api-java:6.5.4'

// database
implementation 'com.zaxxer:HikariCP:4.0.3'
implementation 'org.jooq:jooq:3.14.8'
implementation 'org.postgresql:postgresql:42.2.19'
jooqGenerator 'org.postgresql:postgresql:42.2.18'
implementation 'org.jooq:jooq:3.14.12'
implementation 'org.postgresql:postgresql:42.2.22'
jooqGenerator 'org.postgresql:postgresql:42.2.22'

// logging
implementation 'ch.qos.logback:logback-classic:1.3.0-alpha5'
implementation 'io.sentry:sentry-logback:4.3.0'
implementation 'io.sentry:sentry-logback:5.0.1'

// eval
implementation 'org.codehaus.groovy:groovy-jsr223:3.0.7'
implementation 'org.codehaus.groovy:groovy-jsr223:3.0.8'

// jjwt
implementation 'io.jsonwebtoken:jjwt-api:0.11.2'
implementation 'io.jsonwebtoken:jjwt-impl:0.11.2'
implementation 'io.jsonwebtoken:jjwt-jackson:0.11.2'

// Prometheus
implementation 'io.prometheus:simpleclient:0.10.0'
implementation 'io.prometheus:simpleclient_hotspot:0.10.0'
implementation 'io.prometheus:simpleclient_httpserver:0.10.0'
implementation 'io.prometheus:simpleclient:0.11.0'
implementation 'io.prometheus:simpleclient_hotspot:0.11.0'
implementation 'io.prometheus:simpleclient_httpserver:0.11.0'

// other
implementation 'io.javalin:javalin:3.13.4'
implementation 'io.github.classgraph:classgraph:4.8.104'
implementation 'com.github.ben-manes.caffeine:caffeine:2.8.8'
implementation 'io.javalin:javalin:3.13.8'
implementation 'io.github.classgraph:classgraph:4.8.109'
implementation 'com.github.ben-manes.caffeine:caffeine:3.0.3'
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
}

jooq {
version = '3.14.4'
version = '3.14.12'
configurations {
main {
generateSchemaSourceOnCompilation = false
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/de/kittybot/kittybot/main/KittyBot.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import de.kittybot.kittybot.objects.exceptions.MissingConfigValuesException;
import de.kittybot.kittybot.objects.module.Modules;
import de.kittybot.kittybot.utils.Config;
import dev.mlnr.blh.api.BLHBuilder;
import dev.mlnr.blh.api.BLHEventListener;
import dev.mlnr.blh.api.BotList;
import dev.mlnr.blh.core.api.BLHBuilder;
import dev.mlnr.blh.core.api.BotList;
import dev.mlnr.blh.jda.BLHJDAListener;
import net.dv8tion.jda.api.GatewayEncoding;
import net.dv8tion.jda.api.OnlineStatus;
import net.dv8tion.jda.api.entities.Activity;
Expand Down Expand Up @@ -36,7 +36,7 @@ public KittyBot() throws IOException, MissingConfigValuesException, LoginExcepti
.setSuccessLoggingEnabled(false)
.addBotList(BotList.TOP_GG, Config.TOP_GG_TOKEN)
.addBotList(BotList.DBOATS, Config.DISCORD_BOATS_TOKEN)
.addBotList(BotList.BOTLIST_SPACE, Config.BOTLIST_SPACE_TOKEN)
.addBotList(BotList.DISCORDLIST_SPACE, Config.BOTLIST_SPACE_TOKEN)
.addBotList(BotList.BOTS_FOR_DISCORD, Config.BOTS_FOR_DISCORD_TOKEN)
.addBotList(BotList.DSERVICES, Config.DISCORD_SERVICES_TOKEN)
.addBotList(BotList.DBL, Config.DISCORD_BOT_LIST_TOKEN)
Expand All @@ -63,7 +63,7 @@ public KittyBot() throws IOException, MissingConfigValuesException, LoginExcepti
.setMemberCachePolicy(MemberCachePolicy.VOICE)
.setChunkingFilter(ChunkingFilter.NONE)
.addEventListeners(modules.getModules())
.addEventListeners(new BLHEventListener(botListHandler))
.addEventListeners(new BLHJDAListener(botListHandler))
.setRawEventsEnabled(true)
.setHttpClient(modules.getHttpClient())
.setVoiceDispatchInterceptor(modules.get(LavalinkModule.class).getVoiceInterceptor())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import net.dv8tion.jda.api.events.guild.GuildJoinEvent;
import net.dv8tion.jda.api.events.guild.member.GuildMemberJoinEvent;
import net.dv8tion.jda.api.events.guild.member.GuildMemberRemoveEvent;
import net.dv8tion.jda.api.events.guild.member.GuildMemberRoleAddEvent;
import net.dv8tion.jda.api.events.guild.member.GuildMemberRoleRemoveEvent;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
Expand All @@ -23,7 +25,7 @@
import java.util.concurrent.ThreadLocalRandom;

@SuppressWarnings("unused")
public class JoinModule extends Module{
public class AnnouncementModule extends Module{

private static final Logger LOG = LoggerFactory.getLogger(MessageUtils.class);
private static final String INVITE_CODE_PREFIX = "https://discord.gg/";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void onGuildMemberRemove(@Nonnull GuildMemberRemoveEvent event){
name = auditUser.getAsTag();
}
}
logEvent(event, Color.BLUE, user, "Bot remove", "{0} {1} has `removed` bot {2}({3}) from this server",
logEvent(event, Color.BLUE, user, "Bot remove", "%s `%s` has `removed` bot %s(`%d`) from this server",
Emoji.ROBOT.get(),
name,
user.getAsTag(),
Expand All @@ -70,7 +70,7 @@ public void onGuildMemberRemove(@Nonnull GuildMemberRemoveEvent event){
});
return;
}
logEvent(event, Color.GREEN, user, "User leave", "{0} **{1}** ({2}) has `left` the server",
logEvent(event, Color.GREEN, user, "User leave", "%s `%s`(`%d`) has `left` the server",
Emoji.OUTBOX_TRAY.get(),
user.getAsTag(),
userId
Expand All @@ -95,7 +95,7 @@ public void onGuildMemberJoin(@Nonnull GuildMemberJoinEvent event){
name = auditUser.getAsTag();
}
}
logEvent(event, Color.BLUE, user, "Bot add", "{0} {1} has `added` bot {2}({3}) to this server",
logEvent(event, Color.BLUE, user, "Bot add", "%s **%s** has `added` bot %s(`%d`) to this server",
Emoji.ROBOT.get(),
name,
user.getAsTag(),
Expand All @@ -105,12 +105,12 @@ public void onGuildMemberJoin(@Nonnull GuildMemberJoinEvent event){
return;
}
var invite = this.modules.get(InviteModule.class).getUsedInvite(event.getGuild().getIdLong(), userId);
logEvent(event, Color.GREEN, user, "User join", "{0} **{1}** ({2}) has `joined` the server with invite **https://discord.gg/{3}**(**{4}**)",
logEvent(event, Color.GREEN, user, "User join", "%s **%s**(`%d`) has `joined` the server with invite `%s`(%s)",
Emoji.INBOX_TRAY.get(),
user.getAsTag(),
userId,
invite.getCode(),
MessageUtils.getUserMention(invite.getUserId())
invite == null ? "unknown" : "https://discord.gg/" + invite.getCode(),
invite == null ? "unknown" : MessageUtils.getUserMention(invite.getUserId())
);
}

Expand All @@ -123,7 +123,7 @@ private void logEvent(GenericGuildEvent event, Color color, User user, String ev
}
channel.sendMessage(new EmbedBuilder()
.setColor(color)
.setDescription(MessageFormat.format(message, args))
.setDescription(String.format(message, args))
.setFooter(eventName, user == null ? null : user.getEffectiveAvatarUrl())
.setTimestamp(Instant.now())
.build()
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/de/kittybot/kittybot/modules/TagsModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ var record = this.modules.get(DatabaseModule.class).getCtx().update(GUILD_TAGS)
if(record == null){
return false;
}
if(record.getCommandId() != -1){
if(record.getCommandId() != -1 && newName != null){
this.modules.get(CommandsModule.class).editGuildCommand(guildId, record.getCommandId(), DataObject.empty().put("name", newName));
}
return true;
Expand Down

0 comments on commit 9cf10ec

Please sign in to comment.