Skip to content

Commit

Permalink
fmt: format files
Browse files Browse the repository at this point in the history
  • Loading branch information
abdulrahman1s committed Jun 2, 2022
1 parent 342ba50 commit d528feb
Show file tree
Hide file tree
Showing 15 changed files with 23 additions and 22 deletions.
9 changes: 5 additions & 4 deletions src/client/BaseClient.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// deno-lint-ignore-file no-explicit-any
import { EventEmitter, REST, RESTOptions, deepMerge } from '../../deps.ts';
import { deepMerge, EventEmitter, REST, RESTOptions } from '../../deps.ts';
import { Client } from './mod.ts';
import type {
Channel,
Expand Down Expand Up @@ -88,16 +88,17 @@ export interface BaseClientOptions {
}

// deno-lint-ignore ban-types
type DeepPartial<T> = T extends object ? { [P in keyof T]?: DeepPartial<T[P]>; } : T;
type DeepPartial<T> = T extends object ? { [P in keyof T]?: DeepPartial<T[P]> }
: T;

export abstract class BaseClient extends EventEmitter {
readonly api: REST;
#token: string | null = null;
options: BaseClientOptions
options: BaseClientOptions;
bot = true;
constructor(opts: DeepPartial<BaseClientOptions> = {}) {
super();
this.options = deepMerge(DEFAULT_CLIENT_OPTIONS, opts) as BaseClientOptions
this.options = deepMerge(DEFAULT_CLIENT_OPTIONS, opts) as BaseClientOptions;
this.api = new REST(this.options.rest);
this.api.debug = (msg: string) => this.emit(Events.DEBUG, `[HTTP]: ${msg}`);
}
Expand Down
4 changes: 2 additions & 2 deletions src/client/actions/Action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ export abstract class Action {
abstract handle(data: unknown): Awaited<unknown | void>;
}

export { Events } from '../../util/Constants.ts'
export type { API } from '../../../deps.ts'
export { Events } from '../../util/Constants.ts';
export type { API } from '../../../deps.ts';
2 changes: 1 addition & 1 deletion src/client/actions/ChannelCreate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Action, Events, API } from './Action.ts';
import { Action, API, Events } from './Action.ts';

export class ChannelCreateAction extends Action {
async handle(data: API.Channel): Promise<unknown> {
Expand Down
2 changes: 1 addition & 1 deletion src/client/actions/ChannelUpdate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Action, Events, API } from './Action.ts';
import { Action, API, Events } from './Action.ts';

export class ChannelUpdateAction extends Action {
handle(
Expand Down
2 changes: 1 addition & 1 deletion src/client/actions/Message.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Action, Events, API } from './Action.ts';
import { Action, API, Events } from './Action.ts';
import { SYSTEM_USER_ID } from '../../util/Constants.ts';

export class MessageAction extends Action {
Expand Down
2 changes: 1 addition & 1 deletion src/client/actions/MessageUpdate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Action, Events, API} from './Action.ts';
import { Action, API, Events } from './Action.ts';

export class MessageUpdateAction extends Action {
handle(data: { id: string; channel: string; data: API.Message }): void {
Expand Down
8 changes: 4 additions & 4 deletions src/client/actions/ServerCreate.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Action, Events, API } from './Action.ts'
import { Action, API, Events } from './Action.ts';

export class ServerCreateAction extends Action {
async handle(data: API.Server): Promise<void> {
const server = this.client.servers._add(data)
const server = this.client.servers._add(data);

if (this.client.options.fetchMembers) {
await server.members.fetch()
await server.members.fetch();
}

this.client.emit(Events.SERVER_CREATE, server)
this.client.emit(Events.SERVER_CREATE, server);
}
}
2 changes: 1 addition & 1 deletion src/client/actions/ServerDelete.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Action, Events, API } from './Action.ts';
import { Action, API, Events } from './Action.ts';

export class ServerDeleteAction extends Action {
handle(data: API.Server): unknown {
Expand Down
2 changes: 1 addition & 1 deletion src/client/actions/ServerMemberUpdate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Action, Events, API } from './Action.ts';
import { Action, API, Events } from './Action.ts';

export class ServerMemberUpdateAction extends Action {
handle(data: { id: string; data: API.Member }): void {
Expand Down
2 changes: 1 addition & 1 deletion src/client/actions/ServerRoleUpdate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Action, Events, API } from './Action.ts';
import { Action, API, Events } from './Action.ts';

export class ServerRoleUpdateAction extends Action {
handle(
Expand Down
2 changes: 1 addition & 1 deletion src/client/actions/ServerUpdate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Action, Events, API } from './Action.ts';
import { Action, API, Events } from './Action.ts';

export class ServerUpdateAction extends Action {
handle(
Expand Down
2 changes: 1 addition & 1 deletion src/client/actions/UserUpdate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Action, Events, API } from './Action.ts';
import { Action, API, Events } from './Action.ts';

export class UserUpdateAction extends Action {
handle(data: { id: string; data: API.User; clear: API.FieldsUser[] }): void {
Expand Down
2 changes: 1 addition & 1 deletion src/client/actions/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export * from './ChannelStopTyping.ts';
export * from './Message.ts';
export * from './MessageDelete.ts';
export * from './MessageUpdate.ts';
export * from './ServerCreate.ts'
export * from './ServerCreate.ts';
export * from './ServerDelete.ts';
export * from './ServerMemberJoin.ts';
export * from './ServerMemberLeave.ts';
Expand Down
2 changes: 1 addition & 1 deletion src/structures/ClientUser.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { User } from './User.ts'
import { User } from './User.ts';
import { NotesChannel, Status } from './mod.ts';

export class ClientUser extends User {
Expand Down
2 changes: 1 addition & 1 deletion src/util/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const DEFAULT_CLIENT_OPTIONS: BaseClientOptions = {
},
ws: {
heartbeat: 30_000,
reconnect: true
reconnect: true,
},
} as const;

Expand Down

0 comments on commit d528feb

Please sign in to comment.