From 6a036808d57abc4e118eed17dbafcaf85141a865 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Wed, 28 Jul 2021 15:14:14 +0200 Subject: [PATCH] Add SteamwarDiscordBot rich presence --- .../bungeecore/bot/SteamwarDiscordBot.java | 174 +++++++----------- 1 file changed, 67 insertions(+), 107 deletions(-) diff --git a/src/de/steamwar/bungeecore/bot/SteamwarDiscordBot.java b/src/de/steamwar/bungeecore/bot/SteamwarDiscordBot.java index 2fc6aee..d125225 100644 --- a/src/de/steamwar/bungeecore/bot/SteamwarDiscordBot.java +++ b/src/de/steamwar/bungeecore/bot/SteamwarDiscordBot.java @@ -31,6 +31,7 @@ import net.dv8tion.jda.api.entities.Activity; import net.dv8tion.jda.api.entities.ActivityFlag; import net.dv8tion.jda.api.entities.RichPresence; import net.dv8tion.jda.api.hooks.ListenerAdapter; +import net.dv8tion.jda.internal.entities.RichPresenceImpl; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -51,7 +52,70 @@ public class SteamwarDiscordBot { public SteamwarDiscordBot() { INSTANCE = this; JDABuilder builder = JDABuilder.createDefault(SteamwarDiscordBotConfig.TOKEN); - builder.setActivity(new Activity() { + builder.setActivity(new RichPresence() { + @Override + public long getApplicationIdLong() { + return 0; + } + + @NotNull + @Override + public String getApplicationId() { + return "SteamWar"; + } + + @Nullable + @Override + public String getSessionId() { + return null; + } + + @Nullable + @Override + public String getSyncId() { + return null; + } + + @Override + public int getFlags() { + return 0; + } + + @Override + public EnumSet getFlagSet() { + return EnumSet.of(ActivityFlag.PLAY); + } + + @Nullable + @Override + public String getState() { + return "SteamWar"; + } + + @Nullable + @Override + public String getDetails() { + return "SteamWar"; + } + + @Nullable + @Override + public Party getParty() { + return new Party("", 0, 0); + } + + @Nullable + @Override + public Image getLargeImage() { + return null; + } + + @Nullable + @Override + public Image getSmallImage() { + return null; + } + @Override public boolean isRich() { return true; @@ -60,111 +124,7 @@ public class SteamwarDiscordBot { @Nullable @Override public RichPresence asRichPresence() { - return new RichPresence() { - @Override - public long getApplicationIdLong() { - return 0; - } - - @NotNull - @Override - public String getApplicationId() { - return "SteamWar"; - } - - @Nullable - @Override - public String getSessionId() { - return null; - } - - @Nullable - @Override - public String getSyncId() { - return null; - } - - @Override - public int getFlags() { - return 0; - } - - @Override - public EnumSet getFlagSet() { - return EnumSet.of(ActivityFlag.PLAY); - } - - @Nullable - @Override - public String getState() { - return "Test"; - } - - @Nullable - @Override - public String getDetails() { - return "Test"; - } - - @Nullable - @Override - public Party getParty() { - return new Party("", 0, 1); - } - - @Nullable - @Override - public Image getLargeImage() { - return null; - } - - @Nullable - @Override - public Image getSmallImage() { - return null; - } - - @Override - public boolean isRich() { - return false; - } - - @Nullable - @Override - public RichPresence asRichPresence() { - return null; - } - - @NotNull - @Override - public String getName() { - return "SteamWar"; - } - - @Nullable - @Override - public String getUrl() { - return null; - } - - @NotNull - @Override - public ActivityType getType() { - return ActivityType.DEFAULT; - } - - @Nullable - @Override - public Timestamps getTimestamps() { - return null; - } - - @Nullable - @Override - public Emoji getEmoji() { - return null; - } - }; + return null; } @NotNull @@ -182,7 +142,7 @@ public class SteamwarDiscordBot { @NotNull @Override public ActivityType getType() { - return ActivityType.DEFAULT; + return null; } @Nullable