Routes.guildMembers() only shows one member

I've checked guilds, roles, emojis those are fine except this one
No description
8 Replies
d.js toolkit
d.js toolkit5mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
duck
duck5mo ago
assuming you haven't specified any request options beyond the route, this endpoint defaults to a limit of 1
d.js docs
d.js docs5mo ago
:discord: Guild Resource - List Guild Members GET /guilds/guild.id/members Returns a list of guild member objects that are members of the guild. read more
duck
duck5mo ago
@discordjs/rest doesn't modify responses, so if you aren't getting back what you expect, it's usually something to do with your request
Bay Kedi
Bay KediOP5mo ago
im still getting one member
export async function guildMembers(req: Request, res: Response) {
try {
// @ts-ignore
const guildMembers = await rest.get(Routes.guildMembers(req.params.guildId), { query: { limit: 5, after: '155149108183695360' } });
res.json(guildMembers);
}
catch (error) {
res.status(500).json({ error: error.message });
}
};
export async function guildMembers(req: Request, res: Response) {
try {
// @ts-ignore
const guildMembers = await rest.get(Routes.guildMembers(req.params.guildId), { query: { limit: 5, after: '155149108183695360' } });
res.json(guildMembers);
}
catch (error) {
res.status(500).json({ error: error.message });
}
};
duck
duck5mo ago
the query is expected to be a URLSearchParams object
d.js docs
d.js docs5mo ago
:interface: RequestData @2.3.0 Represents possible data to be given to an endpoint
Bay Kedi
Bay KediOP5mo ago
got it fixed
export async function guildMembers(req: Request, res: Response) {
try {
const params = new URLSearchParams()
params.append('limit', '5');
params.append('after', '155149108183695360')
const guildMembers = await rest.get(Routes.guildMembers(req.params.guildId), { query: params });
res.json(guildMembers);
}
catch (error) {
res.status(500).json({ error: error.message });
}
};
export async function guildMembers(req: Request, res: Response) {
try {
const params = new URLSearchParams()
params.append('limit', '5');
params.append('after', '155149108183695360')
const guildMembers = await rest.get(Routes.guildMembers(req.params.guildId), { query: params });
res.json(guildMembers);
}
catch (error) {
res.status(500).json({ error: error.message });
}
};
Want results from more Discord servers?
Add your server