forked from Fascinated/Bat
only check guilds that we're in
This commit is contained in:
parent
c93e112ebf
commit
be7f8a9057
@ -8,8 +8,10 @@ import cc.fascinated.bat.features.birthday.profile.BirthdayProfile;
|
|||||||
import cc.fascinated.bat.model.BatGuild;
|
import cc.fascinated.bat.model.BatGuild;
|
||||||
import cc.fascinated.bat.model.BatUser;
|
import cc.fascinated.bat.model.BatUser;
|
||||||
import cc.fascinated.bat.service.CommandService;
|
import cc.fascinated.bat.service.CommandService;
|
||||||
|
import cc.fascinated.bat.service.DiscordService;
|
||||||
import cc.fascinated.bat.service.GuildService;
|
import cc.fascinated.bat.service.GuildService;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
|
import net.dv8tion.jda.api.entities.Guild;
|
||||||
import net.dv8tion.jda.api.events.guild.member.GuildMemberRemoveEvent;
|
import net.dv8tion.jda.api.events.guild.member.GuildMemberRemoveEvent;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
@ -40,9 +42,14 @@ public class BirthdayFeature extends Feature implements EventListener {
|
|||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 1 0 * * *")
|
@Scheduled(cron = "0 1 0 * * *")
|
||||||
private void checkBirthdays() {
|
private void checkBirthdays() {
|
||||||
for (BatGuild guild : guildService.getGuilds().values()) {
|
for (Guild guild : DiscordService.JDA.getGuilds()) {
|
||||||
BirthdayProfile profile = guild.getBirthdayProfile();
|
BatGuild batGuild = guildService.getGuild(guild.getId());
|
||||||
profile.checkBirthdays(guild);
|
if (batGuild == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
BirthdayProfile profile = batGuild.getBirthdayProfile();
|
||||||
|
profile.checkBirthdays(batGuild);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user