Skip to content

Commit 2a54ce0

Browse files
committed
fix automatic removal of QOTW champions
1 parent 629ca9f commit 2a54ce0

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

src/main/java/net/discordjug/javabot/systems/qotw/dao/QOTWChampionRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public List<Long> getCurrentQOTWChampions(long guildId) {
3535
* @param users the QOTW champions
3636
*/
3737
public void setCurrentQOTWChampions(long guild, long[] users) {
38-
jdbcTemplate.update("DELETE FROM qotw_champion WHERE guild_id = ?");
38+
jdbcTemplate.update("DELETE FROM qotw_champion WHERE guild_id = ?", guild);
3939
List<Object[]> params = new ArrayList<>();
4040
for (long userId : users) {
4141
params.add(new Object[] {guild, userId});

src/main/java/net/discordjug/javabot/systems/qotw/jobs/QOTWChampionJob.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public void execute() {
5656
for (Member member : membersToAdd) {
5757
guild.addRoleToMember(member, qotwChampionRole).queue();
5858
}
59+
qotwChampionRepository.setCurrentQOTWChampions(guild.getIdLong(), membersToAdd.stream().mapToLong(Member::getIdLong).toArray());
5960
});
6061
});
6162
});

0 commit comments

Comments
 (0)