From f6e6c191a7c4b530c789b2650f7c55b671845d62 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Wed, 28 Jul 2021 15:12:05 +0200 Subject: [PATCH] Add SteamwarDiscordBot rich presence --- .../bungeecore/bot/SteamwarDiscordBot.java | 151 ++++++++++++++++++ 1 file changed, 151 insertions(+) diff --git a/src/de/steamwar/bungeecore/bot/SteamwarDiscordBot.java b/src/de/steamwar/bungeecore/bot/SteamwarDiscordBot.java index 91ab97f..2fc6aee 100644 --- a/src/de/steamwar/bungeecore/bot/SteamwarDiscordBot.java +++ b/src/de/steamwar/bungeecore/bot/SteamwarDiscordBot.java @@ -28,9 +28,14 @@ import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.JDABuilder; import net.dv8tion.jda.api.OnlineStatus; 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 org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import javax.security.auth.login.LoginException; +import java.util.EnumSet; public class SteamwarDiscordBot { @@ -46,6 +51,152 @@ public class SteamwarDiscordBot { public SteamwarDiscordBot() { INSTANCE = this; JDABuilder builder = JDABuilder.createDefault(SteamwarDiscordBotConfig.TOKEN); + builder.setActivity(new Activity() { + @Override + public boolean isRich() { + return true; + } + + @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; + } + }; + } + + @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; + } + }); builder.setActivity(Activity.playing("auf Steamwar.de")); builder.setStatus(OnlineStatus.ONLINE); try {