forked from Supositware/Haha-Yes
Improve mentionable args type and match the rest of the arguments for the last one
This commit is contained in:
parent
c908a524aa
commit
cc35373749
1 changed files with 7 additions and 2 deletions
|
@ -370,12 +370,16 @@ export default {
|
||||||
};
|
};
|
||||||
const args = {};
|
const args = {};
|
||||||
|
|
||||||
for (let i = 0, j = 0; i < command.data.options.length; i++, j++) {
|
const argsLength = command.data.options.length;
|
||||||
|
for (let i = 0, j = 0; i < argsLength; i++, j++) {
|
||||||
if (!messageArgs[i]) continue;
|
if (!messageArgs[i]) continue;
|
||||||
const arg = command.data.options[j];
|
const arg = command.data.options[j];
|
||||||
const type = arg.constructor.name.toLowerCase();
|
const type = arg.constructor.name.toLowerCase();
|
||||||
let payloadName = arg.name;
|
let payloadName = arg.name;
|
||||||
let payload = messageArgs[i];
|
let payload = messageArgs[i];
|
||||||
|
if (i >= argsLength - 1) {
|
||||||
|
payload = messageArgs.slice(i).join(' ');
|
||||||
|
}
|
||||||
|
|
||||||
if (messageArgs[i].startsWith('--')) {
|
if (messageArgs[i].startsWith('--')) {
|
||||||
payloadName = payload.substring(2);
|
payloadName = payload.substring(2);
|
||||||
|
@ -383,7 +387,8 @@ export default {
|
||||||
j--;
|
j--;
|
||||||
}
|
}
|
||||||
else if (type.includes('mentionable')) {
|
else if (type.includes('mentionable')) {
|
||||||
payload = message.mentions.members.first();
|
await message.guild.members.fetch();
|
||||||
|
payload = message.mentions.members.first() ? message.mentions.members.first() : message.guild.members.cache.find(u => u.user.username.toLowerCase().includes(payload.toLowerCase()));
|
||||||
}
|
}
|
||||||
else if (type.includes('attachment')) {
|
else if (type.includes('attachment')) {
|
||||||
payload = message.attachments.first();
|
payload = message.attachments.first();
|
||||||
|
|
Loading…
Reference in a new issue