mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 19:28:17 +00:00
feat(handlers): check for message max delete days (#416)
* check prune max days * patch(handlers): max days is 30 * change in description too * fix: merge problems
This commit is contained in:
@@ -479,9 +479,8 @@ export async function swapRoles(guildID: string, rolePositons: PositionSwap) {
|
||||
|
||||
/** Check how many members would be removed from the server in a prune operation. Requires the KICK_MEMBERS permission */
|
||||
export async function getPruneCount(guildID: string, options: PruneOptions) {
|
||||
if (options.days < 1) {
|
||||
throw new Error(Errors.PRUNE_MIN_DAYS);
|
||||
}
|
||||
if (options.days < 1) throw new Error(Errors.PRUNE_MIN_DAYS);
|
||||
if (options.days > 30) throw new Error(Errors.PRUNE_MAX_DAYS);
|
||||
|
||||
const hasPerm = await botHasPermission(guildID, ["KICK_MEMBERS"]);
|
||||
if (!hasPerm) {
|
||||
@@ -498,9 +497,8 @@ export async function getPruneCount(guildID: string, options: PruneOptions) {
|
||||
|
||||
/** Begin pruning all members in the given time period */
|
||||
export async function pruneMembers(guildID: string, options: PruneOptions) {
|
||||
if (options.days < 1) {
|
||||
throw new Error(Errors.PRUNE_MIN_DAYS);
|
||||
}
|
||||
if (options.days < 1) throw new Error(Errors.PRUNE_MIN_DAYS);
|
||||
if (options.days > 30) throw new Error(Errors.PRUNE_MAX_DAYS);
|
||||
|
||||
const hasPerm = await botHasPermission(guildID, ["KICK_MEMBERS"]);
|
||||
if (!hasPerm) {
|
||||
|
||||
Reference in New Issue
Block a user