Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Members type returning only 1 member #190

Open
yoon4027 opened this issue Jan 18, 2021 · 10 comments
Open

Members type returning only 1 member #190

yoon4027 opened this issue Jan 18, 2021 · 10 comments

Comments

@yoon4027
Copy link

So I am trying to make a command with multiple arguments. And when I try it with matches and without matches is still returns 1 member out of 3.

args: [
          {
            id: "members",
            type: "members",
            match: "rest",
            prompt: {
              start: "Please provide member**(s)** to be banned",
              retry: "Please provide a **valid** member**(s)**",
            },
          },
        ]
args: [
          {
            id: "members",
            type: "members",
            prompt: {
              start: "Please provide member**(s)** to be banned",
              retry: "Please provide a **valid** member**(s)**",
            },
          },
        ]

None of these are working... Any reason why?

@sawa-ko
Copy link

sawa-ko commented Mar 1, 2021

No cached members

@yoon4027
Copy link
Author

yoon4027 commented Mar 1, 2021

welp, is there a solution for this?

@sawa-ko
Copy link

sawa-ko commented Mar 1, 2021

welp, is there a solution for this?

use message.guild.members.fetch();

@yoon4027
Copy link
Author

yoon4027 commented Mar 1, 2021

aight

@yoon4027
Copy link
Author

yoon4027 commented Mar 1, 2021

didn't work

@yoon4027
Copy link
Author

yoon4027 commented Mar 1, 2021

[ArgumentTypes.MEMBERS]: async (message, phrase) => {
                if (!phrase) return null;
                const members = this.client.util.resolveMembers(phrase, await message.guild.members.fetch());
                return members.size ? members : null;
            },

I edited the code

@sawa-ko
Copy link

sawa-ko commented Mar 1, 2021

I have it set in the prefix configuration of the Handler command and it works well for me

// ......
.prefix: async (message: Message) => {
       if (message.guild.members.cache.size !== message.guild.memberCount) {
          try {
            await message.guild.members.fetch();
          } catch (error) {
            this.logger.error(error);
          }
        }

        return prefix;
}

@yoon4027
Copy link
Author

yoon4027 commented Mar 1, 2021

and that code won't work. So I think it's a problem with the resolveMembers function. Haven't checked that out yet.

@sawa-ko
Copy link

sawa-ko commented Mar 1, 2021

It works because if the member counter is different from the cached member counter, then it will make a call to get the members, and since this function runs before executing a command, the command will know which user you have selected because it will already be cached

@yoon4027
Copy link
Author

yoon4027 commented Mar 1, 2021

aight

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants