Skip to main content
Module

x/coward/src/structures/Message.ts

πŸ” Coward is a Deno module for easy interaction with the Discord API.
Latest
File
import { Client } from "../Client.ts";import { User } from "./User.ts"import { GuildTextChannel } from "./GuildTextChannel.ts"import { DMChannel } from "./DMChannel.ts"import { GuildNewsChannel } from "./GuildNewsChannel.ts"
/** Class representing a message */export class Message { public id: string; public content: string; public channel: GuildTextChannel | DMChannel | GuildNewsChannel; public author: User; public timestamp: string;
constructor(data: any, protected client: Client) { this.id = data.id; this.content = data.content; var channel: any; var guildID: any = client.channelGuildIDs.get(data.channel_id); var guild: any = client.guilds.get(guildID); if(guild != undefined) { channel = guild.channels.get(data.channel_id); } else { channel = client.dmChannels.get(data.channel_id); } this.channel = channel; this.author = new User(data.author, client); this.timestamp = data.timestamp; }}