Repository navigation
Expand file tree
/
Copy pathtypes.ts
More file actions
116 lines (105 loc) · 3.09 KB
/
Copy pathtypes.ts
File metadata and controls
116 lines (105 loc) · 3.09 KB
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
106
107
108
109
110
111
112
113
114
115
116
/*
* BestMessageLogger, a Vencord plugin by Kh8da
* SPDX-License-Identifier: GPL-3.0-or-later
*/
export type Tab = "deleted" | "edited" | "ghostPings";
export type Scope = "all" | "servers" | "dms";
/** A message in Discord's API shape (snake_case), safe to JSON encode. */
export type RawMessage = Record<string, any> & {
id: string;
channel_id: string;
content: string;
author: Record<string, any>;
};
export type MediaKind = "image" | "video" | "audio" | "file";
export interface LogMedia {
/** Stable key inside the message, used for the offline copy. */
key: string;
kind: MediaKind;
url: string;
proxyUrl: string;
filename: string;
contentType: string;
size: number;
width?: number;
height?: number;
spoiler?: boolean;
/** true for gifv style videos that should loop without controls */
gifv?: boolean;
source: "attachment" | "embed" | "sticker" | "component" | "forward";
/** true once a copy is stored on this computer */
saved?: boolean;
}
export interface LogEmbed {
color: string | null;
title: string;
url: string;
description: string;
authorName: string;
authorIcon: string;
providerName: string;
footerText: string;
fields: Array<{ name: string; value: string; inline: boolean; }>;
thumbnail: string;
image: string;
}
export interface LogAuthor {
id: string | null;
name: string;
username: string;
avatarUrl: string;
bot: boolean;
}
export interface LogMessage {
id: string;
channelId: string;
guildId: string | null;
/** names captured when the message was logged, used when the server or channel is gone */
guildName: string | null;
guildIconUrl: string | null;
channelName: string | null;
author: LogAuthor;
content: string;
timestamp: string;
editedTimestamp: string | null;
mentionEveryone: boolean;
mentionIds: string[];
mentionRoleIds: string[];
/** user id to display name, captured from the message */
mentionNames: Record<string, string>;
media: LogMedia[];
embeds: LogEmbed[];
/** text of components v2, polls and similar parts that have no normal content */
extraText: string[];
forwarded: { content: string; embeds: LogEmbed[]; } | null;
replyTo: { authorName: string; content: string; } | null;
}
export interface DeleteEntry {
tab: "deleted";
key: string;
deletedAt: string;
kind: "delete" | "bulk-delete";
message: LogMessage;
/** the original message, used to put it back into chat */
raw: RawMessage;
rawFromApi: boolean;
/** true after "Clear Message History" in chat; the entry stays in the log menu only */
hiddenInChat?: boolean;
}
export interface EditEntry {
tab: "edited";
key: string;
editedAt: string;
messageId: string;
channelId: string;
before: LogMessage;
after: LogMessage;
}
export interface GhostPingEntry {
tab: "ghostPings";
key: string;
detectedAt: string;
reason: "deleted" | "edited";
message: LogMessage;
}
export type LogEntry = DeleteEntry | EditEntry | GhostPingEntry;