Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions config.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ addToTicketThread:
ratingNotificationChannels:
- 123456789012345678

# Channel IDs where rating notifications for ratings of 3 stars or lower are posted additionally
lowRatingNotificationChannels:
- 123456789012345678

# Custom claim emojis per user (userId: emoji)
claimEmojis:
123456789012345678: "🎫"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import java.awt.*;
import java.time.Instant;
import java.util.List;

@Slf4j
public class RatingModal implements Interaction {
Expand Down Expand Up @@ -137,7 +138,7 @@ private String getStarDisplay(int stars) {

private String sendRatingNotification(Ticket ticket, int stars, String message) {
String starDisplay = getStarDisplay(stars);
Color embedColor = stars >= 4 ? Color.GREEN : stars >= 3 ? Color.YELLOW : Color.RED;
Color embedColor = stars >= 4 ? Color.GREEN : stars == 3 ? Color.YELLOW : Color.RED;

// Generate HTML transcript and upload to log channel to get URL
String transcriptUrl = null;
Expand Down Expand Up @@ -196,7 +197,13 @@ private String sendRatingNotification(Ticket ticket, int stars, String message)
notification.addField("📝 Transcript", "[Hier klicken](" + transcriptUrl + ")", false);
}

for (Long channelId : config.getRatingNotificationChannels()) {
List<Long> ratingNotificationChannels = config.getRatingNotificationChannels();

if (stars <= 3) {
ratingNotificationChannels.addAll(config.getLowRatingNotificationChannels());
}

for (Long channelId : ratingNotificationChannels) {
var channel = jda.getTextChannelById(channelId);
if (channel != null) {
channel.sendMessageEmbeds(notification.build()).queue();
Expand Down
1 change: 1 addition & 0 deletions src/main/java/eu/greev/dcbot/utils/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class Config {
private int maxTicketsPerUser = 3;
private List<Long> addToTicketThread;
private List<Long> ratingNotificationChannels = new ArrayList<>();
private List<Long> lowRatingNotificationChannels = new ArrayList<>();
private Map<Long, String> claimEmojis = new HashMap<>();
private Map<String, Long> categories = new HashMap<>();
private Map<String, List<Long>> categoryRoles = new HashMap<>();
Expand Down