Change Channel to TextChannel in messageCreate

This commit is contained in:
DjDeveloperr 2020-11-01 17:22:16 +05:30
parent 1c02edb015
commit 68c3fffd03

View file

@ -1,6 +1,7 @@
import { Channel } from "../../structures/channel.ts" import { Channel } from "../../structures/channel.ts"
import { Message } from "../../structures/message.ts" import { Message } from "../../structures/message.ts"
import { MessageMentions } from "../../structures/MessageMentions.ts" import { MessageMentions } from "../../structures/MessageMentions.ts"
import { TextChannel } from "../../structures/textChannel.ts"
import { User } from "../../structures/user.ts" import { User } from "../../structures/user.ts"
import { MessagePayload } from "../../types/channelTypes.ts" import { MessagePayload } from "../../types/channelTypes.ts"
import { Gateway, GatewayEventHandler } from '../index.ts' import { Gateway, GatewayEventHandler } from '../index.ts'
@ -11,7 +12,7 @@ export const messageCreate: GatewayEventHandler = async(
) => { ) => {
let channel = await gateway.client.channels.get(d.channel_id) let channel = await gateway.client.channels.get(d.channel_id)
// Fetch the channel if not cached // Fetch the channel if not cached
if(!channel) channel = (await gateway.client.channels.fetch(d.channel_id) as any) as Channel if(!channel) channel = (await gateway.client.channels.fetch(d.channel_id) as any) as TextChannel
let user = new User(gateway.client, d.author) let user = new User(gateway.client, d.author)
await gateway.client.users.set(d.author.id, d.author) await gateway.client.users.set(d.author.id, d.author)
let mentions = new MessageMentions() let mentions = new MessageMentions()