diff --git a/src/main/java/com/mazawrath/beanbot/Main.java b/src/main/java/com/mazawrath/beanbot/Main.java index 10a9fa1..37a4a3a 100644 --- a/src/main/java/com/mazawrath/beanbot/Main.java +++ b/src/main/java/com/mazawrath/beanbot/Main.java @@ -5,6 +5,7 @@ import com.mazawrath.beanbot.commands.beancoin.*; import com.mazawrath.beanbot.commands.copypasta.*; import com.mazawrath.beanbot.commands.maza.MazaAddBeanCoinCommand; +import com.mazawrath.beanbot.commands.maza.MazaDeleteMessageCommand; import com.mazawrath.beanbot.commands.maza.MazapostchangelogCommand; import com.mazawrath.beanbot.utilities.Points; import de.btobastian.sdcf4j.CommandHandler; @@ -41,6 +42,7 @@ public static void main(String[] args) { cmdHandler.registerCommand(new BeanboardCommand(dbConn)); // Mazawrath commands cmdHandler.registerCommand(new MazapostchangelogCommand()); + cmdHandler.registerCommand(new MazaDeleteMessageCommand()); cmdHandler.registerCommand(new MazaAddBeanCoinCommand(dbConn)); // Copypasta cmdHandler.registerCommand(new Top500Command(dbConn)); diff --git a/src/main/java/com/mazawrath/beanbot/commands/maza/MazaDeleteMessageCommand.java b/src/main/java/com/mazawrath/beanbot/commands/maza/MazaDeleteMessageCommand.java new file mode 100644 index 0000000..fc46899 --- /dev/null +++ b/src/main/java/com/mazawrath/beanbot/commands/maza/MazaDeleteMessageCommand.java @@ -0,0 +1,27 @@ +package com.mazawrath.beanbot.commands.maza; + +import de.btobastian.sdcf4j.Command; +import de.btobastian.sdcf4j.CommandExecutor; +import org.javacord.api.DiscordApi; +import org.javacord.api.entity.channel.ServerTextChannel; +import org.javacord.api.entity.server.Server; +import org.javacord.api.entity.user.User; + +public class MazaDeleteMessageCommand implements CommandExecutor { + @Command( + aliases = {"mazadeletemessage"}, + privateMessages = false, + showInHelpPage = false + ) + + public void onCommand(String command, String channelID, String messageId, ServerTextChannel serverTextChannel2, DiscordApi api, User author, Server server) { + if (author.isBotOwner()) { + serverTextChannel2.sendMessage(messageId + " deleted."); + server.getTextChannelById(channelID).ifPresent(serverTextChannel -> { + serverTextChannel.deleteMessages(messageId); + }); + } else + // There is no better var name than this and if you think otherwise you're wrong. + serverTextChannel2.sendMessage("Only Mazawrath can send this message."); + } +}