@koishijs/plugin-adapter-discord 2.0.0-alpha.7 → 2.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/bot.d.ts +8 -40
- package/lib/index.d.ts +11 -2
- package/lib/index.js +911 -143
- package/lib/index.js.map +3 -3
- package/lib/types/application.d.ts +78 -0
- package/lib/types/audit-log.d.ts +112 -0
- package/lib/types/channel.d.ts +247 -0
- package/lib/types/command.d.ts +144 -0
- package/lib/types/component.d.ts +84 -0
- package/lib/types/device.d.ts +41 -0
- package/lib/types/emoji.d.ts +144 -0
- package/lib/types/gateway.d.ts +242 -0
- package/lib/types/guild-member.d.ts +110 -0
- package/lib/types/guild-template.d.ts +26 -0
- package/lib/types/guild.d.ts +267 -0
- package/lib/types/index.d.ts +27 -0
- package/lib/types/integration.d.ts +97 -0
- package/lib/types/interaction.d.ts +125 -0
- package/lib/types/internal.d.ts +8 -0
- package/lib/types/invite.d.ts +113 -0
- package/lib/types/message.d.ts +318 -0
- package/lib/types/presence.d.ts +151 -0
- package/lib/types/role.d.ts +147 -0
- package/lib/types/stage-instance.d.ts +32 -0
- package/lib/types/sticker.d.ts +80 -0
- package/lib/types/team.d.ts +30 -0
- package/lib/types/user.d.ts +105 -0
- package/lib/types/voice.d.ts +68 -0
- package/lib/types/webhook.d.ts +86 -0
- package/lib/utils.d.ts +3 -3
- package/lib/ws.d.ts +3 -4
- package/package.json +4 -4
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Guild, integer, snowflake, Team, User } from '.';
|
|
2
|
+
/** https://discord.com/developers/docs/resources/application#application-object-application-structure */
|
|
3
|
+
export interface Application {
|
|
4
|
+
/** the id of the app */
|
|
5
|
+
id: snowflake;
|
|
6
|
+
/** the name of the app */
|
|
7
|
+
name: string;
|
|
8
|
+
/** the icon hash of the app */
|
|
9
|
+
icon?: string;
|
|
10
|
+
/** the description of the app */
|
|
11
|
+
description: string;
|
|
12
|
+
/** an array of rpc origin urls, if rpc is enabled */
|
|
13
|
+
rpc_origins?: string[];
|
|
14
|
+
/** when false only app owner can join the app's bot to guilds */
|
|
15
|
+
bot_public: boolean;
|
|
16
|
+
/** when true the app's bot will only join upon completion of the full oauth2 code grant flow */
|
|
17
|
+
bot_require_code_grant: boolean;
|
|
18
|
+
/** the url of the app's terms of service */
|
|
19
|
+
terms_of_service_url?: string;
|
|
20
|
+
/** the url of the app's privacy policy */
|
|
21
|
+
privacy_policy_url?: string;
|
|
22
|
+
/** partial user object containing info on the owner of the application */
|
|
23
|
+
owner?: Partial<User>;
|
|
24
|
+
/** if this application is a game sold on Discord, this field will be the summary field for the store page of its primary sku */
|
|
25
|
+
summary: string;
|
|
26
|
+
/** the hex encoded key for verification in interactions and the GameSDK's GetTicket */
|
|
27
|
+
verify_key: string;
|
|
28
|
+
/** if the application belongs to a team, this will be a list of the members of that team */
|
|
29
|
+
team?: Team;
|
|
30
|
+
/** if this application is a game sold on Discord, this field will be the guild to which it has been linked */
|
|
31
|
+
guild_id?: snowflake;
|
|
32
|
+
/** if this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists */
|
|
33
|
+
primary_sku_id?: snowflake;
|
|
34
|
+
/** if this application is a game sold on Discord, this field will be the URL slug that links to the store page */
|
|
35
|
+
slug?: string;
|
|
36
|
+
/** the application's default rich presence invite cover image hash */
|
|
37
|
+
cover_image?: string;
|
|
38
|
+
/** the application's public flags */
|
|
39
|
+
flags?: integer;
|
|
40
|
+
}
|
|
41
|
+
/** https://discord.com/developers/docs/resources/application#application-object-application-flags */
|
|
42
|
+
export declare enum ApplicationFlag {
|
|
43
|
+
GATEWAY_PRESENCE = 4096,
|
|
44
|
+
GATEWAY_PRESENCE_LIMITED = 8192,
|
|
45
|
+
GATEWAY_GUILD_MEMBERS = 16384,
|
|
46
|
+
GATEWAY_GUILD_MEMBERS_LIMITED = 32768,
|
|
47
|
+
VERIFICATION_PENDING_GUILD_LIMIT = 65536,
|
|
48
|
+
EMBEDDED = 131072
|
|
49
|
+
}
|
|
50
|
+
/** https://discord.com/developers/docs/topics/gateway#ready-ready-event-fields */
|
|
51
|
+
export interface ReadyEvent {
|
|
52
|
+
/** gateway version */
|
|
53
|
+
v: integer;
|
|
54
|
+
/** information about the user including email */
|
|
55
|
+
user: User;
|
|
56
|
+
/** the guilds the user is in */
|
|
57
|
+
guilds: Partial<Guild>[];
|
|
58
|
+
/** used for resuming connections */
|
|
59
|
+
session_id: string;
|
|
60
|
+
/** the shard information associated with this session, if sent when identifying */
|
|
61
|
+
shard?: [shard_id: integer, num_shards: integer];
|
|
62
|
+
/** contains id and flags */
|
|
63
|
+
application: Partial<Application>;
|
|
64
|
+
}
|
|
65
|
+
declare module './gateway' {
|
|
66
|
+
interface GatewayEvents {
|
|
67
|
+
/** contains the initial state information */
|
|
68
|
+
READY: ReadyEvent;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
declare module './internal' {
|
|
72
|
+
interface Internal {
|
|
73
|
+
/** https://discord.com/developers/docs/topics/oauth2#get-current-bot-application-information */
|
|
74
|
+
getCurrentBotApplicationInformation(): Promise<Application>;
|
|
75
|
+
/** https://discord.com/developers/docs/topics/oauth2#get-current-authorization-information */
|
|
76
|
+
getCurrentAuthorizationInformation(): Promise<any>;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Channel, Integration, snowflake, User, Webhook } from '.';
|
|
2
|
+
/** https://discord.com/developers/docs/resources/audit-log#audit-log-object-audit-log-structure */
|
|
3
|
+
export interface AuditLog {
|
|
4
|
+
/** list of audit log entries */
|
|
5
|
+
audit_log_entries: AuditLogEntry[];
|
|
6
|
+
/** list of partial integration objects */
|
|
7
|
+
integrations: Partial<Integration>[];
|
|
8
|
+
/** list of threads found in the audit log* */
|
|
9
|
+
threads: Channel[];
|
|
10
|
+
/** list of users found in the audit log */
|
|
11
|
+
users: User[];
|
|
12
|
+
/** list of webhooks found in the audit log */
|
|
13
|
+
webhooks: Webhook[];
|
|
14
|
+
}
|
|
15
|
+
/** https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-entry-structure */
|
|
16
|
+
export interface AuditLogEntry {
|
|
17
|
+
/** id of the affected entity (webhook, user, role, etc.) */
|
|
18
|
+
target_id?: string;
|
|
19
|
+
/** changes made to the target_id */
|
|
20
|
+
changes?: AuditLogChange[];
|
|
21
|
+
/** the user who made the changes */
|
|
22
|
+
user_id?: snowflake;
|
|
23
|
+
/** id of the entry */
|
|
24
|
+
id: snowflake;
|
|
25
|
+
/** type of action that occurred */
|
|
26
|
+
action_type: AuditLogEvent;
|
|
27
|
+
/** additional info for certain action types */
|
|
28
|
+
options?: OptionalAuditEntryInfo;
|
|
29
|
+
/** the reason for the change (0-512 characters) */
|
|
30
|
+
reason?: string;
|
|
31
|
+
}
|
|
32
|
+
/** https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events */
|
|
33
|
+
export declare enum AuditLogEvent {
|
|
34
|
+
GUILD_UPDATE = 1,
|
|
35
|
+
CHANNEL_CREATE = 10,
|
|
36
|
+
CHANNEL_UPDATE = 11,
|
|
37
|
+
CHANNEL_DELETE = 12,
|
|
38
|
+
CHANNEL_OVERWRITE_CREATE = 13,
|
|
39
|
+
CHANNEL_OVERWRITE_UPDATE = 14,
|
|
40
|
+
CHANNEL_OVERWRITE_DELETE = 15,
|
|
41
|
+
MEMBER_KICK = 20,
|
|
42
|
+
MEMBER_PRUNE = 21,
|
|
43
|
+
MEMBER_BAN_ADD = 22,
|
|
44
|
+
MEMBER_BAN_REMOVE = 23,
|
|
45
|
+
MEMBER_UPDATE = 24,
|
|
46
|
+
MEMBER_ROLE_UPDATE = 25,
|
|
47
|
+
MEMBER_MOVE = 26,
|
|
48
|
+
MEMBER_DISCONNECT = 27,
|
|
49
|
+
BOT_ADD = 28,
|
|
50
|
+
ROLE_CREATE = 30,
|
|
51
|
+
ROLE_UPDATE = 31,
|
|
52
|
+
ROLE_DELETE = 32,
|
|
53
|
+
INVITE_CREATE = 40,
|
|
54
|
+
INVITE_UPDATE = 41,
|
|
55
|
+
INVITE_DELETE = 42,
|
|
56
|
+
WEBHOOK_CREATE = 50,
|
|
57
|
+
WEBHOOK_UPDATE = 51,
|
|
58
|
+
WEBHOOK_DELETE = 52,
|
|
59
|
+
EMOJI_CREATE = 60,
|
|
60
|
+
EMOJI_UPDATE = 61,
|
|
61
|
+
EMOJI_DELETE = 62,
|
|
62
|
+
MESSAGE_DELETE = 72,
|
|
63
|
+
MESSAGE_BULK_DELETE = 73,
|
|
64
|
+
MESSAGE_PIN = 74,
|
|
65
|
+
MESSAGE_UNPIN = 75,
|
|
66
|
+
INTEGRATION_CREATE = 80,
|
|
67
|
+
INTEGRATION_UPDATE = 81,
|
|
68
|
+
INTEGRATION_DELETE = 82,
|
|
69
|
+
STAGE_INSTANCE_CREATE = 83,
|
|
70
|
+
STAGE_INSTANCE_UPDATE = 84,
|
|
71
|
+
STAGE_INSTANCE_DELETE = 85,
|
|
72
|
+
STICKER_CREATE = 90,
|
|
73
|
+
STICKER_UPDATE = 91,
|
|
74
|
+
STICKER_DELETE = 92,
|
|
75
|
+
THREAD_CREATE = 110,
|
|
76
|
+
THREAD_UPDATE = 111,
|
|
77
|
+
THREAD_DELETE = 112
|
|
78
|
+
}
|
|
79
|
+
/** https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info */
|
|
80
|
+
export interface OptionalAuditEntryInfo {
|
|
81
|
+
/** channel in which the entities were targeted */
|
|
82
|
+
channel_id: snowflake;
|
|
83
|
+
/** number of entities that were targeted */
|
|
84
|
+
count: string;
|
|
85
|
+
/** number of days after which inactive members were kicked */
|
|
86
|
+
delete_member_days: string;
|
|
87
|
+
/** id of the overwritten entity */
|
|
88
|
+
id: snowflake;
|
|
89
|
+
/** number of members removed by the prune */
|
|
90
|
+
members_removed: string;
|
|
91
|
+
/** id of the message that was targeted */
|
|
92
|
+
message_id: snowflake;
|
|
93
|
+
/** name of the role if type is "0" (not present if type is "1") */
|
|
94
|
+
role_name: string;
|
|
95
|
+
/** type of overwritten entity - "0" for "role" or "1" for "member" */
|
|
96
|
+
type: string;
|
|
97
|
+
}
|
|
98
|
+
/** https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-structure */
|
|
99
|
+
export interface AuditLogChange {
|
|
100
|
+
/** new value of the key */
|
|
101
|
+
new_value?: any;
|
|
102
|
+
/** old value of the key */
|
|
103
|
+
old_value?: any;
|
|
104
|
+
/** name of audit log change key */
|
|
105
|
+
key: string;
|
|
106
|
+
}
|
|
107
|
+
declare module './internal' {
|
|
108
|
+
interface Internal {
|
|
109
|
+
/** https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log */
|
|
110
|
+
getGuildAuditLog(guildId: snowflake): Promise<AuditLog>;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { GuildMember, integer, snowflake, timestamp, User } from '.';
|
|
2
|
+
/** https://discord.com/developers/docs/resources/channel#channel-object-channel-structure */
|
|
3
|
+
export interface Channel {
|
|
4
|
+
/** the id of this channel */
|
|
5
|
+
id: snowflake;
|
|
6
|
+
/** the type of channel */
|
|
7
|
+
type: integer;
|
|
8
|
+
/** the id of the guild (may be missing for some channel objects received over gateway guild dispatches) */
|
|
9
|
+
guild_id?: snowflake;
|
|
10
|
+
/** sorting position of the channel */
|
|
11
|
+
position?: integer;
|
|
12
|
+
/** explicit permission overwrites for members and roles */
|
|
13
|
+
permission_overwrites?: Overwrite[];
|
|
14
|
+
/** the name of the channel (1-100 characters) */
|
|
15
|
+
name?: string;
|
|
16
|
+
/** the channel topic (0-1024 characters) */
|
|
17
|
+
topic?: string;
|
|
18
|
+
/** whether the channel is nsfw */
|
|
19
|
+
nsfw?: boolean;
|
|
20
|
+
/** the id of the last message sent in this channel (may not point to an existing or valid message) */
|
|
21
|
+
last_message_id?: snowflake;
|
|
22
|
+
/** the bitrate (in bits) of the voice channel */
|
|
23
|
+
bitrate?: integer;
|
|
24
|
+
/** the user limit of the voice channel */
|
|
25
|
+
user_limit?: integer;
|
|
26
|
+
/** amount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission manage_messages or manage_channel, are unaffected */
|
|
27
|
+
rate_limit_per_user?: integer;
|
|
28
|
+
/** the recipients of the DM */
|
|
29
|
+
recipients?: User[];
|
|
30
|
+
/** icon hash */
|
|
31
|
+
icon?: string;
|
|
32
|
+
/** id of the creator of the group DM or thread */
|
|
33
|
+
owner_id?: snowflake;
|
|
34
|
+
/** application id of the group DM creator if it is bot-created */
|
|
35
|
+
application_id?: snowflake;
|
|
36
|
+
/** for guild channels: id of the parent category for a channel (each parent category can contain up to 50 channels), for threads: id of the text channel this thread was created */
|
|
37
|
+
parent_id?: snowflake;
|
|
38
|
+
/** when the last pinned message was pinned. This may be null in events such as GUILD_CREATE when a message is not pinned. */
|
|
39
|
+
last_pin_timestamp?: timestamp;
|
|
40
|
+
/** voice region id for the voice channel, automatic when set to null */
|
|
41
|
+
rtc_region?: string;
|
|
42
|
+
/** the camera video quality mode of the voice channel, 1 when not present */
|
|
43
|
+
video_quality_mode?: integer;
|
|
44
|
+
/** an approximate count of messages in a thread, stops counting at 50 */
|
|
45
|
+
message_count?: integer;
|
|
46
|
+
/** an approximate count of users in a thread, stops counting at 50 */
|
|
47
|
+
member_count?: integer;
|
|
48
|
+
/** thread-specific fields not needed by other channels */
|
|
49
|
+
thread_metadata?: ThreadMetadata;
|
|
50
|
+
/** thread member object for the current user, if they have joined the thread, only included on certain API endpoints */
|
|
51
|
+
member?: ThreadMember;
|
|
52
|
+
/** default duration for newly created threads, in minutes, to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080 */
|
|
53
|
+
default_auto_archive_duration?: integer;
|
|
54
|
+
/** computed permissions for the invoking user in the channel, including overwrites, only included when part of the resolved data received on a slash command interaction */
|
|
55
|
+
permissions?: string;
|
|
56
|
+
}
|
|
57
|
+
/** https://discord.com/developers/docs/resources/channel#channel-object-channel-types */
|
|
58
|
+
export declare enum ChannelType {
|
|
59
|
+
/** a text channel within a server */
|
|
60
|
+
GUILD_TEXT = 0,
|
|
61
|
+
/** a direct message between users */
|
|
62
|
+
DM = 1,
|
|
63
|
+
/** a voice channel within a server */
|
|
64
|
+
GUILD_VOICE = 2,
|
|
65
|
+
/** a direct message between multiple users */
|
|
66
|
+
GROUP_DM = 3,
|
|
67
|
+
/** an organizational category that contains up to 50 channels */
|
|
68
|
+
GUILD_CATEGORY = 4,
|
|
69
|
+
/** a channel that users can follow and crosspost into their own server */
|
|
70
|
+
GUILD_NEWS = 5,
|
|
71
|
+
/** a channel in which game developers can sell their game on Discord */
|
|
72
|
+
GUILD_STORE = 6,
|
|
73
|
+
/** a temporary sub-channel within a GUILD_NEWS channel */
|
|
74
|
+
GUILD_NEWS_THREAD = 10,
|
|
75
|
+
/** a temporary sub-channel within a GUILD_TEXT channel */
|
|
76
|
+
GUILD_PUBLIC_THREAD = 11,
|
|
77
|
+
/** a temporary sub-channel within a GUILD_TEXT channel that is only viewable by those invited and those with the MANAGE_THREADS permission */
|
|
78
|
+
GUILD_PRIVATE_THREAD = 12,
|
|
79
|
+
/** a voice channel for hosting events with an audience */
|
|
80
|
+
GUILD_STAGE_VOICE = 13
|
|
81
|
+
}
|
|
82
|
+
/** https://discord.com/developers/docs/resources/channel#followed-channel-object-followed-channel-structure */
|
|
83
|
+
export interface FollowedChannel {
|
|
84
|
+
/** source channel id */
|
|
85
|
+
channel_id: snowflake;
|
|
86
|
+
/** created target webhook id */
|
|
87
|
+
webhook_id: snowflake;
|
|
88
|
+
}
|
|
89
|
+
/** https://discord.com/developers/docs/resources/channel#overwrite-object-overwrite-structure */
|
|
90
|
+
export interface Overwrite {
|
|
91
|
+
/** role or user id */
|
|
92
|
+
id: snowflake;
|
|
93
|
+
/** either 0 (role) or 1 (member) */
|
|
94
|
+
type: integer;
|
|
95
|
+
/** permission bit set */
|
|
96
|
+
allow: string;
|
|
97
|
+
/** permission bit set */
|
|
98
|
+
deny: string;
|
|
99
|
+
}
|
|
100
|
+
/** https://discord.com/developers/docs/resources/channel#thread-metadata-object-thread-metadata-structure */
|
|
101
|
+
export interface ThreadMetadata {
|
|
102
|
+
/** whether the thread is archived */
|
|
103
|
+
archived: boolean;
|
|
104
|
+
/** duration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080 */
|
|
105
|
+
auto_archive_duration: integer;
|
|
106
|
+
/** timestamp when the thread's archive status was last changed, used for calculating recent activity */
|
|
107
|
+
archive_timestamp: timestamp;
|
|
108
|
+
/** whether the thread is locked; when a thread is locked, only users with MANAGE_THREADS can unarchive it */
|
|
109
|
+
locked: boolean;
|
|
110
|
+
/** whether non-moderators can add other non-moderators to a thread; only available on private threads */
|
|
111
|
+
invitable?: boolean;
|
|
112
|
+
}
|
|
113
|
+
/** https://discord.com/developers/docs/resources/channel#thread-member-object-thread-member-structure */
|
|
114
|
+
export interface ThreadMember {
|
|
115
|
+
/** the id of the thread */
|
|
116
|
+
id?: snowflake;
|
|
117
|
+
/** the id of the user */
|
|
118
|
+
user_id?: snowflake;
|
|
119
|
+
/** the time the current user last joined the thread */
|
|
120
|
+
join_timestamp: timestamp;
|
|
121
|
+
/** any user-thread settings, currently only used for notifications */
|
|
122
|
+
flags: integer;
|
|
123
|
+
}
|
|
124
|
+
/** https://discord.com/developers/docs/resources/channel#allowed-mentions-object-allowed-mention-types */
|
|
125
|
+
export declare enum AllowedMentionType {
|
|
126
|
+
/** Controls role mentions */
|
|
127
|
+
ROLE_MENTIONS = "roles",
|
|
128
|
+
/** Controls user mentions */
|
|
129
|
+
USER_MENTIONS = "users",
|
|
130
|
+
/** Controls @everyone and @here mentions */
|
|
131
|
+
EVERYONE_MENTIONS = "everyone"
|
|
132
|
+
}
|
|
133
|
+
/** https://discord.com/developers/docs/resources/channel#allowed-mentions-object-allowed-mentions-structure */
|
|
134
|
+
export interface AllowedMentions {
|
|
135
|
+
/** An array of allowed mention types to parse from the content. */
|
|
136
|
+
parse: AllowedMentionType[];
|
|
137
|
+
/** Array of role_ids to mention (Max size of 100) */
|
|
138
|
+
roles: snowflake[];
|
|
139
|
+
/** Array of user_ids to mention (Max size of 100) */
|
|
140
|
+
users: snowflake[];
|
|
141
|
+
/** For replies, whether to mention the author of the message being replied to (default false) */
|
|
142
|
+
replied_user: boolean;
|
|
143
|
+
}
|
|
144
|
+
export interface ChannelCreateEvent extends Channel {
|
|
145
|
+
}
|
|
146
|
+
export interface ChannelUpdateEvent extends Channel {
|
|
147
|
+
}
|
|
148
|
+
export interface ChannelDeleteEvent extends Channel {
|
|
149
|
+
}
|
|
150
|
+
/** https://discord.com/developers/docs/topics/gateway#channel-pins-update-channel-pins-update-event-fields */
|
|
151
|
+
export interface ChannelPinsUpdateEvent {
|
|
152
|
+
/** the id of the guild */
|
|
153
|
+
guild_id?: snowflake;
|
|
154
|
+
/** the id of the channel */
|
|
155
|
+
channel_id: snowflake;
|
|
156
|
+
/** the time at which the most recent pinned message was pinned */
|
|
157
|
+
last_pin_timestamp?: timestamp;
|
|
158
|
+
}
|
|
159
|
+
/** https://discord.com/developers/docs/topics/gateway#thread-list-sync-thread-list-sync-event-fields */
|
|
160
|
+
export interface ThreadListSyncEvent {
|
|
161
|
+
/** the id of the guild */
|
|
162
|
+
guild_id: snowflake;
|
|
163
|
+
/** the parent channel ids whose threads are being synced. If omitted, then threads were synced for the entire guild. This array may contain channel_ids that have no active threads as well, so you know to clear that data. */
|
|
164
|
+
channel_ids?: snowflake[];
|
|
165
|
+
/** all active threads in the given channels that the current user can access */
|
|
166
|
+
threads: Channel[];
|
|
167
|
+
/** all thread member objects from the synced threads for the current user, indicating which threads the current user has been added to */
|
|
168
|
+
members: ThreadMember[];
|
|
169
|
+
}
|
|
170
|
+
export interface ThreadMemberUpdateEvent extends ThreadMember {
|
|
171
|
+
}
|
|
172
|
+
/** https://discord.com/developers/docs/topics/gateway#thread-members-update-thread-members-update-event-fields */
|
|
173
|
+
export interface ThreadMembersUpdateEvent {
|
|
174
|
+
/** the id of the thread */
|
|
175
|
+
id: snowflake;
|
|
176
|
+
/** the id of the guild */
|
|
177
|
+
guild_id: snowflake;
|
|
178
|
+
/** the approximate number of members in the thread, capped at 50 */
|
|
179
|
+
member_count: integer;
|
|
180
|
+
/** the users who were added to the thread */
|
|
181
|
+
added_members?: ThreadMember[];
|
|
182
|
+
/** the id of the users who were removed from the thread */
|
|
183
|
+
removed_member_ids?: snowflake[];
|
|
184
|
+
}
|
|
185
|
+
/** https://discord.com/developers/docs/topics/gateway#typing-start-typing-start-event-fields */
|
|
186
|
+
export interface TypingStartEvent {
|
|
187
|
+
/** id of the channel */
|
|
188
|
+
channel_id: snowflake;
|
|
189
|
+
/** id of the guild */
|
|
190
|
+
guild_id?: snowflake;
|
|
191
|
+
/** id of the user */
|
|
192
|
+
user_id: snowflake;
|
|
193
|
+
/** unix time (in seconds) of when the user started typing */
|
|
194
|
+
timestamp: integer;
|
|
195
|
+
/** the member who started typing if this happened in a guild */
|
|
196
|
+
member?: GuildMember;
|
|
197
|
+
}
|
|
198
|
+
declare module './gateway' {
|
|
199
|
+
interface GatewayEvents {
|
|
200
|
+
/** new guild channel created */
|
|
201
|
+
CHANNEL_CREATE: ChannelCreateEvent;
|
|
202
|
+
/** channel was updated */
|
|
203
|
+
CHANNEL_UPDATE: ChannelUpdateEvent;
|
|
204
|
+
/** channel was deleted */
|
|
205
|
+
CHANNEL_DELETE: ChannelDeleteEvent;
|
|
206
|
+
/** message was pinned or unpinned */
|
|
207
|
+
CHANNEL_PINS_UPDATE: ChannelPinsUpdateEvent;
|
|
208
|
+
/** sent when gaining access to a channel, contains all active threads in that channel */
|
|
209
|
+
THREAD_LIST_SYNC: ThreadListSyncEvent;
|
|
210
|
+
/** thread member for the current user was updated */
|
|
211
|
+
THREAD_MEMBER_UPDATE: ThreadMemberUpdateEvent;
|
|
212
|
+
/** some user(s) were added to or removed from a thread */
|
|
213
|
+
THREAD_MEMBERS_UPDATE: ThreadMembersUpdateEvent;
|
|
214
|
+
/** user started typing in a channel */
|
|
215
|
+
TYPING_START: TypingStartEvent;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
export interface ChannelPosition {
|
|
219
|
+
/** channel id */
|
|
220
|
+
channel_id: snowflake;
|
|
221
|
+
/** sorting position of the channel */
|
|
222
|
+
position?: integer;
|
|
223
|
+
/** syncs the permission overwrites with the new parent, if moving to a new category */
|
|
224
|
+
lock_permissions?: boolean;
|
|
225
|
+
/** the new parent ID for the channel that is moved */
|
|
226
|
+
parent_id?: snowflake;
|
|
227
|
+
}
|
|
228
|
+
declare module './internal' {
|
|
229
|
+
interface Internal {
|
|
230
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-channels */
|
|
231
|
+
getGuildChannels(guild_id: snowflake): Promise<Channel[]>;
|
|
232
|
+
/** https://discord.com/developers/docs/resources/guild#create-guild-channel */
|
|
233
|
+
createGuildChannel(guild_id: snowflake, options: Partial<Channel>): Promise<Channel>;
|
|
234
|
+
/** https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions */
|
|
235
|
+
modifyGuildChannelPositions(guild_id: snowflake, positions: ChannelPosition[]): Promise<void>;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
declare module './internal' {
|
|
239
|
+
interface Internal {
|
|
240
|
+
/** https://discord.com/developers/docs/resources/channel#get-channel */
|
|
241
|
+
getChannel(channel_id: string): Promise<Channel>;
|
|
242
|
+
/** https://discord.com/developers/docs/resources/channel#modify-channel */
|
|
243
|
+
modifyChannel(channel_id: string, data: Partial<Channel>): Promise<Channel>;
|
|
244
|
+
/** https://discord.com/developers/docs/resources/channel#deleteclose-channel */
|
|
245
|
+
deleteChannel(channel_id: string): Promise<Channel>;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { ChannelType, snowflake } from '.';
|
|
2
|
+
/** https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-structure */
|
|
3
|
+
export interface ApplicationCommand {
|
|
4
|
+
/** unique id of the command */
|
|
5
|
+
id: snowflake;
|
|
6
|
+
/** the type of command, defaults 1 if not set */
|
|
7
|
+
type?: ApplicationCommandType;
|
|
8
|
+
/** unique id of the parent application */
|
|
9
|
+
application_id: snowflake;
|
|
10
|
+
/** guild id of the command, if not global */
|
|
11
|
+
guild_id?: snowflake;
|
|
12
|
+
/** 1-32 character name */
|
|
13
|
+
name: string;
|
|
14
|
+
/** 1-100 character description for CHAT_INPUT commands, empty string for USER and MESSAGE commands */
|
|
15
|
+
description: string;
|
|
16
|
+
/** the parameters for the command, max 25 */
|
|
17
|
+
options?: ApplicationCommandOption[];
|
|
18
|
+
/** whether the command is enabled by default when the app is added to a guild */
|
|
19
|
+
default_permission?: boolean;
|
|
20
|
+
/** autoincrementing version identifier updated during substantial record changes */
|
|
21
|
+
version: snowflake;
|
|
22
|
+
}
|
|
23
|
+
/** https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-types */
|
|
24
|
+
export declare enum ApplicationCommandType {
|
|
25
|
+
/** Slash commands; a text-based command that shows up when a user types / */
|
|
26
|
+
CHAT_INPUT = 1,
|
|
27
|
+
/** A UI-based command that shows up when you right click or tap on a user */
|
|
28
|
+
USER = 2,
|
|
29
|
+
/** A UI-based command that shows up when you right click or tap on a message */
|
|
30
|
+
MESSAGE = 3
|
|
31
|
+
}
|
|
32
|
+
/** https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure */
|
|
33
|
+
export interface ApplicationCommandOption {
|
|
34
|
+
/** the type of option */
|
|
35
|
+
type: ApplicationCommandOptionType;
|
|
36
|
+
/** 1-32 character name */
|
|
37
|
+
name: string;
|
|
38
|
+
/** 1-100 character description */
|
|
39
|
+
description: string;
|
|
40
|
+
/** if the parameter is required or optional--default false */
|
|
41
|
+
required?: boolean;
|
|
42
|
+
/** choices for STRING, INTEGER, and NUMBER types for the user to pick from, max 25 */
|
|
43
|
+
choices?: ApplicationCommandOptionChoice[];
|
|
44
|
+
/** if the option is a subcommand or subcommand group type, this nested options will be the parameters */
|
|
45
|
+
options?: ApplicationCommandOption[];
|
|
46
|
+
/** if the option is a channel type, the channels shown will be restricted to these types */
|
|
47
|
+
channel_types?: ChannelType[];
|
|
48
|
+
}
|
|
49
|
+
/** https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type */
|
|
50
|
+
export declare enum ApplicationCommandOptionType {
|
|
51
|
+
SUB_COMMAND = 1,
|
|
52
|
+
SUB_COMMAND_GROUP = 2,
|
|
53
|
+
STRING = 3,
|
|
54
|
+
/** Any integer between -2^53 and 2^53 */
|
|
55
|
+
INTEGER = 4,
|
|
56
|
+
BOOLEAN = 5,
|
|
57
|
+
USER = 6,
|
|
58
|
+
/** Includes all channel types + categories */
|
|
59
|
+
CHANNEL = 7,
|
|
60
|
+
ROLE = 8,
|
|
61
|
+
/** Includes users and roles */
|
|
62
|
+
MENTIONABLE = 9,
|
|
63
|
+
/** Any double between -2^53 and 2^53 */
|
|
64
|
+
NUMBER = 10
|
|
65
|
+
}
|
|
66
|
+
/** https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure */
|
|
67
|
+
export interface ApplicationCommandOptionChoice {
|
|
68
|
+
/** 1-100 character choice name */
|
|
69
|
+
name: string;
|
|
70
|
+
/** value of the choice, up to 100 characters if string */
|
|
71
|
+
value: string | number;
|
|
72
|
+
}
|
|
73
|
+
/** https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-interaction-data-option-structure */
|
|
74
|
+
export interface ApplicationCommandInteractionDataOption {
|
|
75
|
+
/** the name of the parameter */
|
|
76
|
+
name: string;
|
|
77
|
+
/** value of application command option type */
|
|
78
|
+
type: ApplicationCommandOptionType;
|
|
79
|
+
/** the value of the pair */
|
|
80
|
+
value?: ApplicationCommandOptionType;
|
|
81
|
+
/** present if this option is a group or subcommand */
|
|
82
|
+
options?: ApplicationCommandInteractionDataOption[];
|
|
83
|
+
}
|
|
84
|
+
/** https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-guild-application-command-permissions-structure */
|
|
85
|
+
export interface GuildApplicationCommandPermissions {
|
|
86
|
+
/** the id of the command */
|
|
87
|
+
id: snowflake;
|
|
88
|
+
/** the id of the application the command belongs to */
|
|
89
|
+
application_id: snowflake;
|
|
90
|
+
/** the id of the guild */
|
|
91
|
+
guild_id: snowflake;
|
|
92
|
+
/** the permissions for the command in the guild */
|
|
93
|
+
permissions: ApplicationCommandPermissions[];
|
|
94
|
+
}
|
|
95
|
+
/** https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permissions-structure */
|
|
96
|
+
export interface ApplicationCommandPermissions {
|
|
97
|
+
/** the id of the role or user */
|
|
98
|
+
id: snowflake;
|
|
99
|
+
/** role or user */
|
|
100
|
+
type: ApplicationCommandPermissionType;
|
|
101
|
+
/** true to allow, false, to disallow */
|
|
102
|
+
permission: boolean;
|
|
103
|
+
}
|
|
104
|
+
/** https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permission-type */
|
|
105
|
+
export declare enum ApplicationCommandPermissionType {
|
|
106
|
+
ROLE = 1,
|
|
107
|
+
USER = 2
|
|
108
|
+
}
|
|
109
|
+
declare module './internal' {
|
|
110
|
+
interface Internal {
|
|
111
|
+
/** https://discord.com/developers/docs/interactions/application-commands#get-global-application-commands */
|
|
112
|
+
getGlobalApplicationCommands(application_id: snowflake): Promise<ApplicationCommand[]>;
|
|
113
|
+
/** https://discord.com/developers/docs/interactions/application-commands#create-global-application-command */
|
|
114
|
+
createGlobalApplicationCommand(application_id: snowflake, command: Partial<ApplicationCommand>): Promise<ApplicationCommand>;
|
|
115
|
+
/** https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands */
|
|
116
|
+
bulkOverwriteGlobalApplicationCommands(application_id: snowflake): Promise<ApplicationCommand[]>;
|
|
117
|
+
/** https://discord.com/developers/docs/interactions/application-commands#get-global-application-command */
|
|
118
|
+
getGlobalApplicationCommand(application_id: snowflake, command_id: snowflake): Promise<ApplicationCommand>;
|
|
119
|
+
/** https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command */
|
|
120
|
+
editGlobalApplicationCommand(application_id: snowflake, command_id: snowflake, command: Partial<ApplicationCommand>): Promise<ApplicationCommand>;
|
|
121
|
+
/** https://discord.com/developers/docs/interactions/application-commands#delete-global-application-command */
|
|
122
|
+
deleteGlobalApplicationCommand(application_id: snowflake, command_id: snowflake): Promise<void>;
|
|
123
|
+
/** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands */
|
|
124
|
+
getGuildApplicationCommands(application_id: snowflake, guild_id: snowflake): Promise<ApplicationCommand[]>;
|
|
125
|
+
/** https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command */
|
|
126
|
+
createGuildApplicationCommand(application_id: snowflake, guild_id: snowflake, command: Partial<ApplicationCommand>): Promise<ApplicationCommand>;
|
|
127
|
+
/** https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands */
|
|
128
|
+
bulkOverwriteGuildApplicationCommands(application_id: snowflake, guild_id: snowflake): Promise<void>;
|
|
129
|
+
/** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions */
|
|
130
|
+
getGuildApplicationCommandPermissions(application_id: snowflake, guild_id: snowflake): Promise<GuildApplicationCommandPermissions[]>;
|
|
131
|
+
/** https://discord.com/developers/docs/interactions/application-commands#batch-edit-application-command-permissions */
|
|
132
|
+
batchEditApplicationCommandPermissions(application_id: snowflake, guild_id: snowflake, permissions: Partial<GuildApplicationCommandPermissions>[]): Promise<void>;
|
|
133
|
+
/** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command */
|
|
134
|
+
getGuildApplicationCommand(application_id: snowflake, guild_id: snowflake, command_id: snowflake): Promise<ApplicationCommand>;
|
|
135
|
+
/** https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command */
|
|
136
|
+
editGuildApplicationCommand(application_id: snowflake, guild_id: snowflake, command_id: snowflake, command: Partial<ApplicationCommand>): Promise<ApplicationCommand>;
|
|
137
|
+
/** https://discord.com/developers/docs/interactions/application-commands#delete-guild-application-command */
|
|
138
|
+
deleteGuildApplicationCommand(application_id: snowflake, guild_id: snowflake, command_id: snowflake): Promise<void>;
|
|
139
|
+
/** https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions */
|
|
140
|
+
getApplicationCommandPermissions(application_id: snowflake, guild_id: snowflake, command_id: snowflake): Promise<GuildApplicationCommandPermissions>;
|
|
141
|
+
/** https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions */
|
|
142
|
+
editApplicationCommandPermissions(application_id: snowflake, guild_id: snowflake, command_id: snowflake, permissions: ApplicationCommandPermissions[]): Promise<GuildApplicationCommandPermissions>;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Emoji, integer } from '.';
|
|
2
|
+
/** https://discord.com/developers/docs/interactions/message-components#component-object-component-structure */
|
|
3
|
+
export interface Component {
|
|
4
|
+
/** component type */
|
|
5
|
+
type: integer;
|
|
6
|
+
/** a developer-defined identifier for the component, max 100 characters */
|
|
7
|
+
custom_id?: string;
|
|
8
|
+
/** whether the component is disabled, default false */
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
/** one of button styles */
|
|
11
|
+
style?: integer;
|
|
12
|
+
/** text that appears on the button, max 80 characters */
|
|
13
|
+
label?: string;
|
|
14
|
+
/** name, id, and animated */
|
|
15
|
+
emoji?: Partial<Emoji>;
|
|
16
|
+
/** a url for link-style buttons */
|
|
17
|
+
url?: string;
|
|
18
|
+
/** the choices in the select, max 25 */
|
|
19
|
+
options?: SelectOption[];
|
|
20
|
+
/** custom placeholder text if nothing is selected, max 100 characters */
|
|
21
|
+
placeholder?: string;
|
|
22
|
+
/** the minimum number of items that must be chosen; default 1, min 0, max 25 */
|
|
23
|
+
min_values?: integer;
|
|
24
|
+
/** the maximum number of items that can be chosen; default 1, max 25 */
|
|
25
|
+
max_values?: integer;
|
|
26
|
+
/** a list of child components */
|
|
27
|
+
components?: Component[];
|
|
28
|
+
}
|
|
29
|
+
/** https://discord.com/developers/docs/interactions/message-components#component-object-component-types */
|
|
30
|
+
export declare enum ComponentType {
|
|
31
|
+
/** A container for other components */
|
|
32
|
+
ACTION_ROW = 1,
|
|
33
|
+
/** A button object */
|
|
34
|
+
BUTTON = 2,
|
|
35
|
+
/** A select menu for picking from choices */
|
|
36
|
+
SELECT_MENU = 3
|
|
37
|
+
}
|
|
38
|
+
/** https://discord.com/developers/docs/interactions/message-components#button-object-button-structure */
|
|
39
|
+
export interface Button {
|
|
40
|
+
/** 2 for a button */
|
|
41
|
+
type: integer;
|
|
42
|
+
/** one of button styles */
|
|
43
|
+
style: integer;
|
|
44
|
+
/** text that appears on the button, max 80 characters */
|
|
45
|
+
label?: string;
|
|
46
|
+
/** name, id, and animated */
|
|
47
|
+
emoji?: Partial<Emoji>;
|
|
48
|
+
/** a developer-defined identifier for the button, max 100 characters */
|
|
49
|
+
custom_id?: string;
|
|
50
|
+
/** a url for link-style buttons */
|
|
51
|
+
url?: string;
|
|
52
|
+
/** whether the button is disabled (default false) */
|
|
53
|
+
disabled?: boolean;
|
|
54
|
+
}
|
|
55
|
+
/** https://discord.com/developers/docs/interactions/message-components#select-menu-object-select-menu-structure */
|
|
56
|
+
export interface SelectMenu {
|
|
57
|
+
/** 3 for a select menu */
|
|
58
|
+
type: integer;
|
|
59
|
+
/** a developer-defined identifier for the button, max 100 characters */
|
|
60
|
+
custom_id: string;
|
|
61
|
+
/** the choices in the select, max 25 */
|
|
62
|
+
options: SelectOption[];
|
|
63
|
+
/** custom placeholder text if nothing is selected, max 100 characters */
|
|
64
|
+
placeholder?: string;
|
|
65
|
+
/** the minimum number of items that must be chosen; default 1, min 0, max 25 */
|
|
66
|
+
min_values?: integer;
|
|
67
|
+
/** the maximum number of items that can be chosen; default 1, max 25 */
|
|
68
|
+
max_values?: integer;
|
|
69
|
+
/** disable the select, default false */
|
|
70
|
+
disabled?: boolean;
|
|
71
|
+
}
|
|
72
|
+
/** https://discord.com/developers/docs/interactions/message-components#select-menu-object-select-option-structure */
|
|
73
|
+
export interface SelectOption {
|
|
74
|
+
/** the user-facing name of the option, max 100 characters */
|
|
75
|
+
label: string;
|
|
76
|
+
/** the dev-define value of the option, max 100 characters */
|
|
77
|
+
value: string;
|
|
78
|
+
/** an additional description of the option, max 100 characters */
|
|
79
|
+
description?: string;
|
|
80
|
+
/** id, name, and animated */
|
|
81
|
+
emoji?: Partial<Emoji>;
|
|
82
|
+
/** will render this option as selected by default */
|
|
83
|
+
default?: boolean;
|
|
84
|
+
}
|