-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/main/java/com/mazawrath/beanbot/commands/maza/MazaDeleteMessageCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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."); | ||
} | ||
} |