SteamWar/BungeeCore
Archiviert
13
2

discord-bot #230

Manuell gemergt
YoyoNow hat 38 Commits von discord-bot nach master 2021-07-28 23:59:27 +02:00 zusammengeführt
2 geänderte Dateien mit 25 neuen und 3 gelöschten Zeilen
Nur Änderungen aus Commit a07c82bc13 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -19,6 +19,7 @@
package de.steamwar.bungeecore.bot;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.bot.config.SteamwarDiscordBotConfig;
import de.steamwar.bungeecore.bot.listeners.RolesInteractionButtonListener;
import de.steamwar.bungeecore.bot.util.DiscordRolesMessage;
@ -27,14 +28,18 @@ import lombok.Getter;
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 net.dv8tion.jda.internal.entities.SelfUserImpl;
import net.md_5.bungee.api.ProxyServer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.security.auth.login.LoginException;
import java.util.EnumSet;
import java.util.concurrent.TimeUnit;
public class SteamwarDiscordBot {
@ -50,7 +55,7 @@ public class SteamwarDiscordBot {
public SteamwarDiscordBot() {
INSTANCE = this;
JDABuilder builder = JDABuilder.createDefault(SteamwarDiscordBotConfig.TOKEN);
builder.setActivity(new RichPresence() {
/*builder.setActivity(new RichPresence() {
@Override
public long getApplicationIdLong() {
return 869611389818400779L;
@ -154,7 +159,8 @@ public class SteamwarDiscordBot {
public Emoji getEmoji() {
return null;
}
});
});*/
builder.setStatus(OnlineStatus.ONLINE);
try {
jda = builder.build();
@ -166,12 +172,28 @@ public class SteamwarDiscordBot {
} catch (InterruptedException e) {
e.printStackTrace();
}
ProxyServer.getInstance().getScheduler().schedule(BungeeCore.get(), this::activity, 30, 0, TimeUnit.SECONDS);
DiscordRolesMessage.sendMessage();
DiscordRulesMessage.sendMessage();
new RolesInteractionButtonListener();
}
private int index = 0;
private void activity() {
switch (index) {
case 0:
jda.getPresence().setActivity(Activity.playing("SteamWar.de"));
break;
case 1:
jda.getPresence().setActivity(Activity.of(Activity.ActivityType.DEFAULT, "Online: " + BungeeCore.get().getProxy().getOnlineCount()));
index = 0;
return;
}
index++;
}
public void addListener(ListenerAdapter listenerAdapter) {
jda.addEventListener(listenerAdapter);
}

Datei anzeigen

@ -42,7 +42,7 @@ public class DiscordRulesMessage {
EmbedBuilder builder = new EmbedBuilder();
builder.setDescription(SteamwarDiscordBotConfig.RULES_RULES.stream().reduce((s, s2) -> s + "\n" + s2).get());
builder.setColor(Color.CYAN);
builder.setColor(Color.GRAY);
builder.setAuthor("SteamWar", "https://www.steamwar.de");
builder.setTitle(SteamwarDiscordBotConfig.RULES_TITLE);