From fe6930c06523f6ed05480f2f2bd6cae622a09c25 Mon Sep 17 00:00:00 2001 From: noamboy2006 Date: Sat, 5 Dec 2020 11:24:08 +0900 Subject: [PATCH] miner grammer/typo fixes is comments. Changed all comments I can find to consider method as a singular noun, tho I might missed a few comments --- src/managers/base.ts | 16 ++++++++-------- src/managers/channels.ts | 2 +- src/managers/emojis.ts | 2 +- src/models/cacheAdapter.ts | 10 +++++----- src/models/client.ts | 10 +++++----- src/models/commandClient.ts | 8 ++++---- src/models/extensions.ts | 20 ++++++++++---------- src/models/rest.ts | 12 ++++++------ src/structures/guild.ts | 18 +++++++++--------- src/structures/member.ts | 16 ++++++++-------- src/structures/message.ts | 6 +++--- src/structures/webhook.ts | 8 ++++---- src/types/gateway.ts | 2 +- src/types/voice.ts | 2 +- src/utils/collection.ts | 4 ++-- 15 files changed, 68 insertions(+), 68 deletions(-) diff --git a/src/managers/base.ts b/src/managers/base.ts index c268045..77b3398 100644 --- a/src/managers/base.ts +++ b/src/managers/base.ts @@ -8,7 +8,7 @@ import { Collection } from '../utils/collection.ts' */ export class BaseManager { client: Client - /** Cache Name or Key used to differentiate caches */ + /** Caches Name or Key used to differentiate caches */ cacheName: string /** Which data type does this cache have */ DataType: any @@ -19,36 +19,36 @@ export class BaseManager { this.DataType = DataType } - /** Get raw value from a cache (payload) */ + /** Gets raw value from a cache (payload) */ async _get(key: string): Promise { return this.client.cache.get(this.cacheName, key) } - /** Get a value from Cache */ + /** Gets a value from Cache */ async get(key: string): Promise { const raw = await this._get(key) if (raw === undefined) return return new this.DataType(this.client, raw) } - /** Set a value to Cache */ + /** Sets a value to Cache */ async set(key: string, value: T): Promise { return this.client.cache.set(this.cacheName, key, value) } - /** Delete a key from Cache */ + /** Deletes a key from Cache */ async delete(key: string): Promise { return this.client.cache.delete(this.cacheName, key) } - /** Get an Array of values from Cache */ + /** Gets an Array of values from Cache */ async array(): Promise { let arr = await (this.client.cache.array(this.cacheName) as T[]) if (arr === undefined) arr = [] return arr.map((e) => new this.DataType(this.client, e)) as any } - /** Get a Collection of values from Cache */ + /** Gets a Collection of values from Cache */ async collection(): Promise> { const arr = await this.array() if (arr === undefined) return new Collection() @@ -60,7 +60,7 @@ export class BaseManager { return collection } - /** Delete everything from Cache */ + /** Deletes everything from Cache */ flush(): any { return this.client.cache.deleteCache(this.cacheName) } diff --git a/src/managers/channels.ts b/src/managers/channels.ts index 8c0fc78..cc821f3 100644 --- a/src/managers/channels.ts +++ b/src/managers/channels.ts @@ -43,7 +43,7 @@ export class ChannelsManager extends BaseManager { return result } - /** Fetch a Channel by ID, cache it, resolve it */ + /** Fetchs a Channel by ID, cache it, resolve it */ async fetch(id: string): Promise { return await new Promise((resolve, reject) => { this.client.rest diff --git a/src/managers/emojis.ts b/src/managers/emojis.ts index e5638bf..8fb1ac3 100644 --- a/src/managers/emojis.ts +++ b/src/managers/emojis.ts @@ -20,7 +20,7 @@ export class EmojisManager extends BaseManager { return emoji } - /** Fetch an Emoji by Guild ID and Emoji ID, cache it and resolve it */ + /** Fetchs an Emoji by Guild ID and Emoji ID, cache it and resolve it */ async fetch(guildID: string, id: string): Promise { return await new Promise((resolve, reject) => { this.client.rest diff --git a/src/models/cacheAdapter.ts b/src/models/cacheAdapter.ts index 64d7b01..fe9df03 100644 --- a/src/models/cacheAdapter.ts +++ b/src/models/cacheAdapter.ts @@ -11,20 +11,20 @@ import { * Methods can return Promises too. */ export interface ICacheAdapter { - /** Get a key from a Cache */ + /** Gets a key from a Cache */ get: (cacheName: string, key: string) => Promise | any - /** Set a key to value in a Cache Name with optional expire value in MS */ + /** Sets a key to value in a Cache Name with optional expire value in MS */ set: ( cacheName: string, key: string, value: any, expire?: number ) => Promise | any - /** Delete a key from a Cache */ + /** Deletes a key from a Cache */ delete: (cacheName: string, key: string) => Promise | boolean - /** Get array of all values in a Cache */ + /** Gets array of all values in a Cache */ array: (cacheName: string) => undefined | any[] | Promise - /** Entirely delete a Cache */ + /** Entirely deletes a Cache */ deleteCache: (cacheName: string) => any } diff --git a/src/models/client.ts b/src/models/client.ts index 7aa3a70..ba4c5bc 100644 --- a/src/models/client.ts +++ b/src/models/client.ts @@ -109,9 +109,9 @@ export class Client extends EventEmitter { } /** - * Set Cache Adapter + * Sets Cache Adapter * - * Should NOT set after bot is already logged in or using current cache. + * Should NOT be set after bot is already logged in or using current cache. * Please look into using `cache` option. */ setAdapter(adapter: ICacheAdapter): Client { @@ -119,7 +119,7 @@ export class Client extends EventEmitter { return this } - /** Change Presence of Client */ + /** Changes Presence of Client */ setPresence(presence: ClientPresence | ClientActivity | ActivityGame): void { if (presence instanceof ClientPresence) { this.presence = presence @@ -127,7 +127,7 @@ export class Client extends EventEmitter { this.gateway?.sendPresence(this.presence.create()) } - /** Emit debug event */ + /** Emits debug event */ debug(tag: string, msg: string): void { this.emit('debug', `[${tag}] ${msg}`) } @@ -136,7 +136,7 @@ export class Client extends EventEmitter { // fetchApplication(): Promise /** - * This function is used for connect to discord. + * This function is used for connecting to discord. * @param token Your token. This is required. * @param intents Gateway intents in array. This is required. */ diff --git a/src/models/commandClient.ts b/src/models/commandClient.ts index 8fd09ce..89477b0 100644 --- a/src/models/commandClient.ts +++ b/src/models/commandClient.ts @@ -102,7 +102,7 @@ export class CommandClient extends Client implements CommandClientOptions { ) } - /** Process a Message to Execute Command. */ + /** Processes a Message to Execute Command. */ async processMessage(msg: Message): Promise { if (!this.allowBots && msg.author.bot === true) return @@ -223,7 +223,7 @@ export class CommandClient extends Client implements CommandClientOptions { } // In these checks too, Command overrides Category if present - // Check if Command is only for Owners + // Checks if Command is only for Owners if ( (command.ownerOnly !== undefined || category === undefined ? command.ownerOnly @@ -232,7 +232,7 @@ export class CommandClient extends Client implements CommandClientOptions { ) return this.emit('commandOwnerOnly', ctx, command) - // Check if Command is only for Guild + // Checks if Command is only for Guild if ( (command.guildOnly !== undefined || category === undefined ? command.guildOnly @@ -241,7 +241,7 @@ export class CommandClient extends Client implements CommandClientOptions { ) return this.emit('commandGuildOnly', ctx, command) - // Check if Command is only for DMs + // Checks if Command is only for DMs if ( (command.dmOnly !== undefined || category === undefined ? command.dmOnly diff --git a/src/models/extensions.ts b/src/models/extensions.ts index c68bdc3..0fcbfd1 100644 --- a/src/models/extensions.ts +++ b/src/models/extensions.ts @@ -12,14 +12,14 @@ export class ExtensionCommands { this.extension = ext } - /** Get a list of Extension's Commands */ + /** Gets a list of Extension's Commands */ get list(): Collection { return this.extension.client.commands.list.filter( (c) => c.extension?.name === this.extension.name ) } - /** Get an Extension Command */ + /** Gets an Extension Command */ get(cmd: string): Command | undefined { const find = this.extension.client.commands.find(cmd) // linter sucks @@ -29,14 +29,14 @@ export class ExtensionCommands { else return find } - /** Add an Extension Command */ + /** Adds an Extension Command */ add(Cmd: Command | typeof Command): boolean { const cmd = Cmd instanceof Command ? Cmd : new Cmd() cmd.extension = this.extension return this.extension.client.commands.add(cmd) } - /** Delete an Extension Command */ + /** Deletes an Extension Command */ delete(cmd: Command | string): boolean { const find = this.extension.client.commands.find( typeof cmd === 'string' ? cmd : cmd.name @@ -50,7 +50,7 @@ export class ExtensionCommands { else return this.extension.client.commands.delete(find) } - /** Delete all Commands of an Extension */ + /** Deletes all Commands of an Extension */ deleteAll(): void { for (const [cmd] of this.list) { this.delete(cmd) @@ -74,7 +74,7 @@ export class Extension { this.client = client } - /** Listen for an Event through Extension. */ + /** Listens for an Event through Extension. */ listen(event: string, cb: ExtensionEventCallback): boolean { if (this.events[event] !== undefined) return false else { @@ -103,17 +103,17 @@ export class ExtensionsManager { this.client = client } - /** Get an Extension by name */ + /** Gets an Extension by name */ get(ext: string): Extension | undefined { return this.list.get(ext) } - /** Check whether an Extension exists or not */ + /** Checks whether an Extension exists or not */ exists(ext: string): boolean { return this.get(ext) !== undefined } - /** Load an Extension onto Command Client */ + /** Loads an Extension onto Command Client */ load(ext: Extension | typeof Extension): void { // eslint-disable-next-line new-cap if (!(ext instanceof Extension)) ext = new ext(this.client) @@ -123,7 +123,7 @@ export class ExtensionsManager { ext.load() } - /** Unload an Extension from Command Client */ + /** Unloads an Extension from Command Client */ unload(ext: Extension | string): boolean { const name = typeof ext === 'string' ? ext : ext.name const extension = this.get(name) diff --git a/src/models/rest.ts b/src/models/rest.ts index fd19bbf..a2a4538 100644 --- a/src/models/rest.ts +++ b/src/models/rest.ts @@ -308,7 +308,7 @@ export class RESTManager { } /** - * Make a Request to Discord API + * Makes a Request to Discord API * @param method HTTP Method to use * @param url URL of the Request * @param body Body to send with Request @@ -410,7 +410,7 @@ export class RESTManager { }) } - /** Make a GET Request to API */ + /** Makes a GET Request to API */ async get( url: string, body?: unknown, @@ -421,7 +421,7 @@ export class RESTManager { return await this.make('get', url, body, maxRetries, bucket, rawResponse) } - /** Make a POST Request to API */ + /** Makes a POST Request to API */ async post( url: string, body?: unknown, @@ -432,7 +432,7 @@ export class RESTManager { return await this.make('post', url, body, maxRetries, bucket, rawResponse) } - /** Make a DELETE Request to API */ + /** Makes a DELETE Request to API */ async delete( url: string, body?: unknown, @@ -443,7 +443,7 @@ export class RESTManager { return await this.make('delete', url, body, maxRetries, bucket, rawResponse) } - /** Make a PATCH Request to API */ + /** Makes a PATCH Request to API */ async patch( url: string, body?: unknown, @@ -454,7 +454,7 @@ export class RESTManager { return await this.make('patch', url, body, maxRetries, bucket, rawResponse) } - /** Make a PUT Request to API */ + /** Makes a PUT Request to API */ async put( url: string, body?: unknown, diff --git a/src/structures/guild.ts b/src/structures/guild.ts index b4fd05b..749984c 100644 --- a/src/structures/guild.ts +++ b/src/structures/guild.ts @@ -45,7 +45,7 @@ export class GuildBans { } /** - * Get all bans in the Guild. + * Gets all bans in the Guild. */ async all(): Promise { const res = await this.client.rest.get(GUILD_BANS(this.guild.id)) @@ -59,7 +59,7 @@ export class GuildBans { } /** - * Get ban details of a User if any. + * Gets ban details of a User if any. * @param user User to get ban of, ID or User object. */ async get(user: string | User): Promise { @@ -71,7 +71,7 @@ export class GuildBans { } /** - * Ban a User. + * Bans a User. * @param user User to ban, ID or User object. * @param reason Reason for the Ban. * @param deleteMessagesDays Delete Old Messages? If yes, how much days. @@ -95,7 +95,7 @@ export class GuildBans { } /** - * Unban (remove ban from) a User. + * Unbans (removes ban from) a User. * @param user User to unban, ID or User object. */ async remove(user: string | User): Promise { @@ -271,7 +271,7 @@ export class Guild extends Base { } /** - * Get Everyone role of the Guild + * Gets Everyone role of the Guild */ async getEveryoneRole(): Promise { // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion @@ -279,7 +279,7 @@ export class Guild extends Base { } /** - * Get current client's member in the Guild + * Gets current client's member in the Guild */ async me(): Promise { const get = await this.members.get(this.client.user?.id as string) @@ -288,7 +288,7 @@ export class Guild extends Base { } /** - * Fetch Guild's Integrations (Webhooks, Bots, etc.) + * Fetchs Guild's Integrations (Webhooks, Bots, etc.) */ async fetchIntegrations(): Promise { const raw = (await this.client.rest.get( @@ -298,7 +298,7 @@ export class Guild extends Base { } /** - * Chunk the Guild Members, i.e. cache them. + * Chunks the Guild Members, i.e. cache them. * @param options Options regarding the Members Request * @param wait Whether to wait for all Members to come before resolving Promise or not. * @param timeout Configurable timeout to cancel the wait to safely remove listener. @@ -344,7 +344,7 @@ export class GuildIntegration extends Base { expireGracePeriod?: number user?: User account: IntegrationAccountPayload - syncedAt?: string // Actually a ISO Timestamp, but we parse in constructor' + syncedAt?: string // Actually a ISO Timestamp, but we parse in constructor subscriberCount?: number revoked?: boolean application?: Application diff --git a/src/structures/member.ts b/src/structures/member.ts index 6996527..6f78396 100644 --- a/src/structures/member.ts +++ b/src/structures/member.ts @@ -65,7 +65,7 @@ export class Member extends Base { } /** - * Update the Member data in cache (and this object). + * Updates the Member data in cache (and this object). */ async fetch(): Promise { const raw = await this.client.rest.get(this.id) @@ -76,7 +76,7 @@ export class Member extends Base { } /** - * Edit the Member + * Edits the Member * @param data Data to apply */ async edit(data: MemberData): Promise { @@ -113,14 +113,14 @@ export class Member extends Base { } /** - * Reset nickname of the Member + * Resets nickname of the Member */ async resetNickname(): Promise { return await this.setNickname() } /** - * Set mute of a Member in VC + * Sets a Member mute in VC * @param mute Value to set */ async setMute(mute?: boolean): Promise { @@ -130,7 +130,7 @@ export class Member extends Base { } /** - * Set deaf of a Member in VC + * Sets a Member deaf in VC * @param deaf Value to set */ async setDeaf(deaf?: boolean): Promise { @@ -140,14 +140,14 @@ export class Member extends Base { } /** - * Unmute the Member from VC. + * Unmutes the Member from VC. */ async unmute(): Promise { return await this.setMute(false) } /** - * Kick the member. + * Kicks the member. */ async kick(): Promise { const resp = await this.client.rest.delete( @@ -162,7 +162,7 @@ export class Member extends Base { } /** - * Ban the Member. + * Bans the Member. * @param reason Reason for the Ban. * @param deleteMessagesDays Delete Old Messages? If yes, how much days. */ diff --git a/src/structures/message.ts b/src/structures/message.ts index cf5a40d..88ea254 100644 --- a/src/structures/message.ts +++ b/src/structures/message.ts @@ -103,7 +103,7 @@ export class Message extends Base { this.flags = data.flags ?? this.flags } - /** Edit this message. */ + /** Edits this message. */ async edit(text?: string, option?: MessageOption): Promise { if ( this.client.user !== undefined && @@ -113,7 +113,7 @@ export class Message extends Base { return this.channel.editMessage(this.id, text, option) } - /** Create a Reply to this Message. */ + /** Creates a Reply to this Message. */ async reply( text?: string | AllMessageOptions, option?: AllMessageOptions @@ -121,7 +121,7 @@ export class Message extends Base { return this.channel.send(text, option, this) } - /** Delete the Message. */ + /** Deletes the Message. */ async delete(): Promise { return this.client.rest.delete(CHANNEL_MESSAGE(this.channelID, this.id)) } diff --git a/src/structures/webhook.ts b/src/structures/webhook.ts index 8adca66..ccc32f6 100644 --- a/src/structures/webhook.ts +++ b/src/structures/webhook.ts @@ -89,7 +89,7 @@ export class Webhook { return this } - /** Send a Message through Webhook. */ + /** Sends a Message through Webhook. */ async send( text?: string | AllWebhookMessageOptions, option?: AllWebhookMessageOptions @@ -149,7 +149,7 @@ export class Webhook { } /** - * Create a Webhook object from URL + * Creates a Webhook object from URL * @param url URL of the Webhook * @param client Client (bot) object, if any. */ @@ -165,7 +165,7 @@ export class Webhook { } /** - * Edit the Webhook name, avatar, or channel (requires authentication). + * Edits the Webhook name, avatar, or channel (requires authentication). * @param options Options to edit the Webhook. */ async edit(options: WebhookEditOptions): Promise { @@ -185,7 +185,7 @@ export class Webhook { return this } - /** Delete the Webhook. */ + /** Deletes the Webhook. */ async delete(): Promise { const resp = await this.rest.delete(this.url, undefined, 0, undefined, true) if (resp.response.status !== 204) return false diff --git a/src/types/gateway.ts b/src/types/gateway.ts index 010f111..b4661cb 100644 --- a/src/types/gateway.ts +++ b/src/types/gateway.ts @@ -16,7 +16,7 @@ import { UserPayload } from './user.ts' /** * Gateway OPcodes from Discord docs. */ -export enum GatewayOpcodes { // 문서를 확인해본 결과 Opcode 5번은 비어있다. - UnderC - +export enum GatewayOpcodes { //Opcode 5 is empty according to discord api docs. DISPATCH = 0, HEARTBEAT = 1, IDENTIFY = 2, diff --git a/src/types/voice.ts b/src/types/voice.ts index 455af9e..45f518c 100644 --- a/src/types/voice.ts +++ b/src/types/voice.ts @@ -1,7 +1,7 @@ // https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice import { MemberPayload } from './guild.ts' -export enum VoiceOpcodes { // VoiceOpcodes 추가 - UnderC - +export enum VoiceOpcodes { // add VoiceOpcodes - UnderC - IDENTIFY = 0, SELECT_PROTOCOL = 1, READY = 2, diff --git a/src/utils/collection.ts b/src/utils/collection.ts index 01f6b96..7973ca9 100644 --- a/src/utils/collection.ts +++ b/src/utils/collection.ts @@ -54,7 +54,7 @@ export class Collection extends Map { return results } - /** Check if any of the values/keys in Collection satisfy callback */ + /** Check if any of the values/keys in Collection satisfies callback */ some(callback: (value: V, key: K) => boolean): boolean { for (const key of this.keys()) { const value = this.get(key) as V @@ -63,7 +63,7 @@ export class Collection extends Map { return false } - /** Check if every value/key in Collection satisfy callback */ + /** Check if every value/key in Collection satisfies callback */ every(callback: (value: V, key: K) => boolean): boolean { for (const key of this.keys()) { const value = this.get(key) as V