Aditya Kirad
Aditya Kirad
Explore posts from servers
SIASapphire - Imagine a framework
Created by Aditya Kirad on 12/21/2023 in #discordjs-support
need help with building dashboard for discord bot
hey, folks I'm building web dashboard for my discord bot using this code I'm gettings all the guilds in which either user can invite or control the bot
const userGuilds = await axios.get(`${env.BASE_DISCORD_API}/users/@me/guilds`, {
headers: {
Authorization: `Bearer ${token}`,
},
});

const userGuildParsed = guildSchema.safeParse(userGuilds.data);

const guildsWithPermissions = userGuildParsed.data.filter(
({ permissions }) =>
(parseInt(permissions) & 0x20) === 0x20 ||
(parseInt(permissions) & 0x8) === 0x8,
);
const userGuilds = await axios.get(`${env.BASE_DISCORD_API}/users/@me/guilds`, {
headers: {
Authorization: `Bearer ${token}`,
},
});

const userGuildParsed = guildSchema.safeParse(userGuilds.data);

const guildsWithPermissions = userGuildParsed.data.filter(
({ permissions }) =>
(parseInt(permissions) & 0x20) === 0x20 ||
(parseInt(permissions) & 0x8) === 0x8,
);
but now I have problem how can I know the guild in which bot is there and not there do I have also get the botGuilds and compare it with guildWithPermissions
2 replies