From 4f12969cd8fd732cdeab9f7f97462882ea741d56 Mon Sep 17 00:00:00 2001 From: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com> Date: Sat, 26 Dec 2020 23:35:58 +0000 Subject: [PATCH] fmt --- src/api/structures/guild.ts | 46 ++++++++++++++++++++++++++++--------- src/rest/request_manager.ts | 8 ++++++- src/util/constants.ts | 3 ++- 3 files changed, 44 insertions(+), 13 deletions(-) diff --git a/src/api/structures/guild.ts b/src/api/structures/guild.ts index 6bcd79a49..60fa94a05 100644 --- a/src/api/structures/guild.ts +++ b/src/api/structures/guild.ts @@ -1,8 +1,32 @@ import { botID } from "../../bot.ts"; -import { BannedUser, ChannelCreatePayload, CreateGuildPayload, Emoji, GetAuditLogsOptions, GuildEditOptions, GuildFeatures, GuildMember, ImageFormats, ImageSize, MemberCreatePayload, Presence, VoiceState } from "../../types/types.ts"; +import { + BannedUser, + ChannelCreatePayload, + CreateGuildPayload, + Emoji, + GetAuditLogsOptions, + GuildEditOptions, + GuildFeatures, + GuildMember, + ImageFormats, + ImageSize, + MemberCreatePayload, + Presence, + VoiceState, +} from "../../types/types.ts"; import { cache } from "../../util/cache.ts"; import { Collection } from "../../util/collection.ts"; -import { deleteServer, editGuild, getAuditLogs, getBan, getBans, getInvites, guildBannerURL, guildIconURL, leaveGuild } from "../handlers/guild.ts"; +import { + deleteServer, + editGuild, + getAuditLogs, + getBan, + getBans, + getInvites, + guildBannerURL, + guildIconURL, + leaveGuild, +} from "../handlers/guild.ts"; import { Member } from "./member.ts"; import { Role, structures } from "./mod.ts"; import { Channel } from "./structures.ts"; @@ -11,10 +35,10 @@ export const initialMemberLoadQueue = new Map(); const baseGuild: Partial = { get members() { - return cache.members.filter(member => member.guilds.has(this.id!)); + return cache.members.filter((member) => member.guilds.has(this.id!)); }, get channels() { - return cache.channels.filter(channel => channel.guildID === this.id); + return cache.channels.filter((channel) => channel.guildID === this.id); }, get afkChannel() { return cache.channels.get(this.afkChannelID!); @@ -44,7 +68,7 @@ const baseGuild: Partial = { return Boolean(this.features?.includes("PARTNERED")); }, get verified() { - return Boolean(this.features?.includes("VERIFIED")) + return Boolean(this.features?.includes("VERIFIED")); }, bannerURL(size, format) { return guildBannerURL(this as Guild, size, format); @@ -72,7 +96,7 @@ const baseGuild: Partial = { }, leave() { return leaveGuild(this.id!); - } + }, }; export async function createGuild(data: CreateGuildPayload, shardID: number) { @@ -85,7 +109,7 @@ export async function createGuild(data: CreateGuildPayload, shardID: number) { public_updates_channel_id: publicUpdatesChannelID, max_video_channel_users: maxVideoChannelUsers, approximate_member_count: approximateMemberCount, -approximate_presence_count: approximatePresenceCount, + approximate_presence_count: approximatePresenceCount, owner_id: ownerID, afk_channel_id: afkChannelID, afk_timeout: afkTimeout, @@ -125,7 +149,7 @@ approximate_presence_count: approximatePresenceCount, publicUpdatesChannelID, maxVideoChannelUsers, approximateMemberCount, -approximatePresenceCount, + approximatePresenceCount, shardID, ownerID, afkChannelID, @@ -204,7 +228,7 @@ export interface Guild { /** Whether this guild is unavailable */ unavailable: boolean; /** The shard id that this guild is on */ - shardID: number, + shardID: number; /** The owner id of the guild. */ ownerID: string; /** The afk channel id for this guild. */ @@ -238,11 +262,11 @@ export interface Guild { /** When this guild was joined at. */ joinedAt: number; /** The presences of all the users in the guild. */ - presences: Collection, + presences: Collection; /** The total number of members in this guild. This value is updated as members leave and join the server. However, if you do not have the intent enabled to be able to listen to these events, then this will not be accurate. */ memberCount: number; /** The Voice State data for each user in a voice channel in this server. */ - voiceStates: Collection, + voiceStates: Collection; // GETTERS /** Members in this guild. */ diff --git a/src/rest/request_manager.ts b/src/rest/request_manager.ts index 64880892c..e1be393fb 100644 --- a/src/rest/request_manager.ts +++ b/src/rest/request_manager.ts @@ -1,6 +1,12 @@ import { authorization, eventHandlers } from "../bot.ts"; import { Errors, HttpResponseCode, RequestMethods } from "../types/types.ts"; -import { API_VERSION, baseEndpoints, BASE_URL, IMAGE_BASE_URL, USER_AGENT } from "../util/constants.ts"; +import { + API_VERSION, + BASE_URL, + baseEndpoints, + IMAGE_BASE_URL, + USER_AGENT, +} from "../util/constants.ts"; import { delay } from "../util/utils.ts"; const pathQueues: { [key: string]: QueuedRequest[] } = {}; diff --git a/src/util/constants.ts b/src/util/constants.ts index 251e97a46..6064a75b2 100644 --- a/src/util/constants.ts +++ b/src/util/constants.ts @@ -5,7 +5,8 @@ export const BASE_URL = "https://discord.com/api"; export const API_VERSION = 8; /** https://discord.com/developers/docs/reference#user-agent */ -export const USER_AGENT = "DiscordBot (https://github.com/discordeno/discordeno, v10)"; +export const USER_AGENT = + "DiscordBot (https://github.com/discordeno/discordeno, v10)"; /** https://discord.com/developers/docs/reference#image-formatting-image-base-url */ export const IMAGE_BASE_URL = "https://cdn.discordapp.com/";