mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-14 05:45:02 +00:00
Added slash command deferral to avoid timeouts
This commit is contained in:
parent
ee861bb5e9
commit
408f1b9c30
22 changed files with 32 additions and 3 deletions
|
@ -76,7 +76,7 @@ export const CommonPlugin = zeppelinGuildPlugin<CommonPluginType>()({
|
|||
});
|
||||
}
|
||||
|
||||
const replyMethod = context.replied ? "editReply" : "reply";
|
||||
const replyMethod = context.replied || context.deferred ? "editReply" : "reply";
|
||||
|
||||
return context[replyMethod]({
|
||||
content: formattedBody,
|
||||
|
@ -127,7 +127,7 @@ export const CommonPlugin = zeppelinGuildPlugin<CommonPluginType>()({
|
|||
});
|
||||
}
|
||||
|
||||
const replyMethod = context.replied ? "editReply" : "reply";
|
||||
const replyMethod = context.replied || context.deferred ? "editReply" : "reply";
|
||||
|
||||
return context[replyMethod]({
|
||||
content: formattedBody,
|
||||
|
|
|
@ -34,6 +34,7 @@ export const AddCaseSlashCmd = {
|
|||
],
|
||||
|
||||
async run({ interaction, options, pluginData }) {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment");
|
||||
|
||||
// The moderator who did the action is the message author or, if used, the specified -mod
|
||||
|
|
|
@ -47,6 +47,7 @@ export const BanSlashCmd = {
|
|||
signature: [slashOptions.user({ name: "user", description: "The user to ban", required: true }), ...opts],
|
||||
|
||||
async run({ interaction, options, pluginData }) {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment");
|
||||
|
||||
if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) {
|
||||
|
|
|
@ -18,6 +18,7 @@ export const CaseSlashCmd = {
|
|||
],
|
||||
|
||||
async run({ interaction, options, pluginData }) {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
actualCaseCmd(pluginData, interaction, interaction.user.id, options["case-number"], options.show);
|
||||
},
|
||||
};
|
||||
|
|
|
@ -30,6 +30,8 @@ export const CasesSlashCmd = {
|
|||
signature: [...opts],
|
||||
|
||||
async run({ interaction, options, pluginData }) {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
|
||||
return actualCasesCmd(
|
||||
pluginData,
|
||||
interaction,
|
||||
|
|
|
@ -16,6 +16,8 @@ export const DeleteCaseSlashCmd = {
|
|||
],
|
||||
|
||||
async run({ interaction, options, pluginData }) {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
|
||||
actualDeleteCaseCmd(
|
||||
pluginData,
|
||||
interaction,
|
||||
|
|
|
@ -24,6 +24,7 @@ export const ForceBanSlashCmd = {
|
|||
signature: [slashOptions.user({ name: "user", description: "The user to ban", required: true }), ...opts],
|
||||
|
||||
async run({ interaction, options, pluginData }) {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment");
|
||||
|
||||
if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) {
|
||||
|
|
|
@ -42,6 +42,7 @@ export const ForceMuteSlashCmd = {
|
|||
signature: [slashOptions.user({ name: "user", description: "The user to mute", required: true }), ...opts],
|
||||
|
||||
async run({ interaction, options, pluginData }) {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment");
|
||||
|
||||
if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) {
|
||||
|
|
|
@ -25,6 +25,7 @@ export const ForceUnmuteSlashCmd = {
|
|||
signature: [slashOptions.user({ name: "user", description: "The user to unmute", required: true }), ...opts],
|
||||
|
||||
async run({ interaction, options, pluginData }) {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment");
|
||||
|
||||
if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) {
|
||||
|
|
|
@ -12,6 +12,7 @@ export const HideCaseSlashCmd = {
|
|||
],
|
||||
|
||||
async run({ interaction, options, pluginData }) {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
actualHideCaseCmd(pluginData, interaction, options["case-number"].split(/[\s,]+/).map(Number));
|
||||
},
|
||||
};
|
||||
|
|
|
@ -46,6 +46,7 @@ export const KickSlashCmd = {
|
|||
signature: [slashOptions.user({ name: "user", description: "The user to kick", required: true }), ...opts],
|
||||
|
||||
async run({ interaction, options, pluginData }) {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment");
|
||||
|
||||
if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) {
|
||||
|
|
|
@ -25,6 +25,7 @@ export const MassBanSlashCmd = {
|
|||
],
|
||||
|
||||
async run({ interaction, options, pluginData }) {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment");
|
||||
|
||||
if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) {
|
||||
|
|
|
@ -25,6 +25,7 @@ export const MassMuteSlashSlashCmd = {
|
|||
],
|
||||
|
||||
async run({ interaction, options, pluginData }) {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment");
|
||||
|
||||
if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) {
|
||||
|
|
|
@ -25,6 +25,7 @@ export const MassUnbanSlashCmd = {
|
|||
],
|
||||
|
||||
async run({ interaction, options, pluginData }) {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment");
|
||||
|
||||
if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) {
|
||||
|
|
|
@ -44,6 +44,7 @@ export const MuteSlashCmd = {
|
|||
signature: [slashOptions.user({ name: "user", description: "The user to mute", required: true }), ...opts],
|
||||
|
||||
async run({ interaction, options, pluginData }) {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment");
|
||||
const memberToMute = await resolveMember(pluginData.client, pluginData.guild, options.user.id);
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ export const NoteSlashCmd = {
|
|||
signature: [slashOptions.user({ name: "user", description: "The user to add a note to", required: true }), ...opts],
|
||||
|
||||
async run({ interaction, options, pluginData }) {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment");
|
||||
|
||||
if ((!options.note || options.note.trim() === "") && attachments.length < 1) {
|
||||
|
|
|
@ -23,6 +23,7 @@ export const UnbanSlashCmd = {
|
|||
signature: [slashOptions.user({ name: "user", description: "The user to unban", required: true }), ...opts],
|
||||
|
||||
async run({ interaction, options, pluginData }) {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment");
|
||||
|
||||
if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) {
|
||||
|
|
|
@ -12,6 +12,7 @@ export const UnhideCaseSlashCmd = {
|
|||
],
|
||||
|
||||
async run({ interaction, options, pluginData }) {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
actualUnhideCaseCmd(pluginData, interaction, options["case-number"].split(/[\s,]+/).map(Number));
|
||||
},
|
||||
};
|
||||
|
|
|
@ -28,6 +28,7 @@ export const UnmuteSlashCmd = {
|
|||
signature: [slashOptions.user({ name: "user", description: "The user to unmute", required: true }), ...opts],
|
||||
|
||||
async run({ interaction, options, pluginData }) {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment");
|
||||
|
||||
if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) {
|
||||
|
|
|
@ -21,6 +21,8 @@ export const UpdateSlashCmd = {
|
|||
signature: [...opts],
|
||||
|
||||
async run({ interaction, options, pluginData }) {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
|
||||
await updateCase(
|
||||
pluginData,
|
||||
interaction,
|
||||
|
|
|
@ -42,6 +42,7 @@ export const WarnSlashCmd = {
|
|||
signature: [slashOptions.user({ name: "user", description: "The user to warn", required: true }), ...opts],
|
||||
|
||||
async run({ interaction, options, pluginData }) {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment");
|
||||
|
||||
if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue