mirror of
https://github.com/pieartsy/PluralFlux.git
synced 2026-04-14 20:15:28 +10:00
added --help functionality to import command
This commit is contained in:
@@ -46,6 +46,9 @@ cmds.set('help', {
|
|||||||
cmds.set('import', {
|
cmds.set('import', {
|
||||||
description: enums.help.SHORT_DESC_IMPORT,
|
description: enums.help.SHORT_DESC_IMPORT,
|
||||||
async execute(message) {
|
async execute(message) {
|
||||||
|
if (message.content.includes('--help')) {
|
||||||
|
return await message.reply(enums.help.IMPORT);
|
||||||
|
}
|
||||||
const attachmentUrl = message.attachments.size > 0 ? message.attachments.first().url : null;
|
const attachmentUrl = message.attachments.size > 0 ? message.attachments.first().url : null;
|
||||||
|
|
||||||
return await importHelper.pluralKitImport(message.author.id, attachmentUrl).then(async (successfullyAdded) => {
|
return await importHelper.pluralKitImport(message.author.id, attachmentUrl).then(async (successfullyAdded) => {
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ ih.pluralKitImport = async function (authorId, attachmentUrl) {
|
|||||||
if (!attachmentUrl) {
|
if (!attachmentUrl) {
|
||||||
throw new Error(enums.err.NOT_JSON_FILE);
|
throw new Error(enums.err.NOT_JSON_FILE);
|
||||||
}
|
}
|
||||||
|
if (attachmentUrl === '--help') {
|
||||||
|
return enums.help.IMPORT;
|
||||||
|
}
|
||||||
return fetch(attachmentUrl).then((res) => res.json()).then(async(pkData) => {
|
return fetch(attachmentUrl).then((res) => res.json()).then(async(pkData) => {
|
||||||
const pkMembers = pkData.members;
|
const pkMembers = pkData.members;
|
||||||
const errors = [];
|
const errors = [];
|
||||||
|
|||||||
Reference in New Issue
Block a user