Utility class that provides standardized formatting for responses the bot sends as replies to slash command events.
| 28 | * sends as replies to slash command events. |
| 29 | */ |
| 30 | public final class Responses { |
| 31 | |
| 32 | private Responses() { |
| 33 | } |
| 34 | |
| 35 | @CheckReturnValue |
| 36 | public static @NotNull ReplyCallbackAction success(IReplyCallback event, String title, String message, Object... args) { |
| 37 | return reply(event, title, String.format(message, args), Type.SUCCESS.getColor(), true); |
| 38 | } |
| 39 | |
| 40 | @CheckReturnValue |
| 41 | public static @NotNull WebhookMessageCreateAction<Message> success(InteractionHook hook, String title, String message, Object... args) { |
| 42 | return reply(hook, title, String.format(message, args), Type.SUCCESS.getColor(), true); |
| 43 | } |
| 44 | |
| 45 | @CheckReturnValue |
| 46 | public static @NotNull ReplyCallbackAction info(IReplyCallback event, String title, String message, Object... args) { |
| 47 | return reply(event, title, String.format(message, args), Type.INFO.getColor(), true); |
| 48 | } |
| 49 | |
| 50 | @CheckReturnValue |
| 51 | public static @NotNull WebhookMessageCreateAction<Message> info(InteractionHook hook, String title, String message, Object... args) { |
| 52 | return reply(hook, title, String.format(message, args), Type.INFO.getColor(), true); |
| 53 | } |
| 54 | |
| 55 | @CheckReturnValue |
| 56 | public static @NotNull ReplyCallbackAction error(IReplyCallback event, String message, Object... args) { |
| 57 | return reply(event, "An Error Occurred", String.format(message, args), Type.ERROR.getColor(), true); |
| 58 | } |
| 59 | |
| 60 | @CheckReturnValue |
| 61 | public static @NotNull ReplyCallbackAction errorWithTitle(IReplyCallback event, String title, String message, Object... args) { |
| 62 | return reply(event, title, String.format(message, args), Type.ERROR.getColor(), true); |
| 63 | } |
| 64 | |
| 65 | @CheckReturnValue |
| 66 | public static @NotNull WebhookMessageCreateAction<Message> errorWithTitle(InteractionHook hook, String title, String message, Object... args) { |
| 67 | return reply(hook, title, String.format(message, args), Type.ERROR.getColor(), true); |
| 68 | } |
| 69 | |
| 70 | @CheckReturnValue |
| 71 | public static @NotNull WebhookMessageCreateAction<Message> error(InteractionHook hook, String message, Object... args) { |
| 72 | return reply(hook, "An Error Occurred", String.format(message, args), Type.ERROR.getColor(), true); |
| 73 | } |
| 74 | |
| 75 | @CheckReturnValue |
| 76 | public static @NotNull ReplyCallbackAction warning(IReplyCallback event, String message, Object... args) { |
| 77 | return warnin(event, null, String.format(message, args)); |
| 78 | } |
| 79 | |
| 80 | @CheckReturnValue |
| 81 | public static @NotNull WebhookMessageCreateAction<Message> warning(InteractionHook hook, String message, Object... args) { |
| 82 | return warning(hook, null, String.format(message, args)); |
| 83 | } |
| 84 | |
| 85 | @CheckReturnValue |
| 86 | public static @NotNull ReplyCallbackAction warnin(IReplyCallback event, String title, String message, Object... args) { |
| 87 | return reply(event, title, String.format(message, args), Type.WARN.getColor(), true); |
nothing calls this directly
no outgoing calls
no test coverage detected