-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add VIP role logic * Formatting * Remove testing code * Add VIP role logic * Formatting * Remove testing code * Owen's requested changes * Create roles on start up * Only create stars for roles without icons * Changes and small bug fixes * Fix bugs + make messages work in threads
- Loading branch information
1 parent
59cf40b
commit 9f4435c
Showing
22 changed files
with
253 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,4 @@ build | |
/src/main/resources/swear_filter.json | ||
|
||
*.json | ||
*.png | ||
*.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/main/java/com/diamondfire/helpbot/sys/tasks/impl/VIPStarTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.diamondfire.helpbot.sys.tasks.impl; | ||
|
||
import com.diamondfire.helpbot.bot.HelpBotInstance; | ||
import com.diamondfire.helpbot.sys.tasks.LoopingTask; | ||
import com.diamondfire.helpbot.sys.vip.VIPRoleHandler; | ||
import net.dv8tion.jda.api.entities.Guild; | ||
import net.dv8tion.jda.api.entities.Member; | ||
import net.dv8tion.jda.api.entities.Role; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
public class VIPStarTask implements LoopingTask { | ||
|
||
@Override | ||
public long getInitialStart() { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public long getNextLoop() { | ||
return TimeUnit.MINUTES.toMillis(30L); | ||
} | ||
|
||
@Override | ||
public void run() { | ||
Guild guild = HelpBotInstance.getJda().getGuildById(HelpBotInstance.DF_GUILD); | ||
Set<Long> vipIds = VIPRoleHandler.retrieveVIPs(); | ||
|
||
guild.loadMembers((member) -> { | ||
Role role = VIPRoleHandler.getRole(member.getColorRaw()); | ||
if (role == null) { | ||
return; | ||
} | ||
if (vipIds.contains(member.getIdLong()) && !member.getRoles().contains(role)) { | ||
guild.addRoleToMember(member, role) | ||
.reason("User has VIP Pass") | ||
.queue(); | ||
return; | ||
} | ||
if (!vipIds.contains(member.getIdLong()) && member.getRoles().contains(role)) { | ||
guild.removeRoleFromMember(member, role) | ||
.reason("User's VIP Pass has expired") | ||
.queue(); | ||
} | ||
}); | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.