Skip to content

Commit 3cbce7f

Browse files
added /say, removed reply in Embed.java
1 parent db12fac commit 3cbce7f

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed

src/main/java/com/javadiscord/javabot/commands/moderation/Embed.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ private ReplyAction createEmbed(SlashCommandEvent event) {
8080
eb.setThumbnail(thumb);
8181
eb.setColor(Color.decode(color));
8282

83-
return event.replyEmbeds(eb.build());
83+
event.getChannel().sendMessageEmbeds(eb.build()).queue();
84+
return event.reply("Done!").setEphemeral(true);
8485

8586
} catch (Exception e) {
8687
return event.replyEmbeds(Embeds.emptyError("```" + e.getMessage() + "```", event.getUser())).setEphemeral(Constants.ERR_EPHEMERAL);
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package com.javadiscord.javabot.commands.moderation;
2+
3+
import com.javadiscord.javabot.commands.SlashCommandHandler;
4+
import com.javadiscord.javabot.other.Constants;
5+
import com.javadiscord.javabot.other.Database;
6+
import com.javadiscord.javabot.other.Embeds;
7+
import com.javadiscord.javabot.other.Misc;
8+
import net.dv8tion.jda.api.EmbedBuilder;
9+
import net.dv8tion.jda.api.Permission;
10+
import net.dv8tion.jda.api.entities.Member;
11+
import net.dv8tion.jda.api.events.interaction.SlashCommandEvent;
12+
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
13+
import net.dv8tion.jda.api.requests.restaction.interactions.ReplyAction;
14+
15+
import javax.imageio.ImageIO;
16+
import javax.swing.*;
17+
import java.awt.image.BufferedImage;
18+
import java.io.ByteArrayInputStream;
19+
import java.io.File;
20+
import java.net.URL;
21+
import java.nio.file.Paths;
22+
import java.util.Date;
23+
import java.util.concurrent.TimeUnit;
24+
25+
public class Say implements SlashCommandHandler {
26+
27+
@Override
28+
public ReplyAction handle(SlashCommandEvent event) {
29+
if (!event.getMember().hasPermission(Permission.ADMINISTRATOR)) {
30+
return event.replyEmbeds(Embeds.permissionError("ADMINISTRATOR", event)).setEphemeral(Constants.ERR_EPHEMERAL);
31+
}
32+
33+
String text = event.getOption("text").getAsString();
34+
35+
event.getChannel().sendMessage(text).queue();
36+
return event.reply("Done!").setEphemeral(true);
37+
}
38+
}

src/main/resources/commands.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
- {description: The id the bot will convert into a human-readable timestamp, name: id,
2424
required: true, type: STRING}
2525
handler: com.javadiscord.javabot.commands.user_commands.IDCalc
26+
- description: Let the bot say everything you want
27+
name: say
28+
options:
29+
- {description: The text the bot should say, name: text,
30+
required: true, type: STRING}
31+
handler: com.javadiscord.javabot.commands.moderation.Say
2632
- description: Turns your text-input into a lmgtfy-link
2733
name: lmgtfy
2834
options:

0 commit comments

Comments
 (0)