diff --git a/src/helpers/channels/get_channel.ts b/src/helpers/channels/get_channel.ts index eb2268252..8badc5ac8 100644 --- a/src/helpers/channels/get_channel.ts +++ b/src/helpers/channels/get_channel.ts @@ -9,11 +9,10 @@ import { endpoints } from "../../util/constants.ts"; * ⚠️ **If you need this, you are probably doing something wrong. This is not intended for use. Your channels will be cached in your guild.** */ export async function getChannel(channelId: string, addToCache = true) { - const result = - (await rest.runMethod( - "get", - endpoints.CHANNEL_BASE(channelId), - )) as DiscordChannel; + const result = (await rest.runMethod( + "get", + endpoints.CHANNEL_BASE(channelId), + )) as DiscordChannel; const channelStruct = await structures.createChannelStruct( result, diff --git a/src/helpers/channels/get_channels.ts b/src/helpers/channels/get_channels.ts index 15e7b9cbb..c62c91256 100644 --- a/src/helpers/channels/get_channels.ts +++ b/src/helpers/channels/get_channels.ts @@ -9,11 +9,10 @@ import { endpoints } from "../../util/constants.ts"; * ⚠️ **If you need this, you are probably doing something wrong. This is not intended for use. Your channels will be cached in your guild.** */ export async function getChannels(guildId: string, addToCache = true) { - const result = - (await rest.runMethod( - "get", - endpoints.GUILD_CHANNELS(guildId), - ) as DiscordChannel[]); + const result = (await rest.runMethod( + "get", + endpoints.GUILD_CHANNELS(guildId), + ) as DiscordChannel[]); return Promise.all(result.map(async (res) => { const channelStruct = await structures.createChannelStruct(res, guildId); diff --git a/src/helpers/channels/get_pins.ts b/src/helpers/channels/get_pins.ts index 14bddf199..d47b93a5d 100644 --- a/src/helpers/channels/get_pins.ts +++ b/src/helpers/channels/get_pins.ts @@ -5,11 +5,10 @@ import { endpoints } from "../../util/constants.ts"; /** Get pinned messages in this channel. */ export async function getPins(channelId: string) { - const result = - (await rest.runMethod( - "get", - endpoints.CHANNEL_PINS(channelId), - )) as DiscordMessage[]; + const result = (await rest.runMethod( + "get", + endpoints.CHANNEL_PINS(channelId), + )) as DiscordMessage[]; return Promise.all( result.map((res) => structures.createMessageStruct(res)), diff --git a/src/helpers/commands/get_slash_commands.ts b/src/helpers/commands/get_slash_commands.ts index 8e86a24bf..ce2cc50bf 100644 --- a/src/helpers/commands/get_slash_commands.ts +++ b/src/helpers/commands/get_slash_commands.ts @@ -5,13 +5,12 @@ import { endpoints } from "../../util/constants.ts"; /** Fetch all of the global commands for your application. */ export async function getSlashCommands(guildId?: string) { - const result = - (await rest.runMethod( - "get", - guildId - ? endpoints.COMMANDS_GUILD(applicationId, guildId) - : endpoints.COMMANDS(applicationId), - )) as SlashCommand[]; + const result = (await rest.runMethod( + "get", + guildId + ? endpoints.COMMANDS_GUILD(applicationId, guildId) + : endpoints.COMMANDS(applicationId), + )) as SlashCommand[]; return new Collection(result.map((command) => [command.name, command])); } diff --git a/src/helpers/guilds/create_guild.ts b/src/helpers/guilds/create_guild.ts index 2eb52b212..144d260a4 100644 --- a/src/helpers/guilds/create_guild.ts +++ b/src/helpers/guilds/create_guild.ts @@ -4,12 +4,11 @@ import { endpoints } from "../../util/constants.ts"; /** Create a new guild. Returns a guild object on success. Fires a Guild Create Gateway event. This endpoint can be used only by bots in less than 10 guilds. */ export async function createGuild(options: CreateServerOptions) { - const guild = - (await rest.runMethod( - "post", - endpoints.GUILDS, - options, - )) as CreateGuildPayload; + const guild = (await rest.runMethod( + "post", + endpoints.GUILDS, + options, + )) as CreateGuildPayload; return structures.createGuildStruct(guild, 0); } diff --git a/src/helpers/guilds/get_audit_logs.ts b/src/helpers/guilds/get_audit_logs.ts index b4563bbe3..63ee31d2f 100644 --- a/src/helpers/guilds/get_audit_logs.ts +++ b/src/helpers/guilds/get_audit_logs.ts @@ -18,7 +18,8 @@ export async function getAuditLogs( ? AuditLogs[options.action_type] : undefined, limit: options.limit && options.limit >= 1 && options.limit <= 100 - ? options.limit : 50, + ? options.limit + : 50, }, ); diff --git a/src/helpers/guilds/get_bans.ts b/src/helpers/guilds/get_bans.ts index aabd031c5..c32820525 100644 --- a/src/helpers/guilds/get_bans.ts +++ b/src/helpers/guilds/get_bans.ts @@ -7,11 +7,10 @@ import { requireBotGuildPermissions } from "../../util/permissions.ts"; export async function getBans(guildId: string) { await requireBotGuildPermissions(guildId, ["BAN_MEMBERS"]); - const results = - (await rest.runMethod( - "get", - endpoints.GUILD_BANS(guildId), - )) as BannedUser[]; + const results = (await rest.runMethod( + "get", + endpoints.GUILD_BANS(guildId), + )) as BannedUser[]; return new Collection( results.map((res) => [res.user.id, res]), diff --git a/src/helpers/members/get_member.ts b/src/helpers/members/get_member.ts index fe4d239c3..e98ca9320 100644 --- a/src/helpers/members/get_member.ts +++ b/src/helpers/members/get_member.ts @@ -15,9 +15,11 @@ export async function getMember( const guild = await cacheHandlers.get("guilds", guildId); if (!guild && !options?.force) return; - const data = (await rest.runMethod("get", - endpoints.GUILD_MEMBER(guildId, id), - )) as MemberCreatePayload; + const data = + (await rest.runMethod( + "get", + endpoints.GUILD_MEMBER(guildId, id), + )) as MemberCreatePayload; const memberStruct = await structures.createMemberStruct(data, guildId); await cacheHandlers.set("members", memberStruct.id, memberStruct); diff --git a/src/helpers/members/get_members.ts b/src/helpers/members/get_members.ts index e2deb907c..2884689f6 100644 --- a/src/helpers/members/get_members.ts +++ b/src/helpers/members/get_members.ts @@ -42,19 +42,12 @@ export async function getMembers(guildId: string, options?: GetMemberOptions) { ); } - const result = - (await rest.runMethod( - "get", - `${endpoints.GUILD_MEMBERS(guildId)}?limit=${ - membersLeft > 1000 - ? 1000 - : membersLeft - }${ - options?.after - ? `&after=${options.after}` - : "" - }`, - )) as DiscordGuildMember[]; + const result = (await rest.runMethod( + "get", + `${endpoints.GUILD_MEMBERS(guildId)}?limit=${ + membersLeft > 1000 ? 1000 : membersLeft + }${options?.after ? `&after=${options.after}` : ""}`, + )) as DiscordGuildMember[]; const memberStructures = await Promise.all( result.map(async (member) => { diff --git a/src/helpers/messages/get_message.ts b/src/helpers/messages/get_message.ts index 55ea57ce9..04d07c7ac 100644 --- a/src/helpers/messages/get_message.ts +++ b/src/helpers/messages/get_message.ts @@ -10,11 +10,10 @@ export async function getMessage(channelId: string, id: string) { "READ_MESSAGE_HISTORY", ]); - const result = - (await rest.runMethod( - "get", - endpoints.CHANNEL_MESSAGE(channelId, id), - )) as MessageCreateOptions; + const result = (await rest.runMethod( + "get", + endpoints.CHANNEL_MESSAGE(channelId, id), + )) as MessageCreateOptions; return structures.createMessageStruct(result); } diff --git a/src/helpers/messages/get_messages.ts b/src/helpers/messages/get_messages.ts index d70e8ce58..7fafe7ee1 100644 --- a/src/helpers/messages/get_messages.ts +++ b/src/helpers/messages/get_messages.ts @@ -19,12 +19,11 @@ export async function getMessages( if (options?.limit && options.limit > 100) return; - const result = - (await rest.runMethod( - "get", - endpoints.CHANNEL_MESSAGES(channelId), - options, - )) as MessageCreateOptions[]; + const result = (await rest.runMethod( + "get", + endpoints.CHANNEL_MESSAGES(channelId), + options, + )) as MessageCreateOptions[]; return Promise.all( result.map((res) => structures.createMessageStruct(res)), diff --git a/src/helpers/messages/get_reactions.ts b/src/helpers/messages/get_reactions.ts index 880406b9a..0f9ae95e4 100644 --- a/src/helpers/messages/get_reactions.ts +++ b/src/helpers/messages/get_reactions.ts @@ -9,12 +9,11 @@ export async function getReactions( reaction: string, options?: DiscordGetReactionsParams, ) { - const users = - (await rest.runMethod( - "get", - endpoints.CHANNEL_MESSAGE_REACTION(channelId, messageId, reaction), - options, - )) as UserPayload[]; + const users = (await rest.runMethod( + "get", + endpoints.CHANNEL_MESSAGE_REACTION(channelId, messageId, reaction), + options, + )) as UserPayload[]; return new Collection(users.map((user) => [user.id, user])); } diff --git a/src/helpers/messages/publish_message.ts b/src/helpers/messages/publish_message.ts index 7eb526f58..3c52869ec 100644 --- a/src/helpers/messages/publish_message.ts +++ b/src/helpers/messages/publish_message.ts @@ -4,11 +4,10 @@ import { endpoints } from "../../util/constants.ts"; /** Crosspost a message in a News Channel to following channels. */ export async function publishMessage(channelId: string, messageId: string) { - const data = - (await rest.runMethod( - "post", - endpoints.CHANNEL_MESSAGE_CROSSPOST(channelId, messageId), - )) as MessageCreateOptions; + const data = (await rest.runMethod( + "post", + endpoints.CHANNEL_MESSAGE_CROSSPOST(channelId, messageId), + )) as MessageCreateOptions; return structures.createMessageStruct(data); } diff --git a/src/helpers/templates/create_guild_template.ts b/src/helpers/templates/create_guild_template.ts index ea3ea2718..54a6936e9 100644 --- a/src/helpers/templates/create_guild_template.ts +++ b/src/helpers/templates/create_guild_template.ts @@ -23,12 +23,11 @@ export async function createGuildTemplate( throw new Error("The description can only be in between 0-120 characters."); } - const template = - (await rest.runMethod( - "post", - endpoints.GUILD_TEMPLATES(guildId), - data, - )) as GuildTemplate; + const template = (await rest.runMethod( + "post", + endpoints.GUILD_TEMPLATES(guildId), + data, + )) as GuildTemplate; return structures.createTemplateStruct(template); } diff --git a/src/helpers/templates/delete_guild_template.ts b/src/helpers/templates/delete_guild_template.ts index 36ab88ead..26fd9ad7f 100644 --- a/src/helpers/templates/delete_guild_template.ts +++ b/src/helpers/templates/delete_guild_template.ts @@ -13,11 +13,10 @@ export async function deleteGuildTemplate( ) { await requireBotGuildPermissions(guildId, ["MANAGE_GUILD"]); - const deletedTemplate = - (await rest.runMethod( - "delete", - `${endpoints.GUILD_TEMPLATES(guildId)}/${templateCode}`, - )) as GuildTemplate; + const deletedTemplate = (await rest.runMethod( + "delete", + `${endpoints.GUILD_TEMPLATES(guildId)}/${templateCode}`, + )) as GuildTemplate; return structures.createTemplateStruct(deletedTemplate); } diff --git a/src/helpers/templates/edit_guild_template.ts b/src/helpers/templates/edit_guild_template.ts index d4d458f3e..72c1934c6 100644 --- a/src/helpers/templates/edit_guild_template.ts +++ b/src/helpers/templates/edit_guild_template.ts @@ -22,12 +22,11 @@ export async function editGuildTemplate( throw new Error("The description can only be in between 0-120 characters."); } - const template = - (await rest.runMethod( - "patch", - `${endpoints.GUILD_TEMPLATES(guildId)}/${templateCode}`, - data, - )) as GuildTemplate; + const template = (await rest.runMethod( + "patch", + `${endpoints.GUILD_TEMPLATES(guildId)}/${templateCode}`, + data, + )) as GuildTemplate; return structures.createTemplateStruct(template); } diff --git a/src/helpers/templates/get_guild_templates.ts b/src/helpers/templates/get_guild_templates.ts index 5c6c7bc74..02290900e 100644 --- a/src/helpers/templates/get_guild_templates.ts +++ b/src/helpers/templates/get_guild_templates.ts @@ -10,11 +10,10 @@ import { requireBotGuildPermissions } from "../../util/permissions.ts"; export async function getGuildTemplates(guildId: string) { await requireBotGuildPermissions(guildId, ["MANAGE_GUILD"]); - const templates = - (await rest.runMethod( - "get", - endpoints.GUILD_TEMPLATES(guildId), - )) as GuildTemplate[]; + const templates = (await rest.runMethod( + "get", + endpoints.GUILD_TEMPLATES(guildId), + )) as GuildTemplate[]; return templates.map((template) => structures.createTemplateStruct(template)); } diff --git a/src/helpers/templates/get_template.ts b/src/helpers/templates/get_template.ts index 40e73c4f8..9c209123b 100644 --- a/src/helpers/templates/get_template.ts +++ b/src/helpers/templates/get_template.ts @@ -4,11 +4,10 @@ import { endpoints } from "../../util/constants.ts"; /** Returns the guild template if it exists */ export async function getTemplate(templateCode: string) { - const result = - (await rest.runMethod( - "get", - endpoints.GUILD_TEMPLATE(templateCode), - ) as GuildTemplate); + const result = (await rest.runMethod( + "get", + endpoints.GUILD_TEMPLATE(templateCode), + ) as GuildTemplate); const template = await structures.createTemplateStruct(result); return template; diff --git a/src/helpers/templates/sync_guild_template.ts b/src/helpers/templates/sync_guild_template.ts index a5fe10502..e657bb905 100644 --- a/src/helpers/templates/sync_guild_template.ts +++ b/src/helpers/templates/sync_guild_template.ts @@ -10,11 +10,10 @@ import { requireBotGuildPermissions } from "../../util/permissions.ts"; export async function syncGuildTemplate(guildId: string, templateCode: string) { await requireBotGuildPermissions(guildId, ["MANAGE_GUILD"]); - const template = - (await rest.runMethod( - "put", - `${endpoints.GUILD_TEMPLATES(guildId)}/${templateCode}`, - )) as GuildTemplate; + const template = (await rest.runMethod( + "put", + `${endpoints.GUILD_TEMPLATES(guildId)}/${templateCode}`, + )) as GuildTemplate; return structures.createTemplateStruct(template); } diff --git a/src/interactions/server.ts b/src/interactions/server.ts index 36ba85654..2c79031c4 100644 --- a/src/interactions/server.ts +++ b/src/interactions/server.ts @@ -90,7 +90,11 @@ async function handleApplicationCommand( } /** Internal function to verify security. Discord will send bad and good data and this function is important to verify it. If it is not verified properly, Discord will kill your bot. */ -export function verifySecurity(buffer: Uint8Array, signature: string, time: string) { +export function verifySecurity( + buffer: Uint8Array, + signature: string, + time: string, +) { const sig = new Uint8Array(64); const timestamp = new TextEncoder().encode(time); diff --git a/src/rest/rest.ts b/src/rest/rest.ts index 2448ac51a..b38fb3865 100644 --- a/src/rest/rest.ts +++ b/src/rest/rest.ts @@ -22,7 +22,7 @@ export const rest = { console.error(error); }, // PLACEHOLDERS TO ALLOW USERS TO CUSTOMIZE - debug: function(_type, error) {}, + debug: function (_type, error) {}, fetching() {}, fetched() {}, fetchSuccess() {}, diff --git a/src/rest/run_method.ts b/src/rest/run_method.ts index b45dcd30f..6c3780b4c 100644 --- a/src/rest/run_method.ts +++ b/src/rest/run_method.ts @@ -9,7 +9,7 @@ export function runMethod( url: string, body?: unknown, retryCount = 0, - bucketId?: string | null + bucketId?: string | null, ) { rest.eventHandlers.debug?.("requestCreate", { method, @@ -55,18 +55,19 @@ export function runMethod( return { rateLimited: rateLimitResetIn, beforeFetch: true, bucketId }; } - const query = - method === "get" && body - ? // deno-lint-ignore no-explicit-any - Object.entries(body as any) - .map( - ([key, value]) => - `${encodeURIComponent(key)}=${encodeURIComponent( - value as string | number | boolean - )}` - ) - .join("&") - : ""; + const query = method === "get" && body + ? // deno-lint-ignore no-explicit-any + Object.entries(body as any) + .map( + ([key, value]) => + `${encodeURIComponent(key)}=${ + encodeURIComponent( + value as string | number | boolean, + ) + }`, + ) + .join("&") + : ""; const urlToUse = method === "get" && query ? `${url}?${query}` : url; rest.eventHandlers.debug?.("requestFetch", { @@ -78,7 +79,7 @@ export function runMethod( }); const response = await fetch( urlToUse, - rest.createRequestBody(body, method) + rest.createRequestBody(body, method), ); rest.eventHandlers.debug?.("requestFetched", { method, @@ -90,7 +91,7 @@ export function runMethod( }); const bucketIdFromHeaders = rest.processRequestHeaders( url, - response.headers + response.headers, ); await rest.handleStatusCode(response, errorStack); diff --git a/src/types/guilds/list_guild_members.ts b/src/types/guilds/list_guild_members.ts index 2fda0a7bb..ce297344b 100644 --- a/src/types/guilds/list_guild_members.ts +++ b/src/types/guilds/list_guild_members.ts @@ -1,4 +1,3 @@ - export interface ListGuildMembers { /** Max number of members to return (1-1000). Default: 1 */ limit?: number; diff --git a/src/util/permissions.ts b/src/util/permissions.ts index 0d111aff3..62ee90feb 100644 --- a/src/util/permissions.ts +++ b/src/util/permissions.ts @@ -8,24 +8,23 @@ import { PermissionStrings } from "../types/permissions/permission_strings.ts"; async function getCached(table: "guilds", key: string | Guild): Promise; async function getCached( table: "channels", - key: string | Channel + key: string | Channel, ): Promise; async function getCached( table: "members", - key: string | Member + key: string | Member, ): Promise; async function getCached( table: "guilds" | "channels" | "members", - key: string | Guild | Channel | Member + key: string | Guild | Channel | Member, ) { - const cached = - typeof key === "string" - ? // @ts-ignore TS is wrong here - await cacheHandlers.get(table, key) - : key; + const cached = typeof key === "string" + ? // @ts-ignore TS is wrong here + await cacheHandlers.get(table, key) + : key; if (!cached || typeof cached === "string") { throw new Error( - Errors[`${table.slice(0, -1).toUpperCase()}_NOT_FOUND` as Errors] + Errors[`${table.slice(0, -1).toUpperCase()}_NOT_FOUND` as Errors], ); } @@ -35,7 +34,7 @@ async function getCached( /** Calculates the permissions this member has in the given guild */ export async function calculateBasePermissions( guild: string | Guild, - member: string | Member + member: string | Member, ) { guild = await getCached("guilds", guild); member = await getCached("members", member); @@ -60,7 +59,7 @@ export async function calculateBasePermissions( /** Calculates the permissions this member has for the given Channel */ export async function calculateChannelOverwrites( channel: string | Channel, - member: string | Member + member: string | Member, ) { channel = await getCached("channels", channel); @@ -71,12 +70,12 @@ export async function calculateChannelOverwrites( // Get all the role permissions this member already has let permissions = BigInt( - await calculateBasePermissions(channel.guildId, member) + await calculateBasePermissions(channel.guildId, member), ); // First calculate @everyone overwrites since these have the lowest priority const overwriteEveryone = channel?.permissionOverwrites.find( - (overwrite) => overwrite.id === (channel as Channel).guildId + (overwrite) => overwrite.id === (channel as Channel).guildId, ); if (overwriteEveryone) { // First remove denied permissions since denied < allowed @@ -103,7 +102,7 @@ export async function calculateChannelOverwrites( // Third calculate member specific overwrites since these have the highest priority const overwriteMember = overwrites.find( - (overwrite) => overwrite.id === (member as Member).id + (overwrite) => overwrite.id === (member as Member).id, ); if (overwriteMember) { permissions &= ~BigInt(overwriteMember.deny); @@ -116,14 +115,15 @@ export async function calculateChannelOverwrites( /** Checks if the given permission bits are matching the given permissions. `ADMINISTRATOR` always returns `true` */ export function validatePermissions( permissionBits: string, - permissions: PermissionStrings[] + permissions: PermissionStrings[], ) { if (BigInt(permissionBits) & 8n) return true; return permissions.every( (permission) => // Check if permission is in permissionBits - BigInt(permissionBits) & BigInt(DiscordBitwisePermissionFlags[permission]) + BigInt(permissionBits) & + BigInt(DiscordBitwisePermissionFlags[permission]), ); } @@ -131,7 +131,7 @@ export function validatePermissions( export async function hasGuildPermissions( guild: string | Guild, member: string | Member, - permissions: PermissionStrings[] + permissions: PermissionStrings[], ) { // First we need the role permission bits this member has const basePermissions = await calculateBasePermissions(guild, member); @@ -142,7 +142,7 @@ export async function hasGuildPermissions( /** Checks if the bot has these permissions in the given guild */ export function botHasGuildPermissions( guild: string | Guild, - permissions: PermissionStrings[] + permissions: PermissionStrings[], ) { // Since Bot is a normal member we can use the hasRolePermissions() function return hasGuildPermissions(guild, botId, permissions); @@ -152,7 +152,7 @@ export function botHasGuildPermissions( export async function hasChannelPermissions( channel: string | Channel, member: string | Member, - permissions: PermissionStrings[] + permissions: PermissionStrings[], ) { // First we need the overwrite bits this member has const channelOverwrites = await calculateChannelOverwrites(channel, member); @@ -163,7 +163,7 @@ export async function hasChannelPermissions( /** Checks if the bot has these permissions f0r the given channel */ export function botHasChannelPermissions( channel: string | Channel, - permissions: PermissionStrings[] + permissions: PermissionStrings[], ) { // Since Bot is a normal member we can use the hasRolePermissions() function return hasChannelPermissions(channel, botId, permissions); @@ -172,7 +172,7 @@ export function botHasChannelPermissions( /** Returns the permissions that are not in the given permissionBits */ export function missingPermissions( permissionBits: string, - permissions: PermissionStrings[] + permissions: PermissionStrings[], ) { if (BigInt(permissionBits) & 8n) return []; @@ -181,7 +181,7 @@ export function missingPermissions( !( BigInt(permissionBits) & BigInt(DiscordBitwisePermissionFlags[permission]) - ) + ), ); } @@ -189,7 +189,7 @@ export function missingPermissions( export async function getMissingGuildPermissions( guild: string | Guild, member: string | Member, - permissions: PermissionStrings[] + permissions: PermissionStrings[], ) { // First we need the role permissino bits this member has const permissionBits = await calculateBasePermissions(guild, member); @@ -201,7 +201,7 @@ export async function getMissingGuildPermissions( export async function getMissingChannelPermissions( channel: string | Channel, member: string | Member, - permissions: PermissionStrings[] + permissions: PermissionStrings[], ) { // First we need the role permissino bits this member has const permissionBits = await calculateChannelOverwrites(channel, member); @@ -213,7 +213,7 @@ export async function getMissingChannelPermissions( export async function requireGuildPermissions( guild: string | Guild, member: string | Member, - permissions: PermissionStrings[] + permissions: PermissionStrings[], ) { const missing = await getMissingGuildPermissions(guild, member, permissions); if (missing.length) { @@ -225,7 +225,7 @@ export async function requireGuildPermissions( /** Throws an error if the bot does not have all permissions */ export function requireBotGuildPermissions( guild: string | Guild, - permissions: PermissionStrings[] + permissions: PermissionStrings[], ) { // Since Bot is a normal member we can use the throwOnMissingGuildPermission() function return requireGuildPermissions(guild, botId, permissions); @@ -235,12 +235,12 @@ export function requireBotGuildPermissions( export async function requireChannelPermissions( channel: string | Channel, member: string | Member, - permissions: PermissionStrings[] + permissions: PermissionStrings[], ) { const missing = await getMissingChannelPermissions( channel, member, - permissions + permissions, ); if (missing.length) { // If the member is missing a permission throw an Error @@ -251,7 +251,7 @@ export async function requireChannelPermissions( /** Throws an error if the bot has not all of the given channel permissions */ export function requireBotChannelPermissions( channel: string | Channel, - permissions: PermissionStrings[] + permissions: PermissionStrings[], ) { // Since Bot is a normal member we can use the throwOnMissingChannelPermission() function return requireChannelPermissions(channel, botId, permissions); @@ -263,7 +263,8 @@ export function calculatePermissions(permissionBits: bigint) { // Since Object.keys() not only returns the permission names but also the bit values we need to return false if it is a Number if (Number(permission)) return false; // Check if permissionBits has this permission - return permissionBits & BigInt(DiscordBitwisePermissionFlags[permission as PermissionStrings]); + return permissionBits & + BigInt(DiscordBitwisePermissionFlags[permission as PermissionStrings]); }) as PermissionStrings[]; } @@ -280,7 +281,7 @@ export function calculateBits(permissions: PermissionStrings[]) { /** Gets the highest role from the member in this guild */ export async function highestRole( guild: string | Guild, - member: string | Member + member: string | Member, ) { guild = await getCached("guilds", guild); @@ -316,7 +317,7 @@ export async function highestRole( export async function higherRolePosition( guild: string | Guild, roleId: string, - otherRoleId: string + otherRoleId: string, ) { guild = await getCached("guilds", guild); @@ -336,7 +337,7 @@ export async function higherRolePosition( export async function isHigherPosition( guild: string | Guild, memberId: string, - compareRoleId: string + compareRoleId: string, ) { guild = await getCached("guilds", guild);