mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-07-08 11:37:20 +00:00
Fixes, refactoring and PR feedback
This commit is contained in:
parent
0be54912c4
commit
893a77d562
202 changed files with 1037 additions and 1069 deletions
|
@ -83,22 +83,18 @@ export interface CleanArgs {
|
|||
|
||||
export async function cleanCmd(pluginData: GuildPluginData<UtilityPluginType>, args: CleanArgs | any, msg) {
|
||||
if (args.count > MAX_CLEAN_COUNT || args.count <= 0) {
|
||||
pluginData
|
||||
.getPlugin(CommonPlugin)
|
||||
.sendErrorMessage(
|
||||
msg,
|
||||
`Clean count must be between 1 and ${MAX_CLEAN_COUNT}`,
|
||||
undefined,
|
||||
args["response-interaction"],
|
||||
);
|
||||
void pluginData.state.common.sendErrorMessage(
|
||||
msg,
|
||||
`Clean count must be between 1 and ${MAX_CLEAN_COUNT}`,
|
||||
undefined,
|
||||
args["response-interaction"],
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const targetChannel = args.channel ? pluginData.guild.channels.cache.get(args.channel as Snowflake) : msg.channel;
|
||||
if (!targetChannel?.isTextBased()) {
|
||||
pluginData
|
||||
.getPlugin(CommonPlugin)
|
||||
.sendErrorMessage(msg, `Invalid channel specified`, undefined, args["response-interaction"]);
|
||||
void pluginData.state.common.sendErrorMessage(msg, `Invalid channel specified`, undefined, args["response-interaction"]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -110,14 +106,12 @@ export async function cleanCmd(pluginData: GuildPluginData<UtilityPluginType>, a
|
|||
categoryId: targetChannel.parentId,
|
||||
});
|
||||
if (configForTargetChannel.can_clean !== true) {
|
||||
pluginData
|
||||
.getPlugin(CommonPlugin)
|
||||
.sendErrorMessage(
|
||||
msg,
|
||||
`Missing permissions to use clean on that channel`,
|
||||
undefined,
|
||||
args["response-interaction"],
|
||||
);
|
||||
void pluginData.state.common.sendErrorMessage(
|
||||
msg,
|
||||
`Missing permissions to use clean on that channel`,
|
||||
undefined,
|
||||
args["response-interaction"],
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -223,14 +217,10 @@ export async function cleanCmd(pluginData: GuildPluginData<UtilityPluginType>, a
|
|||
}
|
||||
}
|
||||
|
||||
responseMsg = await pluginData
|
||||
.getPlugin(CommonPlugin)
|
||||
.sendSuccessMessage(msg, responseText, undefined, args["response-interaction"]);
|
||||
responseMsg = await pluginData.state.common.sendSuccessMessage(msg, responseText, undefined, args["response-interaction"]);
|
||||
} else {
|
||||
const responseText = `Found no messages to clean${note ? ` (${note})` : ""}!`;
|
||||
responseMsg = await pluginData
|
||||
.getPlugin(CommonPlugin)
|
||||
.sendErrorMessage(msg, responseText, undefined, args["response-interaction"]);
|
||||
responseMsg = await pluginData.state.common.sendErrorMessage(msg, responseText, undefined, args["response-interaction"]);
|
||||
}
|
||||
|
||||
cleaningMessage?.delete();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue