SteamWar/BungeeCore
Archiviert
13
2

Add SteamwarDiscordBot rich presence

Dieser Commit ist enthalten in:
yoyosource 2021-07-28 15:12:05 +02:00
Ursprung 01cf6fdb58
Commit f6e6c191a7

Datei anzeigen

@ -28,9 +28,14 @@ import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.JDABuilder; import net.dv8tion.jda.api.JDABuilder;
import net.dv8tion.jda.api.OnlineStatus; import net.dv8tion.jda.api.OnlineStatus;
import net.dv8tion.jda.api.entities.Activity; 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.api.hooks.ListenerAdapter;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.security.auth.login.LoginException; import javax.security.auth.login.LoginException;
import java.util.EnumSet;
public class SteamwarDiscordBot { public class SteamwarDiscordBot {
@ -46,6 +51,152 @@ public class SteamwarDiscordBot {
public SteamwarDiscordBot() { public SteamwarDiscordBot() {
INSTANCE = this; INSTANCE = this;
JDABuilder builder = JDABuilder.createDefault(SteamwarDiscordBotConfig.TOKEN); 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<ActivityFlag> 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.setActivity(Activity.playing("auf Steamwar.de"));
builder.setStatus(OnlineStatus.ONLINE); builder.setStatus(OnlineStatus.ONLINE);
try { try {