diff --git a/discordbot/src/main/java/zone/themcgamer/discordbot/MGZBot.java b/discordbot/src/main/java/zone/themcgamer/discordbot/MGZBot.java
index ac2a2f2..dd9be36 100644
--- a/discordbot/src/main/java/zone/themcgamer/discordbot/MGZBot.java
+++ b/discordbot/src/main/java/zone/themcgamer/discordbot/MGZBot.java
@@ -7,10 +7,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.requests.GatewayIntent;
-import zone.themcgamer.discordbot.command.impl.InviteCommand;
-import zone.themcgamer.discordbot.command.impl.SetActivityCommand;
-import zone.themcgamer.discordbot.command.impl.SuggestCommand;
-import zone.themcgamer.discordbot.command.impl.ToggleNewsRoleCommand;
+import zone.themcgamer.discordbot.command.impl.*;
import zone.themcgamer.discordbot.events.GuildMemberJoinQuitListener;
import javax.security.auth.login.LoginException;
@@ -39,6 +36,7 @@ public class MGZBot {
commandClientBuilder.addCommand(new SetActivityCommand());
commandClientBuilder.addCommand(new ToggleNewsRoleCommand());
commandClientBuilder.addCommand(new InviteCommand());
+ commandClientBuilder.addCommand(new SayCommand());
try {
jda = JDABuilder.createDefault(BotConstants.TOKEN)
diff --git a/discordbot/src/main/java/zone/themcgamer/discordbot/command/impl/SayCommand.java b/discordbot/src/main/java/zone/themcgamer/discordbot/command/impl/SayCommand.java
new file mode 100644
index 0000000..9752ffc
--- /dev/null
+++ b/discordbot/src/main/java/zone/themcgamer/discordbot/command/impl/SayCommand.java
@@ -0,0 +1,41 @@
+package zone.themcgamer.discordbot.command.impl;
+
+import com.jagrosh.jdautilities.command.CommandEvent;
+import net.dv8tion.jda.api.EmbedBuilder;
+import net.dv8tion.jda.api.Permission;
+import zone.themcgamer.discordbot.command.BaseCommand;
+import zone.themcgamer.discordbot.guild.Guild;
+import zone.themcgamer.discordbot.utilities.EmbedUtils;
+import zone.themcgamer.discordbot.utilities.MessageUtils;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class SayCommand extends BaseCommand {
+
+ public SayCommand() {
+ name = "say";
+ aliases = new String[]{"announce"};
+ help = "Announce something in an embed format.";
+ arguments = "
";
+ userPermissions = new Permission[] { Permission.ADMINISTRATOR };
+ guildOnly = true;
+ guilds = Arrays.asList(Guild.MAIN, Guild.TEAM, Guild.TEST);
+ }
+
+ @Override
+ protected void execute(CommandEvent event, List args) {
+ if (args.size() < 1) {
+ MessageUtils.sendUsageMessage(event.getTextChannel(),this);
+ return;
+ }
+
+ //TODO a way to add images, and such to the embeds.
+ String description = args.stream().skip(2).collect(Collectors.joining(" "));
+ EmbedBuilder embedBuilder = EmbedUtils.defaultEmbed();
+ embedBuilder.setTitle(args.get(1));
+ embedBuilder.setDescription(description);
+ event.getChannel().sendMessage(embedBuilder.build()).queue();
+ }
+}
diff --git a/discordbot/src/main/java/zone/themcgamer/discordbot/command/impl/SetActivityCommand.java b/discordbot/src/main/java/zone/themcgamer/discordbot/command/impl/SetActivityCommand.java
index 9a152da..bb5ff97 100644
--- a/discordbot/src/main/java/zone/themcgamer/discordbot/command/impl/SetActivityCommand.java
+++ b/discordbot/src/main/java/zone/themcgamer/discordbot/command/impl/SetActivityCommand.java
@@ -8,6 +8,7 @@ import zone.themcgamer.discordbot.MGZBot;
import zone.themcgamer.discordbot.command.BaseCommand;
import zone.themcgamer.discordbot.guild.Guild;
import zone.themcgamer.discordbot.utilities.EmbedUtils;
+import zone.themcgamer.discordbot.utilities.MessageUtils;
import java.util.Arrays;
import java.util.List;
@@ -29,10 +30,7 @@ public class SetActivityCommand extends BaseCommand {
@Override
protected void execute(CommandEvent event, List args) {
if (args.size() < 1) {
- event.getChannel().sendMessage(EmbedUtils.errorEmbed()
- .appendDescription("Usage: " + BotConstants.PREFIX + name + " " + arguments)
- .build()
- ).queue();
+ MessageUtils.sendUsageMessage(event.getTextChannel(),this);
return;
}
String activity = args.stream().skip(1).collect(Collectors.joining(" "));
diff --git a/discordbot/src/main/java/zone/themcgamer/discordbot/command/impl/SuggestCommand.java b/discordbot/src/main/java/zone/themcgamer/discordbot/command/impl/SuggestCommand.java
index adf1098..daff105 100644
--- a/discordbot/src/main/java/zone/themcgamer/discordbot/command/impl/SuggestCommand.java
+++ b/discordbot/src/main/java/zone/themcgamer/discordbot/command/impl/SuggestCommand.java
@@ -7,6 +7,7 @@ import zone.themcgamer.discordbot.MGZBot;
import zone.themcgamer.discordbot.command.BaseCommand;
import zone.themcgamer.discordbot.guild.Guild;
import zone.themcgamer.discordbot.utilities.EmbedUtils;
+import zone.themcgamer.discordbot.utilities.MessageUtils;
import java.util.Collections;
import java.util.List;
@@ -28,10 +29,7 @@ public class SuggestCommand extends BaseCommand {
@Override
protected void execute(CommandEvent event, List args) {
if (args.size() < 1) {
- event.getChannel().sendMessage(EmbedUtils.errorEmbed()
- .appendDescription("Usage: " + BotConstants.PREFIX + name + " " + arguments)
- .build()
- ).queue();
+ MessageUtils.sendUsageMessage(event.getTextChannel(),this);
return;
}
TextChannel channel = MGZBot.getInstance().getJda().getTextChannelById(BotConstants.SUGGESTIONS);
diff --git a/discordbot/src/main/java/zone/themcgamer/discordbot/utilities/MessageUtils.java b/discordbot/src/main/java/zone/themcgamer/discordbot/utilities/MessageUtils.java
new file mode 100644
index 0000000..61c45a2
--- /dev/null
+++ b/discordbot/src/main/java/zone/themcgamer/discordbot/utilities/MessageUtils.java
@@ -0,0 +1,15 @@
+package zone.themcgamer.discordbot.utilities;
+
+import net.dv8tion.jda.api.entities.TextChannel;
+import zone.themcgamer.discordbot.BotConstants;
+import zone.themcgamer.discordbot.command.BaseCommand;
+
+public class MessageUtils {
+
+ public static void sendUsageMessage(TextChannel textChannel, BaseCommand command) {
+ textChannel.sendMessage(EmbedUtils.errorEmbed()
+ .appendDescription("Usage: " + BotConstants.PREFIX + command.getName() + " " + command.getArguments())
+ .build()
+ ).queue();
+ }
+}