From 7dc2cea4728a267978aec2b39e6435173640eb3a Mon Sep 17 00:00:00 2001 From: pitzzahh Date: Sat, 25 Feb 2023 22:52:06 +0800 Subject: [PATCH] add: ViewSubmittedJokes java record for making /view-submitted-jokes slash command for #65 --- .../ViewSubmittedJokes.java | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 src/main/java/tech/araopj/springpitzzahhbot/commands/slash_command/commands/joke/viewSubmittedJokes/ViewSubmittedJokes.java diff --git a/src/main/java/tech/araopj/springpitzzahhbot/commands/slash_command/commands/joke/viewSubmittedJokes/ViewSubmittedJokes.java b/src/main/java/tech/araopj/springpitzzahhbot/commands/slash_command/commands/joke/viewSubmittedJokes/ViewSubmittedJokes.java new file mode 100644 index 0000000..37d37a1 --- /dev/null +++ b/src/main/java/tech/araopj/springpitzzahhbot/commands/slash_command/commands/joke/viewSubmittedJokes/ViewSubmittedJokes.java @@ -0,0 +1,74 @@ +/* + * MIT License + * + * Copyright (c) 2022 pitzzahh + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package tech.araopj.springpitzzahhbot.commands.slash_command.commands.joke.viewSubmittedJokes; + +import tech.araopj.springpitzzahhbot.commands.slash_command.commands.joke.service.JokesService; +import tech.araopj.springpitzzahhbot.commands.slash_command.CommandContext; +import tech.araopj.springpitzzahhbot.utilities.service.MessageUtilService; +import tech.araopj.springpitzzahhbot.commands.slash_command.SlashCommand; +import org.springframework.stereotype.Component; +import java.util.function.Consumer; +import java.util.function.Supplier; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@Component +public record ViewSubmittedJokes( + MessageUtilService messageUtilService, + JokesService jokesService +) implements SlashCommand { + /** + * Executes a {@code SlashCommand} + * + * @return nothing. + * @see Consumer + */ + @Override + public Consumer execute() { + return null; + } + + /** + * Supplies the name of the slash command. + * + * @return a {@code Supplier}. + * @see Supplier + */ + @Override + public Supplier name() { + return "view-submitted-jokes"::toString; + } + + /** + * Supplies the description of a slash command. + * + * @return a {code Supplier} containing the description of the command. + * @see Supplier + */ + @Override + public Supplier description() { + return "View all the jokes submitted by the users"::toString; + } +}