Oops fix error

This commit is contained in:
Helloyunho 2020-11-08 17:04:41 +09:00
parent 37e8d81bee
commit cc99b028c6
2 changed files with 13 additions and 13 deletions

View file

@ -6,7 +6,6 @@ import EventEmitter from 'https://deno.land/std@0.74.0/node/events.ts'
import { DefaultCacheAdapter, ICacheAdapter } from './cacheAdapter.ts' import { DefaultCacheAdapter, ICacheAdapter } from './cacheAdapter.ts'
import { UserManager } from '../managers/users.ts' import { UserManager } from '../managers/users.ts'
import { GuildManager } from '../managers/guilds.ts' import { GuildManager } from '../managers/guilds.ts'
import { EmojisManager } from '../managers/emojis.ts'
import { ChannelsManager } from '../managers/channels.ts' import { ChannelsManager } from '../managers/channels.ts'
import { MessagesManager } from '../managers/messages.ts' import { MessagesManager } from '../managers/messages.ts'
import { import {
@ -35,14 +34,13 @@ export class Client extends EventEmitter {
user?: User user?: User
ping = 0 ping = 0
token?: string token?: string
cache: ICacheAdapter = new DefaultCacheAdapter(this) cache: ICacheAdapter = new DefaultCacheAdapter()
intents?: GatewayIntents[] intents?: GatewayIntents[]
forceNewSession?: boolean forceNewSession?: boolean
users: UserManager = new UserManager(this) users: UserManager = new UserManager(this)
guilds: GuildManager = new GuildManager(this) guilds: GuildManager = new GuildManager(this)
channels: ChannelsManager = new ChannelsManager(this) channels: ChannelsManager = new ChannelsManager(this)
messages: MessagesManager = new MessagesManager(this) messages: MessagesManager = new MessagesManager(this)
emojis: EmojisManager = new EmojisManager(this)
bot: boolean = true bot: boolean = true
canary: boolean = false canary: boolean = false

View file

@ -5,9 +5,10 @@ import { Base } from './base.ts'
import { Emoji } from './emoji.ts' import { Emoji } from './emoji.ts'
import { VoiceState } from './voiceState.ts' import { VoiceState } from './voiceState.ts'
import cache from '../models/cache.ts' import cache from '../models/cache.ts'
import { RolesManager } from "../managers/roles.ts" import { RolesManager } from '../managers/roles.ts'
import { GuildChannelsManager } from "../managers/guildChannels.ts" import { GuildChannelsManager } from '../managers/guildChannels.ts'
import { MembersManager } from "../managers/members.ts" import { MembersManager } from '../managers/members.ts'
import { EmojisManager } from '../managers/emojis.ts'
export class Guild extends Base { export class Guild extends Base {
id: string id: string
@ -28,7 +29,7 @@ export class Guild extends Base {
defaultMessageNotifications?: string defaultMessageNotifications?: string
explicitContentFilter?: string explicitContentFilter?: string
roles: RolesManager roles: RolesManager
emojis?: Emoji[] emojis: EmojisManager
features?: GuildFeatures[] features?: GuildFeatures[]
mfaLevel?: string mfaLevel?: string
applicationID?: string applicationID?: string
@ -61,8 +62,13 @@ export class Guild extends Base {
this.id = data.id this.id = data.id
this.unavailable = data.unavailable this.unavailable = data.unavailable
this.members = new MembersManager(this.client, this) 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.roles = new RolesManager(this.client, this)
this.emojis = new EmojisManager(this.client, this)
if (!this.unavailable) { if (!this.unavailable) {
this.name = data.name this.name = data.name
@ -156,10 +162,6 @@ export class Guild extends Base {
// data.roles.map( // data.roles.map(
// v => cache.get('role', v.id) ?? new Role(this.client, v) // v => cache.get('role', v.id) ?? new Role(this.client, v)
// ) ?? this.roles // ) ?? this.roles
this.emojis =
data.emojis.map(
v => cache.get('emoji', v.id) ?? new Emoji(this.client, v)
) ?? this.emojis
this.features = data.features ?? this.features this.features = data.features ?? this.features
this.mfaLevel = data.mfa_level ?? this.mfaLevel this.mfaLevel = data.mfa_level ?? this.mfaLevel
this.systemChannelID = data.system_channel_id ?? this.systemChannelID this.systemChannelID = data.system_channel_id ?? this.systemChannelID