summary refs log tree commit diff
path: root/src/models/Channel.ts
blob: 068f6b672f5c44aaf5c99e3d8a24903bd71f5b04 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
export interface Channel {
	id: bigint;
	created_at: number;
	name: string;
	type: number;
	read_state: ReadState[];
}

export interface ReadState {
	last_message_id: bigint;
	last_pin_timestamp: number;
	mention_count: number;
}

export interface TextBasedChannel {
	messages: any[];
	last_message_id?: bigint;
	last_pin_timestamp?: number;
}

export interface GuildChannel extends Channel {
	guild_id: bigint;
	position: number;
	parent_id?: bigint;
	permission_overwrites: {
		allow: bigint;
		deny: bigint;
		id: bigint;
		type: number;
	}[];
}

export interface VoiceChannel extends GuildChannel {}

export interface TextChannel extends GuildChannel, TextBasedChannel {
	nsfw: boolean;
	rate_limit_per_user: number;
	topic?: string;
}

export interface DMChannel extends Channel, TextBasedChannel {
	owner_id: bigint;
	recipients: bigint[];
}

export enum ChannelType {
	GUILD_TEXT = 0, // a text channel within a server
	DM = 1, // a direct message between users
	GUILD_VOICE = 2, // a voice channel within a server
	GROUP_DM = 3, // a direct message between multiple users
	GUILD_CATEGORY = 4, // an organizational category that contains up to 50 channels
	GUILD_NEWS = 5, // a channel that users can follow and crosspost into their own server
	GUILD_STORE = 6, // a channel in which game developers can sell their game on Discord
}