Compare commits
2 Commits
1252763b68
...
41491890f5
Author | SHA1 | Date | |
---|---|---|---|
41491890f5 | |||
01923bb039 |
@ -105,7 +105,6 @@
|
|||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<!-- Error Reporting & Metrics -->
|
<!-- Error Reporting & Metrics -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.sentry</groupId>
|
<groupId>io.sentry</groupId>
|
||||||
|
@ -5,6 +5,7 @@ import lombok.AllArgsConstructor;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import net.dv8tion.jda.api.entities.Activity;
|
import net.dv8tion.jda.api.entities.Activity;
|
||||||
|
import net.dv8tion.jda.api.entities.emoji.CustomEmoji;
|
||||||
import net.dv8tion.jda.api.entities.emoji.EmojiUnion;
|
import net.dv8tion.jda.api.entities.emoji.EmojiUnion;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -38,7 +39,13 @@ public class CustomStatus {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
EmojiUnion emoji = activity.getEmoji();
|
EmojiUnion emoji = activity.getEmoji();
|
||||||
return new CustomStatus(activity.getName(), emoji == null ? null : emoji.asUnicode().getFormatted());
|
String emojiString = null;
|
||||||
|
if (emoji instanceof CustomEmoji customEmoji) {
|
||||||
|
emojiString = customEmoji.getImageUrl();
|
||||||
|
} else if (emoji != null) {
|
||||||
|
emojiString = emoji.asUnicode().getFormatted();
|
||||||
|
}
|
||||||
|
return new CustomStatus(activity.getName(), emojiString);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package me.braydon.tether.service;
|
|||||||
|
|
||||||
import com.github.benmanes.caffeine.cache.Cache;
|
import com.github.benmanes.caffeine.cache.Cache;
|
||||||
import com.github.benmanes.caffeine.cache.Caffeine;
|
import com.github.benmanes.caffeine.cache.Caffeine;
|
||||||
|
import io.questdb.cutlass.line.LineSenderException;
|
||||||
import jakarta.annotation.PostConstruct;
|
import jakarta.annotation.PostConstruct;
|
||||||
import kong.unirest.core.HttpResponse;
|
import kong.unirest.core.HttpResponse;
|
||||||
import kong.unirest.core.HttpStatus;
|
import kong.unirest.core.HttpStatus;
|
||||||
@ -130,7 +131,12 @@ public final class DiscordService extends ListenerAdapter {
|
|||||||
long before = System.currentTimeMillis();
|
long before = System.currentTimeMillis();
|
||||||
cachedUser = new CachedDiscordUser(getUser(snowflake, member != null), System.currentTimeMillis());
|
cachedUser = new CachedDiscordUser(getUser(snowflake, member != null), System.currentTimeMillis());
|
||||||
if (metricsEnabled) {
|
if (metricsEnabled) {
|
||||||
|
try {
|
||||||
UserLookupTimingsMetric.track(System.currentTimeMillis() - before);
|
UserLookupTimingsMetric.track(System.currentTimeMillis() - before);
|
||||||
|
} catch (LineSenderException | IllegalStateException ignored) {
|
||||||
|
// This can happen due to no metrics server being
|
||||||
|
// available, we can safely ignore it and continue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cachedUsers.put(snowflake, cachedUser);
|
cachedUsers.put(snowflake, cachedUser);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user