-
Notifications
You must be signed in to change notification settings - Fork 16
/
types.d.ts
232 lines (201 loc) · 6.52 KB
/
types.d.ts
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
/// <reference path="./index.js" />
export interface RequestOptions {
method?: string
headers?: { [key: string]: string }
body?: any
}
export interface Message {
id: string
type: number
content: string
channel_id: string
author: {
id: string
username: string
avatar: string
discriminator: string
public_flags: number
flags: number
banner: any
accent_color: any
global_name: string
avatar_decoration: any
banner_color: any
}
attachments: any[]
embeds: any[]
mentions: any[]
mention_roles: any[]
pinned: boolean
mention_everyone: boolean
tts: boolean
timestamp: string
edited_timestamp: any
flags: number
components: any[]
nonce: string
referenced_message: any
}
export interface Embed {
title: string
description: string
// ...
}
export interface Thread {
id: string
name: string
// ...
}
export interface Role {
id: string
name: string
// ...
}
export interface Emoji {
id: string
name: string
// ...
}
export interface User {
id: string
username: string
avatar: string
discriminator: string
public_flags: number
flags: number
banner: any
accent_color: any
global_name: string
avatar_decoration: any
banner_color: any
mfa_enabled: boolean
locale: string
premium_type: number
email: string
verified: boolean
phone: string
nsfw_allowed: boolean
linked_users: any[]
bio: string
}
export interface Guild {
id: string
name: string
// ...
}
export interface ApplicationCommand {
id: string
type: number
application_id: string
version: string
name: string
description: string
options?: {
type: number
name: string
description: string
required: boolean
autocomplete: boolean
choices?: {
name: string
value: string
}[]
}[]
dm_permission: boolean
integration_types: number[]
global_popularity_rank?: number
guild_id?: string
default_member_permissions?: string
permissions?: {
roles: {
[key: string]: boolean
}
}
}
export interface GuildCommandsIndex {
applications: {
id: string
name: string
description: string
icon: string
bot_id: string
flags: string
}[]
application_commands: ApplicationCommand[]
version: string
}
export type api = {
getMessages(channelOrThreadId: string, limit?: number, params?: any): Promise<Message[]>
sendMessage(channelOrThreadId: string, message: string, tts?: boolean, body?: any): Promise<Message>
replyToMessage(channelOrThreadId: string, repliedMessageId: string, message: string, tts: boolean, body?: any): Promise<Message>
editMessage(channelOrThreadId: string, messageId: string, newMessage: string, body?: any): Promise<Message>
deleteMessage(channelOrThreadId: string, messageId: string): Promise<any>
createThread(channelId: string, toOpenThreadInmessageId: string, name: string, autoArchiveDuration?: number, body?: any): Promise<Thread>
createThreadWithoutMessage(channelId: string, name: string, autoArchiveDuration?: number, body?: any): Promise<Thread>
deleteThread(threadId: string): Promise<any>
sendEmbed(channelOrThreadId: string, embed?: Embed): Promise<Message>
getRoles(guildId: string): Promise<Role[]>
createRole(guildId: string, name: string): Promise<Role>
deleteRole(guildId: string, roleId: string): Promise<any>
getBans(guildId: string): Promise<User[]>
banUser(guildId: string, userId: string, reason: string): Promise<void>
unbanUser(guildId: string, userId: string): Promise<void>
kickUser(guildId: string, userId: string): Promise<void>
addRole(guildId: string, userId: string, roleId: string): Promise<void>
removeRole(guildId: string, userId: string, roleId: string): Promise<void>
auditLogs(guildId: string): Promise<any>
getChannels(guildId: string): Promise<any>
createChannel(guildId: string, name: string, type: string): Promise<any>
deleteChannel(channelId: string): Promise<void>
getChannel(channelOrThreadId: string): Promise<any>
pinnedMessages(channelId: string): Promise<Message[]>
addPin(channelId: string, messageId: string): Promise<void>
deletePin(channelId: string, messageId: string): Promise<void>
listEmojis(guildId: string): Promise<Emoji[]>
getEmoji(guildId: string, emojiId: string): Promise<Emoji>
createEmoji(guildId: string, name: string, image: string, roles: string[]): Promise<Emoji>
editEmoji(guildId: string, emojiId: string, name: string, roles: string[]): Promise<Emoji>
deleteEmoji(guildId: string, emojiId: string): Promise<void>
getGuildCommandsAndApplications(guildId: string): Promise<GuildCommandsIndex>
searchSlashCommands(guildId: string, searchWord: string): Promise<ApplicationCommand[]>
sendSlashCommand(guildId: string, channelOrThreadId: string, command: any, commandOptions?: any[]): Promise<any>
changeNick(guildId: string, nick: string): Promise<void>
leaveServer(guildId: string): Promise<void>
getServers(): Promise<Guild[]>
getGuilds(): Promise<Guild[]>
listCurrentUserGuilds(): Promise<Guild[]>
getDMs(): Promise<any>
getUser(userId: string): Promise<User>
getDirectFriendInviteLinks(): Promise<any>
createDirectFriendInviteLink(): Promise<any>
deleteDirectFriendInviteLinks(): Promise<any>
getCurrentUser(): Promise<User>
editCurrentUser(username?: string, bio?: string, body?: any): Promise<User>
setCustomStatus(emojiId: string, emojiName: string, expiresAt: string, text: string): Promise<void>
deleteCustomStatus(): Promise<void>
listReactions(channelOrThreadId: string, messageId: string, emojiUrl: string): Promise<any>
addReaction(channelOrThreadId: string, messageId: string, emojiUrl: string): Promise<void>
deleteReaction(channelOrThreadId: string, messageId: string, emojiUrl: string): Promise<void>
typing(channelOrThreadId: string): Promise<void>
delay(ms: number): Promise<void>
downloadFileByUrl: (url: string, filename: string) => Promise<void>
apiCall<T>(apiPath: string, body?: any, method?: string, options?: RequestOptions): Promise<T>
id(log?: boolean): void
update_guildId_and_channelId_withCurrentlyVisible(log?: boolean): void
getConfig(): Readonly<{
authHeader: string
autoUpdateToken: boolean
gid: string
/** Alias for `gid` */
guildId: string
cid: string
/** Alias for `cid` */
channelId: string
}>
setConfigAuthHeader(token: string): void
setConfigAutoUpdateToken: (autoUpdateToken: boolean) => void
setConfigGid: (guildId: string) => void
setConfigGuildId: (guildId: string) => void
setConfigCid: (channelId: string) => void
setConfigChannelId: (channelId: string) => void
}