Added comments to discord.ts#canEditGuild
This commit is contained in:
parent
7bbe4803ec
commit
9cd9f23265
@ -60,6 +60,13 @@ export const getGuilds = async (refreshDate: Date, refreshToken: string, accessT
|
||||
return await oauth.getUserGuilds(await updateToken(refreshDate, refreshToken, accessToken));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the user is the owner of the guild or has the manage server permission
|
||||
* @param refreshDate The date of when to renew the provided access token
|
||||
* @param refreshToken The token to refresh the access token
|
||||
* @param accessToken The token to access the discord api
|
||||
* @param guildId The id of the guild
|
||||
*/
|
||||
export const canEditGuild = async (refreshDate: Date, refreshToken: string, accessToken: string, guildId: string) => {
|
||||
const guilds = await getGuilds(refreshDate, refreshToken, accessToken);
|
||||
return guilds.some(guild => guild.id === guildId && (guild.owner || (guild.permissions && (guild.permissions & 0x8))));
|
||||
|
Loading…
x
Reference in New Issue
Block a user