SteamWar/BungeeCore
Archiviert
13
2

Merge branch 'discord-bot'

Dieser Commit ist enthalten in:
yoyosource 2021-07-30 12:31:18 +02:00
Commit 82a67448f3
7 geänderte Dateien mit 55 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -22,6 +22,7 @@ package de.steamwar.bungeecore.bot;
import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.bot.commands.BanCommand; import de.steamwar.bungeecore.bot.commands.BanCommand;
import de.steamwar.bungeecore.bot.commands.MuteCommand; import de.steamwar.bungeecore.bot.commands.MuteCommand;
import de.steamwar.bungeecore.bot.commands.TeamCommand;
import de.steamwar.bungeecore.bot.commands.WhoisCommand; import de.steamwar.bungeecore.bot.commands.WhoisCommand;
import de.steamwar.bungeecore.bot.config.SteamwarDiscordBotConfig; import de.steamwar.bungeecore.bot.config.SteamwarDiscordBotConfig;
import de.steamwar.bungeecore.bot.events.EventManager; import de.steamwar.bungeecore.bot.events.EventManager;
@ -108,6 +109,7 @@ public class SteamwarDiscordBot {
commands.addCommands(new MuteCommand()); commands.addCommands(new MuteCommand());
commands.addCommands(new BanCommand()); commands.addCommands(new BanCommand());
commands.addCommands(new WhoisCommand()); commands.addCommands(new WhoisCommand());
commands.addCommands(new TeamCommand());
commands.complete(); commands.complete();
} }

Datei anzeigen

@ -25,10 +25,10 @@ import net.dv8tion.jda.api.interactions.commands.build.CommandData;
public class BanCommand extends CommandData { public class BanCommand extends CommandData {
public BanCommand() { public BanCommand() {
super("ban", "Ban a user. Requires permission to ban users."); super("ban", "Banne einen Nutzer, wenn du die Rechte hast.");
addOption(OptionType.STRING, "user", "The user to bam", true); addOption(OptionType.STRING, "user", "Der Benutzer", true);
addOption(OptionType.STRING, "time", "The time to ban until", true); addOption(OptionType.STRING, "time", "Bis Wann", true);
addOption(OptionType.STRING, "reason", "The reason to ban", true); addOption(OptionType.STRING, "reason", "Warum", true);
} }
} }

Datei anzeigen

@ -25,10 +25,10 @@ import net.dv8tion.jda.api.interactions.commands.build.CommandData;
public class MuteCommand extends CommandData { public class MuteCommand extends CommandData {
public MuteCommand() { public MuteCommand() {
super("mute", "Mute a user. Requires permission to mute users."); super("mute", "Mute einen Nutzer, wenn du die Rechte hast.");
addOption(OptionType.STRING, "user", "The user to mute", true); addOption(OptionType.STRING, "user", "Der Benutzer", true);
addOption(OptionType.STRING, "time", "The time to mute until", true); addOption(OptionType.STRING, "time", "Bis Wann", true);
addOption(OptionType.STRING, "reason", "The reason to mute", true); addOption(OptionType.STRING, "reason", "Warum", true);
} }
} }

Datei anzeigen

@ -0,0 +1,35 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bungeecore.bot.commands;
import net.dv8tion.jda.api.interactions.commands.OptionType;
import net.dv8tion.jda.api.interactions.commands.build.CommandData;
import net.dv8tion.jda.api.interactions.commands.build.SubcommandData;
public class TeamCommand extends CommandData {
public TeamCommand() {
super("team", "Alle Team bezogenen Befehle");
addSubcommands(new SubcommandData("info", "Infos über das Team oder deins")
.addOption(OptionType.STRING, "team", "Name oder Kuerzel", false)
);
}
}

Datei anzeigen

@ -25,8 +25,8 @@ import net.dv8tion.jda.api.interactions.commands.build.CommandData;
public class WhoisCommand extends CommandData { public class WhoisCommand extends CommandData {
public WhoisCommand() { public WhoisCommand() {
super("whois", "Check a users id and stuff"); super("whois", "Der whois Befehl");
addOption(OptionType.STRING, "user", "The user to get", true); addOption(OptionType.STRING, "user", "Der Benutzer", true);
} }
} }

Datei anzeigen

@ -62,7 +62,7 @@ public class IngameChatListener extends BasicDiscordListener {
TextChannel textChannel = SteamwarDiscordBot.instance().getJda().getGuildById(SteamwarDiscordBotConfig.GUILD).getTextChannelById(SteamwarDiscordBotConfig.INGAME_CHANNEL); TextChannel textChannel = SteamwarDiscordBot.instance().getJda().getGuildById(SteamwarDiscordBotConfig.GUILD).getTextChannelById(SteamwarDiscordBotConfig.INGAME_CHANNEL);
assert textChannel != null; assert textChannel != null;
MessageBuilder messageBuilder = new MessageBuilder(); MessageBuilder messageBuilder = new MessageBuilder();
messageBuilder.append(message.replace("&", "")); messageBuilder.append(message.replace("&", "").replace("@everyone", "").replace("@here", ""));
textChannel.sendMessage(messageBuilder.build()).complete(); textChannel.sendMessage(messageBuilder.build()).complete();
} }
} }

Datei anzeigen

@ -46,6 +46,9 @@ public class SlashCommandListener extends BasicDiscordListener {
case "whois": case "whois":
whois(event); whois(event);
break; break;
case "team":
team(event);
break;
default: default:
return; return;
} }
@ -135,6 +138,10 @@ public class SlashCommandListener extends BasicDiscordListener {
event.replyEmbeds(embedBuilder.build()).setEphemeral(true).complete(); event.replyEmbeds(embedBuilder.build()).setEphemeral(true).complete();
} }
private void team(SlashCommandEvent event) {
}
private boolean testPermission(SlashCommandEvent event) { private boolean testPermission(SlashCommandEvent event) {
Member member = event.getMember(); Member member = event.getMember();
SteamwarUser steamwarUser = SteamwarUser.get(member.getIdLong()); SteamwarUser steamwarUser = SteamwarUser.get(member.getIdLong());