@notenoughupdates/discord-akairo
Advanced tools
Comparing version 10.0.0-dev.1660140200.adb9b30 to 10.0.0-dev.1661395812.457e4e5
{ | ||
"name": "@notenoughupdates/discord-akairo", | ||
"version": "10.0.0-dev.1660140200.adb9b30", | ||
"version": "10.0.0-dev.1661395812.457e4e5", | ||
"description": "A highly customizable bot framework for Discord.js.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/src/index.js", |
@@ -17,6 +17,4 @@ "use strict"; | ||
exports.CommandOptions.parse(options); | ||
const { aliases = [], args = this.args || [], argumentDefaults = {}, before = this.before || (() => undefined), channel = null, clientPermissions = this.clientPermissions, condition = this.condition || (() => false), cooldown = null, description = "", editable = true, flags = [], ignoreCooldown, ignorePermissions, localization = {}, lock, onlyNsfw = false, optionFlags = [], ownerOnly = false, prefix = this.prefix, quoted = true, ratelimit = 1, regex = this.regex, separator, slash = false, slashEphemeral = false, slashGuilds = [], slashOnly = false, slashOptions, superUserOnly = false, typing = false, userPermissions = this.userPermissions } = options; | ||
let { slashDefaultMemberPermissions, slashDmPermission } = options; | ||
if (userPermissions && typeof userPermissions !== "function") | ||
slashDefaultMemberPermissions ??= userPermissions; | ||
const { aliases = [], args = this.args || [], argumentDefaults = {}, before = this.before || (() => undefined), channel = null, clientPermissions = this.clientPermissions, condition = this.condition || (() => false), cooldown = null, description = "", editable = true, flags = [], ignoreCooldown, ignorePermissions, localization = {}, lock, onlyNsfw = false, optionFlags = [], ownerOnly = false, prefix = this.prefix, quoted = true, ratelimit = 1, regex = this.regex, separator, slash = false, slashEphemeral = false, slashGuilds = [], slashOnly = false, slashOptions, superUserOnly = false, typing = false, userPermissions = this.userPermissions, slashDefaultMemberPermissions } = options; | ||
let { slashDmPermission } = options; | ||
if (slashGuilds.length === 0) | ||
@@ -23,0 +21,0 @@ slashDmPermission ??= channel === null || channel === "dm"; |
@@ -139,3 +139,3 @@ "use strict"; | ||
continue; | ||
parsedSlashCommands.push({ | ||
const obj = { | ||
name: data.aliases[0]?.toLocaleLowerCase() || data.id?.toLocaleLowerCase(), | ||
@@ -148,3 +148,2 @@ description: parseDescriptionCommand(data.description) || "No description provided.", | ||
guilds: data.slashGuilds ?? [], | ||
defaultMemberPermissions: data.slashDefaultMemberPermissions, | ||
dmPermission: data.slashDmPermission, | ||
@@ -154,3 +153,6 @@ type: discord_js_1.ApplicationCommandType.ChatInput, | ||
descriptionLocalizations: data.localization.descriptionLocalizations | ||
}); | ||
}; | ||
if ("slashDefaultMemberPermissions" in data) | ||
obj.defaultMemberPermissions = data.slashDefaultMemberPermissions; | ||
parsedSlashCommands.push(obj); | ||
} | ||
@@ -160,10 +162,12 @@ const contextCommandHandler = Object.values(this.client).find(v => v instanceof ContextMenuCommandHandler_js_1.ContextMenuCommandHandler); | ||
for (const [, data] of contextCommandHandler.modules) { | ||
parsedSlashCommands.push({ | ||
const obj = { | ||
name: data.name, | ||
guilds: data.guilds ?? [], | ||
defaultMemberPermissions: data.defaultMemberPermissions, | ||
dmPermission: data.dmPermission, | ||
type: data.type, | ||
nameLocalizations: data.nameLocalizations | ||
}); | ||
}; | ||
if ("defaultMemberPermissions" in data) | ||
obj.defaultMemberPermissions = data.defaultMemberPermissions; | ||
parsedSlashCommands.push(obj); | ||
} | ||
@@ -170,0 +174,0 @@ } |
{ | ||
"name": "@notenoughupdates/discord-akairo", | ||
"version": "10.0.0-dev.1660140200.adb9b30", | ||
"version": "10.0.0-dev.1661395812.457e4e5", | ||
"description": "A highly customizable bot framework for Discord.js.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/src/index.js", |
@@ -224,8 +224,8 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ | ||
typing = false, | ||
userPermissions = this.userPermissions | ||
userPermissions = this.userPermissions, | ||
slashDefaultMemberPermissions | ||
} = options; | ||
let { slashDefaultMemberPermissions, slashDmPermission } = options; | ||
let { slashDmPermission } = options; | ||
if (userPermissions && typeof userPermissions !== "function") slashDefaultMemberPermissions ??= userPermissions; | ||
if (slashGuilds.length === 0) slashDmPermission ??= channel === null || channel === "dm"; | ||
@@ -232,0 +232,0 @@ |
@@ -336,3 +336,5 @@ import { | ||
const parsedSlashCommands: (ApplicationCommandData & { guilds: Snowflake[] })[] = []; | ||
type ParsedSlashCommand = ApplicationCommandData & { guilds: Snowflake[] }; | ||
const parsedSlashCommands: ParsedSlashCommand[] = []; | ||
const guildSlashCommandsParsed: Collection<Snowflake, ApplicationCommandData[]> = new Collection(); | ||
@@ -350,3 +352,3 @@ const parseDescriptionCommand = (description: { content: () => any }) => { | ||
if (!data.slash) continue; | ||
parsedSlashCommands.push({ | ||
const obj = { | ||
name: data.aliases[0]?.toLocaleLowerCase() || data.id?.toLocaleLowerCase(), | ||
@@ -359,3 +361,2 @@ description: parseDescriptionCommand(data.description) || "No description provided.", | ||
guilds: data.slashGuilds ?? [], | ||
defaultMemberPermissions: data.slashDefaultMemberPermissions, | ||
dmPermission: data.slashDmPermission, | ||
@@ -365,3 +366,7 @@ type: ApplicationCommandType.ChatInput, | ||
descriptionLocalizations: data.localization.descriptionLocalizations | ||
}); | ||
} as ParsedSlashCommand; | ||
if ("slashDefaultMemberPermissions" in data) obj.defaultMemberPermissions = data.slashDefaultMemberPermissions; | ||
parsedSlashCommands.push(obj); | ||
} | ||
@@ -377,10 +382,13 @@ | ||
for (const [, data] of contextCommandHandler.modules) { | ||
parsedSlashCommands.push({ | ||
const obj = { | ||
name: data.name, | ||
guilds: data.guilds ?? [], | ||
defaultMemberPermissions: data.defaultMemberPermissions, | ||
dmPermission: data.dmPermission, | ||
type: data.type, | ||
nameLocalizations: data.nameLocalizations | ||
}); | ||
} as ParsedSlashCommand; | ||
if ("defaultMemberPermissions" in data) obj.defaultMemberPermissions = data.defaultMemberPermissions; | ||
parsedSlashCommands.push(obj); | ||
} | ||
@@ -387,0 +395,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1083113
17224