Use Lombok's @Slf4j in CommandSyncNitro and add logging for database changes during member checks.
This commit is contained in:
parent
a0b3d2167a
commit
47eb88cbae
|
|
@ -6,6 +6,7 @@ import com.alttd.config.MessagesConfig;
|
|||
import com.alttd.database.queries.QueriesUserByRole;
|
||||
import com.alttd.database.queries.QueriesUserDiscordId;
|
||||
import com.alttd.util.Util;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.dv8tion.jda.api.JDA;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
|
|
@ -24,6 +25,7 @@ import java.util.concurrent.Executors;
|
|||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Slf4j
|
||||
public class CommandSyncNitro extends DiscordCommand {
|
||||
|
||||
private final CommandData commandData;
|
||||
|
|
@ -87,10 +89,12 @@ public class CommandSyncNitro extends DiscordCommand {
|
|||
private void checkMember(Member member, long userId) {
|
||||
if (member == null) {
|
||||
QueriesUserDiscordId.removeLinkedUserByDiscordId(userId);
|
||||
log.info("User {} not found in guild. Removing from database.", userId);
|
||||
return;
|
||||
}
|
||||
boolean hasNitro = member.getRoles().stream().anyMatch(role -> role.getIdLong() == 585557866275012633L);
|
||||
if (!hasNitro) {
|
||||
log.info("User {} does not have nitro. Removing from database.", userId);
|
||||
QueriesUserDiscordId.removeRole(userId, "nitro");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user