🚑 Fix userstats for cache

This commit is contained in:
SebClem 2020-11-23 14:41:02 +01:00
parent 8dd6c760dc
commit 4bafcb33f4
2 changed files with 3 additions and 3 deletions

View File

@ -194,8 +194,8 @@ public class UserStatsUtils {
List<UserStats> allStats = userStatsRepository.findByGuildId(guildId);
List<GuildStats> ranked = new ArrayList<>();
for (UserStats stats : allStats) {
if (MainBot.jda.getUserById(stats.getUser().getJdaId()) != null) {
String avatar = MainBot.jda.getUserById(stats.getUser().getJdaId()).getEffectiveAvatarUrl();
if (CacheTools.getJdaUser(stats.getUser()) != null) {
String avatar = CacheTools.getJdaUser(stats.getUser()).getEffectiveAvatarUrl();
GuildStats temp = new GuildStats(stats.getUser().getName(), 0, avatar, stats.getVocalTime(), stats.getMessageCount(), stats.getApiCommandCount());
if (stats.getUser().getId().equals(userEntity.getId())) {

View File

@ -168,7 +168,7 @@ public class GeneralWebView {
model.addAttribute("stack", stack);
try {
UserEntity userE = userUtils.getUserWithApiToken(userRepository, token);
User user = MainBot.jda.getUserById(userE.getJdaId());
User user = CacheTools.getJdaUser(userE);
addGuildAndRedirect(model, token, cookieGuildId, user);
} catch (UnknownTokenException e) {
throw new ForbiddenException();