forked from PluralFlux/PluralFlux
made it easier to make a member
This commit is contained in:
@@ -19,6 +19,10 @@ cmds.set('member', {
|
|||||||
else if (reply instanceof EmbedBuilder) {
|
else if (reply instanceof EmbedBuilder) {
|
||||||
await message.reply({embeds: [reply.toJSON()]})
|
await message.reply({embeds: [reply.toJSON()]})
|
||||||
}
|
}
|
||||||
|
else if (typeof reply === 'object') {
|
||||||
|
const errorsText = reply.errors.length > 0 ? reply.errors.join('\n- ') : null;
|
||||||
|
return await message.reply({content: `${reply.success} ${errorsText ? "\nThese errors occurred:\n" + errorsText : ""}`, embeds: [reply.embed.toJSON()]})
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ const commandList = ['--help', 'new', 'remove', 'name', 'list', 'displayName', '
|
|||||||
* @param {string[]} args - The message arguments
|
* @param {string[]} args - The message arguments
|
||||||
* @param {string | null} attachmentUrl - The message attachment url.
|
* @param {string | null} attachmentUrl - The message attachment url.
|
||||||
* @param {string | null} attachmentExpiration - The message attachment expiration (if uploaded via Fluxer)
|
* @param {string | null} attachmentExpiration - The message attachment expiration (if uploaded via Fluxer)
|
||||||
* @returns {Promise<string> | Promise <EmbedBuilder>} A message, or an informational embed.
|
* @returns {Promise<string>} A success message.
|
||||||
|
* @returns {Promise <EmbedBuilder>} A list of 25 members as an embed.
|
||||||
|
* @returns {Promise<{EmbedBuilder, [], string}>} A member info embed + info/errors.
|
||||||
* @throws {Error}
|
* @throws {Error}
|
||||||
*/
|
*/
|
||||||
mh.parseMemberCommand = async function (authorId, authorFull, args, attachmentUrl = null, attachmentExpiration = null) {
|
mh.parseMemberCommand = async function (authorId, authorFull, args, attachmentUrl = null, attachmentExpiration = null) {
|
||||||
@@ -99,8 +101,9 @@ mh.addNewMember = async function (authorId, args, attachmentURL = null) {
|
|||||||
const proxy = args[3];
|
const proxy = args[3];
|
||||||
const propic = args[4] ?? attachmentURL;
|
const propic = args[4] ?? attachmentURL;
|
||||||
|
|
||||||
return await mh.addFullMember(authorId, memberName, displayName, proxy, propic).then(() => {
|
return await mh.addFullMember(authorId, memberName, displayName, proxy, propic).then(async(response) => {
|
||||||
return mh.getMemberInfo(authorId, memberName).catch((e) => {throw e})
|
const memberInfoEmbed = await mh.getMemberInfo(authorId, memberName).catch((e) => {throw e})
|
||||||
|
return {embed: memberInfoEmbed, errors: response.errors, success: `${memberName} has been added successfully.`};
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
throw e;
|
throw e;
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user