@koishijs/plugin-adapter-discord 2.0.0-beta.7 → 2.0.1
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 +13 -6
- package/lib/index.d.ts +0 -3
- package/lib/index.js +588 -462
- package/lib/index.js.map +3 -3
- package/lib/sender.d.ts +9 -7
- package/lib/types/application.d.ts +8 -2
- package/lib/types/audit-log.d.ts +111 -95
- package/lib/types/ban.d.ts +67 -0
- package/lib/types/channel.d.ts +223 -102
- package/lib/types/command.d.ts +182 -112
- package/lib/types/emoji.d.ts +26 -107
- package/lib/types/gateway.d.ts +8 -2
- package/lib/types/guild-member.d.ts +178 -72
- package/lib/types/guild-scheduled-event.d.ts +167 -0
- package/lib/types/guild-template.d.ts +62 -0
- package/lib/types/guild.d.ts +195 -43
- package/lib/types/index.d.ts +4 -0
- package/lib/types/integration.d.ts +14 -0
- package/lib/types/interaction.d.ts +59 -2
- package/lib/types/internal.d.ts +3 -3
- package/lib/types/invite.d.ts +127 -77
- package/lib/types/message.d.ts +274 -188
- package/lib/types/reaction.d.ts +114 -0
- package/lib/types/role.d.ts +74 -0
- package/lib/types/scheduled-event.d.ts +167 -0
- package/lib/types/stage-instance.d.ts +54 -8
- package/lib/types/sticker.d.ts +117 -48
- package/lib/types/thread.d.ts +201 -0
- package/lib/types/user.d.ts +28 -11
- package/lib/types/voice.d.ts +35 -1
- package/lib/types/webhook.d.ts +150 -37
- package/lib/utils.d.ts +4 -3
- package/lib/ws.d.ts +3 -6
- package/package.json +7 -6
package/lib/sender.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DiscordBot } from './bot';
|
|
2
|
-
import { Dict } from 'koishi';
|
|
2
|
+
import { Dict, Schema } from 'koishi';
|
|
3
3
|
export declare type HandleExternalAsset = 'auto' | 'download' | 'direct';
|
|
4
4
|
export declare type HandleMixedContent = 'auto' | 'separate' | 'attach';
|
|
5
5
|
export declare namespace Sender {
|
|
@@ -23,12 +23,14 @@ export declare namespace Sender {
|
|
|
23
23
|
export declare class Sender {
|
|
24
24
|
private bot;
|
|
25
25
|
private url;
|
|
26
|
+
static Config: Schema<Sender.Config>;
|
|
27
|
+
private results;
|
|
26
28
|
private errors;
|
|
27
29
|
private constructor();
|
|
28
|
-
static from(bot: DiscordBot, url: string): (content: string, addition?: Dict<any>) => Promise<string>;
|
|
29
|
-
post(data?: any, headers?: any): Promise<
|
|
30
|
-
sendEmbed(fileBuffer: ArrayBuffer, payload_json: Dict, filename: string): Promise<
|
|
31
|
-
sendContent(content: string, addition: Dict): Promise<
|
|
32
|
-
sendAsset(type: string, data: Dict<string>, addition: Dict): Promise<
|
|
33
|
-
sendMessage
|
|
30
|
+
static from(bot: DiscordBot, url: string): (content: string, addition?: Dict<any>) => Promise<string[]>;
|
|
31
|
+
post(data?: any, headers?: any): Promise<void>;
|
|
32
|
+
sendEmbed(fileBuffer: ArrayBuffer, payload_json: Dict, filename: string): Promise<void>;
|
|
33
|
+
sendContent(content: string, addition: Dict): Promise<void>;
|
|
34
|
+
sendAsset(type: string, data: Dict<string>, addition: Dict): Promise<void>;
|
|
35
|
+
sendMessage(content: string, addition?: Dict): Promise<string[]>;
|
|
34
36
|
}
|
|
@@ -70,9 +70,15 @@ declare module './gateway' {
|
|
|
70
70
|
}
|
|
71
71
|
declare module './internal' {
|
|
72
72
|
interface Internal {
|
|
73
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* Returns the bot's application object.
|
|
75
|
+
* @see https://discord.com/developers/docs/topics/oauth2#get-current-bot-application-information
|
|
76
|
+
*/
|
|
74
77
|
getCurrentBotApplicationInformation(): Promise<Application>;
|
|
75
|
-
/**
|
|
78
|
+
/**
|
|
79
|
+
* Returns info about the current authorization. Requires authentication with a bearer token.
|
|
80
|
+
* @see https://discord.com/developers/docs/topics/oauth2#get-current-authorization-information
|
|
81
|
+
*/
|
|
76
82
|
getCurrentAuthorizationInformation(): Promise<any>;
|
|
77
83
|
}
|
|
78
84
|
}
|
package/lib/types/audit-log.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Channel, Integration, snowflake, User, Webhook } from '.';
|
|
1
|
+
import { Channel, integer, Integration, snowflake, User, Webhook } from '.';
|
|
2
2
|
/** https://discord.com/developers/docs/resources/audit-log#audit-log-object-audit-log-structure */
|
|
3
3
|
export interface AuditLog {
|
|
4
4
|
/** list of audit log entries */
|
|
5
|
-
audit_log_entries:
|
|
5
|
+
audit_log_entries: AuditLog.Entry[];
|
|
6
6
|
/** list of partial integration objects */
|
|
7
7
|
integrations: Partial<Integration>[];
|
|
8
8
|
/** list of threads found in the audit log* */
|
|
@@ -12,101 +12,117 @@ export interface AuditLog {
|
|
|
12
12
|
/** list of webhooks found in the audit log */
|
|
13
13
|
webhooks: Webhook[];
|
|
14
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
|
-
|
|
15
|
+
export declare namespace AuditLog {
|
|
16
|
+
/** https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-entry-structure */
|
|
17
|
+
interface Entry {
|
|
18
|
+
/** id of the affected entity (webhook, user, role, etc.) */
|
|
19
|
+
target_id?: string;
|
|
20
|
+
/** changes made to the target_id */
|
|
21
|
+
changes?: Change[];
|
|
22
|
+
/** the user who made the changes */
|
|
23
|
+
user_id?: snowflake;
|
|
24
|
+
/** id of the entry */
|
|
25
|
+
id: snowflake;
|
|
26
|
+
/** type of action that occurred */
|
|
27
|
+
action_type: Type;
|
|
28
|
+
/** additional info for certain action types */
|
|
29
|
+
options?: OptionalInfo;
|
|
30
|
+
/** the reason for the change (0-512 characters) */
|
|
31
|
+
reason?: string;
|
|
32
|
+
}
|
|
33
|
+
/** https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events */
|
|
34
|
+
enum Type {
|
|
35
|
+
GUILD_UPDATE = 1,
|
|
36
|
+
CHANNEL_CREATE = 10,
|
|
37
|
+
CHANNEL_UPDATE = 11,
|
|
38
|
+
CHANNEL_DELETE = 12,
|
|
39
|
+
CHANNEL_OVERWRITE_CREATE = 13,
|
|
40
|
+
CHANNEL_OVERWRITE_UPDATE = 14,
|
|
41
|
+
CHANNEL_OVERWRITE_DELETE = 15,
|
|
42
|
+
MEMBER_KICK = 20,
|
|
43
|
+
MEMBER_PRUNE = 21,
|
|
44
|
+
MEMBER_BAN_ADD = 22,
|
|
45
|
+
MEMBER_BAN_REMOVE = 23,
|
|
46
|
+
MEMBER_UPDATE = 24,
|
|
47
|
+
MEMBER_ROLE_UPDATE = 25,
|
|
48
|
+
MEMBER_MOVE = 26,
|
|
49
|
+
MEMBER_DISCONNECT = 27,
|
|
50
|
+
BOT_ADD = 28,
|
|
51
|
+
ROLE_CREATE = 30,
|
|
52
|
+
ROLE_UPDATE = 31,
|
|
53
|
+
ROLE_DELETE = 32,
|
|
54
|
+
INVITE_CREATE = 40,
|
|
55
|
+
INVITE_UPDATE = 41,
|
|
56
|
+
INVITE_DELETE = 42,
|
|
57
|
+
WEBHOOK_CREATE = 50,
|
|
58
|
+
WEBHOOK_UPDATE = 51,
|
|
59
|
+
WEBHOOK_DELETE = 52,
|
|
60
|
+
EMOJI_CREATE = 60,
|
|
61
|
+
EMOJI_UPDATE = 61,
|
|
62
|
+
EMOJI_DELETE = 62,
|
|
63
|
+
MESSAGE_DELETE = 72,
|
|
64
|
+
MESSAGE_BULK_DELETE = 73,
|
|
65
|
+
MESSAGE_PIN = 74,
|
|
66
|
+
MESSAGE_UNPIN = 75,
|
|
67
|
+
INTEGRATION_CREATE = 80,
|
|
68
|
+
INTEGRATION_UPDATE = 81,
|
|
69
|
+
INTEGRATION_DELETE = 82,
|
|
70
|
+
STAGE_INSTANCE_CREATE = 83,
|
|
71
|
+
STAGE_INSTANCE_UPDATE = 84,
|
|
72
|
+
STAGE_INSTANCE_DELETE = 85,
|
|
73
|
+
STICKER_CREATE = 90,
|
|
74
|
+
STICKER_UPDATE = 91,
|
|
75
|
+
STICKER_DELETE = 92,
|
|
76
|
+
THREAD_CREATE = 110,
|
|
77
|
+
THREAD_UPDATE = 111,
|
|
78
|
+
THREAD_DELETE = 112
|
|
79
|
+
}
|
|
80
|
+
/** https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info */
|
|
81
|
+
interface OptionalInfo {
|
|
82
|
+
/** channel in which the entities were targeted */
|
|
83
|
+
channel_id: snowflake;
|
|
84
|
+
/** number of entities that were targeted */
|
|
85
|
+
count: string;
|
|
86
|
+
/** number of days after which inactive members were kicked */
|
|
87
|
+
delete_member_days: string;
|
|
88
|
+
/** id of the overwritten entity */
|
|
89
|
+
id: snowflake;
|
|
90
|
+
/** number of members removed by the prune */
|
|
91
|
+
members_removed: string;
|
|
92
|
+
/** id of the message that was targeted */
|
|
93
|
+
message_id: snowflake;
|
|
94
|
+
/** name of the role if type is "0" (not present if type is "1") */
|
|
95
|
+
role_name: string;
|
|
96
|
+
/** type of overwritten entity - "0" for "role" or "1" for "member" */
|
|
97
|
+
type: string;
|
|
98
|
+
}
|
|
99
|
+
/** https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-structure */
|
|
100
|
+
interface Change {
|
|
101
|
+
/** new value of the key */
|
|
102
|
+
new_value?: any;
|
|
103
|
+
/** old value of the key */
|
|
104
|
+
old_value?: any;
|
|
105
|
+
/** name of audit log change key */
|
|
106
|
+
key: string;
|
|
107
|
+
}
|
|
108
|
+
/** https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log-query-string-params */
|
|
109
|
+
interface GetParams {
|
|
110
|
+
/** filter the log for actions made by a user */
|
|
111
|
+
user_id?: snowflake;
|
|
112
|
+
/** the type of audit log event */
|
|
113
|
+
action_type?: Type;
|
|
114
|
+
/** filter the log before a certain entry id */
|
|
115
|
+
before?: snowflake;
|
|
116
|
+
/** how many entries are returned (default 50, minimum 1, maximum 100) */
|
|
117
|
+
limit?: integer;
|
|
118
|
+
}
|
|
106
119
|
}
|
|
107
120
|
declare module './internal' {
|
|
108
121
|
interface Internal {
|
|
109
|
-
/**
|
|
110
|
-
|
|
122
|
+
/**
|
|
123
|
+
* Returns an audit log object for the guild. Requires the 'VIEW_AUDIT_LOG' permission.
|
|
124
|
+
* @see https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log
|
|
125
|
+
*/
|
|
126
|
+
getGuildAuditLog(guildId: snowflake, params?: AuditLog.GetParams): Promise<AuditLog>;
|
|
111
127
|
}
|
|
112
128
|
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { integer, snowflake, User } from '.';
|
|
2
|
+
/** https://discord.com/developers/docs/resources/guild#ban-object-ban-structure */
|
|
3
|
+
export interface Ban {
|
|
4
|
+
/** the reason for the ban */
|
|
5
|
+
reason?: string;
|
|
6
|
+
/** the banned user */
|
|
7
|
+
user: User;
|
|
8
|
+
}
|
|
9
|
+
export declare namespace Ban {
|
|
10
|
+
namespace Event {
|
|
11
|
+
/** https://discord.com/developers/docs/topics/gateway#guild-ban-add-guild-ban-add-event-fields */
|
|
12
|
+
interface Add {
|
|
13
|
+
/** id of the guild */
|
|
14
|
+
guild_id: snowflake;
|
|
15
|
+
/** the banned user */
|
|
16
|
+
user: User;
|
|
17
|
+
}
|
|
18
|
+
/** https://discord.com/developers/docs/topics/gateway#guild-ban-remove-guild-ban-remove-event-fields */
|
|
19
|
+
interface Remove {
|
|
20
|
+
/** id of the guild */
|
|
21
|
+
guild_id: snowflake;
|
|
22
|
+
/** the unbanned user */
|
|
23
|
+
user: User;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
namespace Params {
|
|
27
|
+
/** https://discord.com/developers/docs/resources/guild#create-guild-ban-json-params */
|
|
28
|
+
interface Create {
|
|
29
|
+
/** number of days to delete messages for (0-7) */
|
|
30
|
+
delete_message_days?: integer;
|
|
31
|
+
/** reason for the ban (deprecated) */
|
|
32
|
+
reason?: string;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
declare module './gateway' {
|
|
37
|
+
interface GatewayEvents {
|
|
38
|
+
/** user was banned from a guild */
|
|
39
|
+
GUILD_BAN_ADD: Ban.Event.Add;
|
|
40
|
+
/** user was unbanned from a guild */
|
|
41
|
+
GUILD_BAN_REMOVE: Ban.Event.Remove;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
declare module './internal' {
|
|
45
|
+
interface Internal {
|
|
46
|
+
/**
|
|
47
|
+
* Returns a list of ban objects for the users banned from this guild. Requires the BAN_MEMBERS permission.
|
|
48
|
+
* @see https://discord.com/developers/docs/resources/guild#get-guild-bans
|
|
49
|
+
*/
|
|
50
|
+
getGuildBans(guild_id: snowflake): Promise<Ban[]>;
|
|
51
|
+
/**
|
|
52
|
+
* Returns a ban object for the given user or a 404 not found if the ban cannot be found. Requires the BAN_MEMBERS permission.
|
|
53
|
+
* @see https://discord.com/developers/docs/resources/guild#get-guild-ban
|
|
54
|
+
*/
|
|
55
|
+
getGuildBan(guild_id: snowflake, user_id: snowflake): Promise<Ban>;
|
|
56
|
+
/**
|
|
57
|
+
* Create a guild ban, and optionally delete previous messages sent by the banned user. Requires the BAN_MEMBERS permission. Returns a 204 empty response on success. Fires a Guild Ban Add Gateway event.
|
|
58
|
+
* @see https://discord.com/developers/docs/resources/guild#create-guild-ban
|
|
59
|
+
*/
|
|
60
|
+
createGuildBan(guild_id: snowflake, user_id: snowflake, params: Ban.Params.Create): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Remove the ban for a user. Requires the BAN_MEMBERS permissions. Returns a 204 empty response on success. Fires a Guild Ban Remove Gateway event.
|
|
63
|
+
* @see https://discord.com/developers/docs/resources/guild#remove-guild-ban
|
|
64
|
+
*/
|
|
65
|
+
removeGuildBan(guild_id: snowflake, user_id: snowflake): Promise<void>;
|
|
66
|
+
}
|
|
67
|
+
}
|