summary refs log tree commit diff
path: root/src/models/User.ts
blob: f591d26ec66e98e5f84d9504c4c414da614c8bbf (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import { Activity } from "./Activity";
import { ClientStatus, Status } from "./Status";

export interface User {
	id: bigint;
	username: string;
	discriminator: string;
	avatar: string | null;
	phone?: string;
	desktop: boolean;
	mobile: boolean;
	premium: boolean;
	premium_type: number;
	bot: boolean;
	system: boolean;
	nsfw_allowed: boolean;
	mfa_enabled: boolean;
	created_at: number;
	verified: boolean;
	email: string;
	flags: bigint; // TODO: automatically convert BigInt to BitField of UserFlags
	public_flags: bigint;
	hash: string; // hash of the password, salt is saved in password (bcrypt)
	guilds: bigint[]; // array of guild ids the user is part of
	valid_tokens_since: number; // all tokens with a previous issue date are invalid
	user_settings: UserSettings;
	relationships: Relationship[];
	connected_accounts: ConnectedAccount[];
	presence: {
		status: Status;
		activities: Activity[];
		client_status: ClientStatus;
	};
}

export interface PublicUser {
	id: bigint;
	discriminator: string;
	username: string;
	avatar?: string;
	publicFlags: bigint;
}

export interface ConnectedAccount {
	access_token: string;
	friend_sync: boolean;
	id: string;
	name: string;
	revoked: boolean;
	show_activity: boolean;
	type: string;
	verifie: boolean;
	visibility: number;
}

export interface Relationship {
	id: bigint;
	nickname?: string;
	type: number;
	user_id: bigint;
}

export interface UserSettings {
	afk_timeout: number;
	allow_accessibility_detection: boolean;
	animate_emoji: boolean;
	animate_stickers: number;
	contact_sync_enabled: boolean;
	convert_emoticons: boolean;
	custom_status: {
		emoji_id: bigint | null;
		emoji_name: string | null;
		expires_at: number | null;
		text: string | null;
	};
	default_guilds_restricted: boolean;
	detect_platform_accounts: boolean;
	developer_mode: boolean;
	disable_games_tab: boolean;
	enable_tts_command: boolean;
	explicit_content_filter: number;
	friend_source_flags: { all: boolean };
	gif_auto_play: boolean;
	guild_folders: // every top guild is displayed as a "folder"
	{
		color: number;
		guild_ids: bigint[];
		id: number;
		name: string;
	}[];
	guild_positions: bigint[]; // guild ids ordered by position
	inline_attachment_media: boolean;
	inline_embed_media: boolean;
	locale: string; // en_US
	message_display_compact: boolean;
	native_phone_integration_enabled: boolean;
	render_embeds: boolean;
	render_reactions: boolean;
	restricted_guilds: bigint[];
	show_current_game: boolean;
	status: "online" | "offline" | "dnd" | "idle";
	stream_notifications_enabled: boolean;
	theme: "dark" | "white"; // dark
	timezone_offset: number; // e.g -60
}