From cf1a715ddf7e261eafd9a5f37d3da6b8046950f5 Mon Sep 17 00:00:00 2001 From: Aleksei Date: Thu, 23 Jul 2020 16:42:46 -0400 Subject: [PATCH] Added command for privacy policy --- .../commands/general/PrivacyCommand.java | 36 +++++++++++++++++++ .../dev/salmonllama/fsbot/guthix/Guthix.java | 1 + 2 files changed, 37 insertions(+) create mode 100644 src/main/java/dev/salmonllama/fsbot/commands/general/PrivacyCommand.java diff --git a/src/main/java/dev/salmonllama/fsbot/commands/general/PrivacyCommand.java b/src/main/java/dev/salmonllama/fsbot/commands/general/PrivacyCommand.java new file mode 100644 index 0000000..253f115 --- /dev/null +++ b/src/main/java/dev/salmonllama/fsbot/commands/general/PrivacyCommand.java @@ -0,0 +1,36 @@ +package dev.salmonllama.fsbot.commands.general; + +import dev.salmonllama.fsbot.guthix.Command; +import dev.salmonllama.fsbot.guthix.CommandContext; +import dev.salmonllama.fsbot.guthix.CommandPermission; +import dev.salmonllama.fsbot.guthix.PermissionType; +import org.javacord.api.entity.message.embed.EmbedBuilder; + +import java.util.Collection; +import java.util.Collections; + +public class PrivacyCommand extends Command { + @Override public String name() { return "Privacy"; } + @Override public String description() { return "Directs users to the bot's privacy policy"; } + @Override public String usage() { return "privacy"; } + @Override public String category() { return "General"; } + @Override public CommandPermission permission() { return new CommandPermission(PermissionType.NONE); } + @Override public Collection aliases() { return Collections.singletonList("privacy"); } + + + @Override + public void onCommand(CommandContext ctx) { + String privacyUrl = "https://github.com/Salmonllama/Fashionscape-Bot/blob/database-rewrite/privacy.md"; // TODO: Change this to master + + EmbedBuilder response = new EmbedBuilder() + .setTitle("Click Here to open") + .setUrl(privacyUrl); + + EmbedBuilder response2 = new EmbedBuilder() + .setTitle("Link") + .setDescription(privacyUrl) + .setAuthor(ctx.getApi().getYourself()); + + ctx.reply(response).thenAcceptAsync(msg -> ctx.reply(response2)); + } +} diff --git a/src/main/java/dev/salmonllama/fsbot/guthix/Guthix.java b/src/main/java/dev/salmonllama/fsbot/guthix/Guthix.java index 974f4bd..bda093b 100644 --- a/src/main/java/dev/salmonllama/fsbot/guthix/Guthix.java +++ b/src/main/java/dev/salmonllama/fsbot/guthix/Guthix.java @@ -63,6 +63,7 @@ public class Guthix implements MessageCreateListener { addCommand(new OutfitCommand()); addCommand(new HelpCommand(this)); addCommand(new StatsCommand()); + addCommand(new PrivacyCommand()); } public void addCommand(Command cmd) {