diff --git a/src/de/steamwar/bungeecore/bot/SteamwarDiscordBot.java b/src/de/steamwar/bungeecore/bot/SteamwarDiscordBot.java index 295db915..f4c28308 100644 --- a/src/de/steamwar/bungeecore/bot/SteamwarDiscordBot.java +++ b/src/de/steamwar/bungeecore/bot/SteamwarDiscordBot.java @@ -20,6 +20,8 @@ package de.steamwar.bungeecore.bot; import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.bot.commands.BanCommand; +import de.steamwar.bungeecore.bot.commands.MuteCommand; import de.steamwar.bungeecore.bot.config.SteamwarDiscordBotConfig; import de.steamwar.bungeecore.bot.events.EventManager; import de.steamwar.bungeecore.bot.listeners.*; @@ -33,6 +35,7 @@ import net.dv8tion.jda.api.JDABuilder; import net.dv8tion.jda.api.OnlineStatus; import net.dv8tion.jda.api.entities.Activity; import net.dv8tion.jda.api.hooks.ListenerAdapter; +import net.dv8tion.jda.api.requests.restaction.CommandListUpdateAction; import net.dv8tion.jda.api.utils.MemberCachePolicy; import net.md_5.bungee.api.ProxyServer; @@ -90,6 +93,11 @@ public class SteamwarDiscordBot { announcementListener = new AnnouncementListener(); ingameChatListener = new IngameChatListener(); serverTeamChatListener = new ServerTeamChatListener(); + + CommandListUpdateAction commands = jda.updateCommands(); + commands.addCommands(new MuteCommand()); + commands.addCommands(new BanCommand()); + commands.complete(); } private int index = 0; diff --git a/src/de/steamwar/bungeecore/bot/commands/BanCommand.java b/src/de/steamwar/bungeecore/bot/commands/BanCommand.java new file mode 100644 index 00000000..e73dd82a --- /dev/null +++ b/src/de/steamwar/bungeecore/bot/commands/BanCommand.java @@ -0,0 +1,33 @@ +/* + * 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 . + */ + +package de.steamwar.bungeecore.bot.commands; + +import net.dv8tion.jda.api.interactions.commands.OptionType; +import net.dv8tion.jda.api.interactions.commands.build.CommandData; + +public class BanCommand extends CommandData { + + public BanCommand() { + super("ban", "Ban a user. Requires permission to ban users."); + + addOption(OptionType.STRING, "user", "The user to bam", true); + addOption(OptionType.STRING, "duration", "The time to ban until", true); + } +} diff --git a/src/de/steamwar/bungeecore/bot/commands/MuteCommand.java b/src/de/steamwar/bungeecore/bot/commands/MuteCommand.java new file mode 100644 index 00000000..2a6cb819 --- /dev/null +++ b/src/de/steamwar/bungeecore/bot/commands/MuteCommand.java @@ -0,0 +1,33 @@ +/* + * 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 . + */ + +package de.steamwar.bungeecore.bot.commands; + +import net.dv8tion.jda.api.interactions.commands.OptionType; +import net.dv8tion.jda.api.interactions.commands.build.CommandData; + +public class MuteCommand extends CommandData { + + public MuteCommand() { + super("mute", "Mute a user. Requires permission to mute users."); + + addOption(OptionType.STRING, "user", "The user to mute", true); + addOption(OptionType.STRING, "duration", "The time to mute until", true); + } +}