From e15177c6183839b09117fb5c11ee9398aa58cff9 Mon Sep 17 00:00:00 2001 From: DjDeveloperr Date: Sun, 8 Nov 2020 14:01:00 +0530 Subject: [PATCH] Fix some conflicts --- src/gateway/handlers/guildBanAdd.ts | 4 +--- src/managers/guildChannels.ts | 6 +++++- src/models/client.ts | 8 ++++++-- src/models/commandClient.ts | 7 ++++++- src/structures/guild.ts | 11 ++++++++--- 5 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/gateway/handlers/guildBanAdd.ts b/src/gateway/handlers/guildBanAdd.ts index 232fc8d..1f9a687 100644 --- a/src/gateway/handlers/guildBanAdd.ts +++ b/src/gateway/handlers/guildBanAdd.ts @@ -8,9 +8,7 @@ export const guildBanAdd: GatewayEventHandler = async ( d: GuildBanAddPayload ) => { const guild: Guild | undefined = await gateway.client.guilds.get(d.guild_id) - const user: User = - (await gateway.client.users.get(d.user.id)) ?? - new User(gateway.client, d.user) + const user: User = await gateway.client.users.get(d.user.id) ?? new User(gateway.client, d.user) if (guild !== undefined) { await guild.members.delete(user.id) diff --git a/src/managers/guildChannels.ts b/src/managers/guildChannels.ts index e596733..c9a7bcf 100644 --- a/src/managers/guildChannels.ts +++ b/src/managers/guildChannels.ts @@ -4,7 +4,11 @@ import { Guild } from '../structures/guild.ts' import { CategoryChannel } from '../structures/guildCategoryChannel.ts' import { GuildTextChannel } from '../structures/guildTextChannel.ts' import { VoiceChannel } from '../structures/guildVoiceChannel.ts' -import { GuildChannelCategoryPayload, GuildTextChannelPayload, GuildVoiceChannelPayload } from '../types/channel.ts' +import { + GuildChannelCategoryPayload, + GuildTextChannelPayload, + GuildVoiceChannelPayload +} from '../types/channel.ts' import { CHANNEL } from '../types/endpoint.ts' import { BaseChildManager } from './baseChild.ts' import { ChannelsManager } from './channels.ts' diff --git a/src/models/client.ts b/src/models/client.ts index 748796c..7c27364 100644 --- a/src/models/client.ts +++ b/src/models/client.ts @@ -6,10 +6,14 @@ import EventEmitter from 'https://deno.land/std@0.74.0/node/events.ts' import { DefaultCacheAdapter, ICacheAdapter } from './cacheAdapter.ts' import { UserManager } from '../managers/users.ts' import { GuildManager } from '../managers/guilds.ts' -import { EmojisManager } from '../managers/emojis.ts' import { ChannelsManager } from '../managers/channels.ts' import { MessagesManager } from '../managers/messages.ts' -import { ActivityGame, ClientActivity, ClientPresence } from '../structures/presence.ts' +import { + ActivityGame, + ClientActivity, + ClientPresence +} from '../structures/presence.ts' +import { EmojisManager } from "../managers/emojis.ts" /** Some Client Options to modify behaviour */ export interface ClientOptions { diff --git a/src/models/commandClient.ts b/src/models/commandClient.ts index ffc9bab..87ca44d 100644 --- a/src/models/commandClient.ts +++ b/src/models/commandClient.ts @@ -141,7 +141,12 @@ export class CommandClient extends Client { this.emit('commandUsed', { context: ctx }) command.execute(ctx) } catch (e) { - if (this.texts.ERROR !== undefined) this.sendProcessedText(msg, this.texts.ERROR, Object.assign(baseReplaces, { error: e.message })) + if (this.texts.ERROR !== undefined) + return this.sendProcessedText( + msg, + this.texts.ERROR, + Object.assign(baseReplaces, { error: e.message }) + ) this.emit('commandError', { command, parsed, error: e }) } } diff --git a/src/structures/guild.ts b/src/structures/guild.ts index 1fceec9..08a6e2c 100644 --- a/src/structures/guild.ts +++ b/src/structures/guild.ts @@ -2,11 +2,11 @@ import { Client } from '../models/client.ts' import { GuildFeatures, GuildPayload } from '../types/guild.ts' import { PresenceUpdatePayload } from '../types/gateway.ts' import { Base } from './base.ts' -import { Emoji } from './emoji.ts' import { VoiceState } from './voiceState.ts' import { RolesManager } from '../managers/roles.ts' import { GuildChannelsManager } from '../managers/guildChannels.ts' import { MembersManager } from '../managers/members.ts' +import { EmojisManager } from "../managers/emojis.ts" export class Guild extends Base { id: string @@ -27,7 +27,7 @@ export class Guild extends Base { defaultMessageNotifications?: string explicitContentFilter?: string roles: RolesManager - emojis?: Emoji[] + emojis: EmojisManager features?: GuildFeatures[] mfaLevel?: string applicationID?: string @@ -60,8 +60,13 @@ export class Guild extends Base { this.id = data.id this.unavailable = data.unavailable this.members = new MembersManager(this.client, this) - this.channels = new GuildChannelsManager(this.client, this.client.channels, this) + this.channels = new GuildChannelsManager( + this.client, + this.client.channels, + this + ) this.roles = new RolesManager(this.client, this) + this.emojis = new EmojisManager(this.client) if (!this.unavailable) { this.name = data.name