2020-10-22 15:50:47 +00:00
|
|
|
import { Base } from './base.ts'
|
|
|
|
import {
|
|
|
|
Attachment,
|
|
|
|
ChannelMention,
|
|
|
|
EmbedPayload,
|
|
|
|
MessageActivity,
|
|
|
|
MessageApplication,
|
|
|
|
MessagePayload,
|
|
|
|
MessageReference,
|
|
|
|
Reaction
|
|
|
|
} from '../types/channelTypes.ts'
|
|
|
|
import { Client } from '../models/client.ts'
|
2020-10-23 16:11:00 +00:00
|
|
|
import { UserPayload } from '../types/userTypes.ts'
|
|
|
|
import { RolePayload } from '../types/roleTypes.ts'
|
2020-10-22 15:50:47 +00:00
|
|
|
|
2020-10-24 18:11:27 +00:00
|
|
|
export class Message extends Base {
|
2020-10-22 15:50:47 +00:00
|
|
|
id: string
|
2020-10-23 16:11:00 +00:00
|
|
|
channelID: string
|
|
|
|
guildID?: string
|
|
|
|
author: UserPayload
|
2020-10-22 15:50:47 +00:00
|
|
|
member?: any
|
|
|
|
content: string
|
|
|
|
timestamp: string
|
2020-10-23 16:11:00 +00:00
|
|
|
editedTimestamp?: string
|
2020-10-22 15:50:47 +00:00
|
|
|
tts: boolean
|
2020-10-23 16:11:00 +00:00
|
|
|
mentionEveryone: boolean
|
|
|
|
mentions: UserPayload[]
|
|
|
|
mentionRoles: RolePayload[]
|
|
|
|
mentionChannels?: ChannelMention[]
|
2020-10-22 15:50:47 +00:00
|
|
|
attachments: Attachment[]
|
|
|
|
embeds: EmbedPayload[]
|
2020-10-23 16:11:00 +00:00
|
|
|
reactions?: Reaction[]
|
|
|
|
nonce?: string | number
|
2020-10-22 15:50:47 +00:00
|
|
|
pinned: boolean
|
2020-10-23 16:11:00 +00:00
|
|
|
webhookId?: string
|
2020-10-22 15:50:47 +00:00
|
|
|
type: number
|
|
|
|
activity?: MessageActivity
|
|
|
|
application?: MessageApplication
|
2020-10-23 16:11:00 +00:00
|
|
|
messageReference?: MessageReference
|
|
|
|
flags?: number
|
2020-10-22 15:50:47 +00:00
|
|
|
|
|
|
|
constructor (client: Client, data: MessagePayload) {
|
|
|
|
super(client)
|
|
|
|
this.id = data.id
|
2020-10-23 16:11:00 +00:00
|
|
|
this.channelID = data.channel_id
|
|
|
|
this.guildID = data.guild_id
|
2020-10-22 15:50:47 +00:00
|
|
|
this.author = data.author
|
|
|
|
this.member = data.member
|
|
|
|
this.content = data.content
|
|
|
|
this.timestamp = data.timestamp
|
2020-10-23 16:11:00 +00:00
|
|
|
this.editedTimestamp = data.edited_timestamp
|
2020-10-22 15:50:47 +00:00
|
|
|
this.tts = data.tts
|
2020-10-23 16:11:00 +00:00
|
|
|
this.mentionEveryone = data.mention_everyone
|
2020-10-22 15:50:47 +00:00
|
|
|
this.mentions = data.mentions
|
2020-10-23 16:11:00 +00:00
|
|
|
this.mentionRoles = data.mention_roles
|
2020-10-22 15:50:47 +00:00
|
|
|
this.attachments = data.attachments
|
|
|
|
this.embeds = data.embeds
|
|
|
|
this.reactions = data.reactions
|
|
|
|
this.nonce = data.nonce
|
|
|
|
this.pinned = data.pinned
|
2020-10-23 16:11:00 +00:00
|
|
|
this.webhookId = data.webhook_id
|
2020-10-22 15:50:47 +00:00
|
|
|
this.type = data.type
|
|
|
|
this.activity = data.activity
|
|
|
|
this.application = data.application
|
2020-10-23 16:11:00 +00:00
|
|
|
this.messageReference = data.message_reference
|
2020-10-22 15:50:47 +00:00
|
|
|
this.flags = data.flags
|
|
|
|
}
|
|
|
|
}
|