✨ Fix Nonnull
This commit is contained in:
parent
305ddb6112
commit
4649f3d8f4
@ -9,8 +9,6 @@ import org.camelia.studio.gachamelia.utils.Configuration;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Gachamelia {
|
||||
private static JDA jda;
|
||||
private static final Logger logger = LoggerFactory.getLogger(Gachamelia.class);
|
||||
@ -32,6 +30,10 @@ public class Gachamelia {
|
||||
HibernateConfig.shutdown();
|
||||
jda.shutdown();
|
||||
}));
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
logger.error("Le thread a été interrompu : {}", e.getMessage());
|
||||
System.exit(1);
|
||||
} catch (Exception e) {
|
||||
logger.error("Une erreur est survenue lors de l'exécution du bot : {}", e.getMessage());
|
||||
System.exit(1);
|
||||
|
@ -11,13 +11,13 @@ import org.camelia.studio.gachamelia.models.WelcomeMessage;
|
||||
import org.camelia.studio.gachamelia.services.RankService;
|
||||
import org.camelia.studio.gachamelia.services.UserService;
|
||||
import org.camelia.studio.gachamelia.utils.Configuration;
|
||||
|
||||
import java.awt.*;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
public class GuildMemberJoinListener extends ListenerAdapter {
|
||||
@Override
|
||||
public void onGuildMemberJoin(GuildMemberJoinEvent event) {
|
||||
public void onGuildMemberJoin(@Nonnull GuildMemberJoinEvent event) {
|
||||
Member member = event.getMember();
|
||||
User user = UserService.getInstance().getOrCreateUser(member.getId());
|
||||
|
||||
|
@ -10,15 +10,15 @@ import org.camelia.studio.gachamelia.models.User;
|
||||
import org.camelia.studio.gachamelia.services.RankService;
|
||||
import org.camelia.studio.gachamelia.services.UserService;
|
||||
import org.camelia.studio.gachamelia.utils.Configuration;
|
||||
|
||||
import java.awt.*;
|
||||
import java.time.Instant;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
public class GuildMemberLeaveListener extends ListenerAdapter {
|
||||
|
||||
@Override
|
||||
public void onGuildMemberRemove(GuildMemberRemoveEvent event) {
|
||||
public void onGuildMemberRemove(@Nonnull GuildMemberRemoveEvent event) {
|
||||
|
||||
net.dv8tion.jda.api.entities.User discordUser = event.getUser();
|
||||
User user = UserService.getInstance().getOrCreateUser(discordUser.getId());
|
||||
@ -37,7 +37,7 @@ public class GuildMemberLeaveListener extends ListenerAdapter {
|
||||
|
||||
|
||||
StringBuilder description = new StringBuilder();
|
||||
description.append(byeMessage.getMessage().replaceAll("%username%", "**" + discordUser.getEffectiveName() + "**"));
|
||||
description.append(byeMessage.getMessage().replace("%username%", "**" + discordUser.getEffectiveName() + "**"));
|
||||
|
||||
EmbedBuilder embedBuilder = new EmbedBuilder()
|
||||
.setTitle(user.getRank().getByeTitle() != null ? user.getRank().getByeTitle() : "Au revoir, %s !".formatted(discordUser.getEffectiveName()))
|
||||
|
@ -5,6 +5,7 @@ import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.events.session.ReadyEvent;
|
||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||
import javax.annotation.Nonnull;
|
||||
import org.camelia.studio.gachamelia.models.User;
|
||||
import org.camelia.studio.gachamelia.repossitories.RankRepository;
|
||||
import org.camelia.studio.gachamelia.services.RankService;
|
||||
@ -18,7 +19,7 @@ public class ReadyListener extends ListenerAdapter {
|
||||
|
||||
|
||||
@Override
|
||||
public void onReady(ReadyEvent event) {
|
||||
public void onReady(@Nonnull ReadyEvent event) {
|
||||
logger.info("Connecté en tant que {}", event.getJDA().getSelfUser().getAsTag());
|
||||
initDatabase(event.getJDA());
|
||||
}
|
||||
|
@ -2,8 +2,8 @@ package org.camelia.studio.gachamelia.listeners;
|
||||
|
||||
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||
import javax.annotation.Nonnull;
|
||||
import org.camelia.studio.gachamelia.managers.CommandManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class SlashCommandListener extends ListenerAdapter {
|
||||
private final CommandManager commandManager;
|
||||
@ -15,7 +15,7 @@ public class SlashCommandListener extends ListenerAdapter {
|
||||
|
||||
|
||||
@Override
|
||||
public void onSlashCommandInteraction(@NotNull SlashCommandInteractionEvent event) {
|
||||
public void onSlashCommandInteraction(@Nonnull SlashCommandInteractionEvent event) {
|
||||
event.deferReply().setEphemeral(true).queue();
|
||||
commandManager.handleCommand(event.getName(), event);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user