@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,80 @@
|
|
|
1
|
+
import { integer, snowflake, User } from '.';
|
|
2
|
+
/** https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-structure */
|
|
3
|
+
export interface Sticker {
|
|
4
|
+
/** id of the sticker */
|
|
5
|
+
id: snowflake;
|
|
6
|
+
/** for standard stickers, id of the pack the sticker is from */
|
|
7
|
+
pack_id?: snowflake;
|
|
8
|
+
/** name of the sticker */
|
|
9
|
+
name: string;
|
|
10
|
+
/** description of the sticker */
|
|
11
|
+
description?: string;
|
|
12
|
+
/** autocomplete/suggestion tags for the sticker (max 200 characters) */
|
|
13
|
+
tags: string;
|
|
14
|
+
/** Deprecated previously the sticker asset hash, now an empty string */
|
|
15
|
+
asset: string;
|
|
16
|
+
/** type of sticker */
|
|
17
|
+
type: integer;
|
|
18
|
+
/** type of sticker format */
|
|
19
|
+
format_type: integer;
|
|
20
|
+
/** whether this guild sticker can be used, may be false due to loss of Server Boosts */
|
|
21
|
+
available?: boolean;
|
|
22
|
+
/** id of the guild that owns this sticker */
|
|
23
|
+
guild_id?: snowflake;
|
|
24
|
+
/** the user that uploaded the guild sticker */
|
|
25
|
+
user?: User;
|
|
26
|
+
/** the standard sticker's sort order within its pack */
|
|
27
|
+
sort_value?: integer;
|
|
28
|
+
}
|
|
29
|
+
/** https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-types */
|
|
30
|
+
export declare enum StickerType {
|
|
31
|
+
/** an official sticker in a pack, part of Nitro or in a removed purchasable pack */
|
|
32
|
+
STANDARD = 1,
|
|
33
|
+
/** a sticker uploaded to a Boosted guild for the guild's members */
|
|
34
|
+
GUILD = 2
|
|
35
|
+
}
|
|
36
|
+
/** https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-format-types */
|
|
37
|
+
export declare enum StickerFormatType {
|
|
38
|
+
PNG = 1,
|
|
39
|
+
APNG = 2,
|
|
40
|
+
LOTTIE = 3
|
|
41
|
+
}
|
|
42
|
+
/** https://discord.com/developers/docs/resources/sticker#sticker-item-object-sticker-item-structure */
|
|
43
|
+
export interface StickerItem {
|
|
44
|
+
/** id of the sticker */
|
|
45
|
+
id: snowflake;
|
|
46
|
+
/** name of the sticker */
|
|
47
|
+
name: string;
|
|
48
|
+
/** type of sticker format */
|
|
49
|
+
format_type: integer;
|
|
50
|
+
}
|
|
51
|
+
/** https://discord.com/developers/docs/resources/sticker#sticker-pack-object-sticker-pack-structure */
|
|
52
|
+
export interface StickerPack {
|
|
53
|
+
/** id of the sticker pack */
|
|
54
|
+
id: snowflake;
|
|
55
|
+
/** the stickers in the pack */
|
|
56
|
+
stickers: Sticker[];
|
|
57
|
+
/** name of the sticker pack */
|
|
58
|
+
name: string;
|
|
59
|
+
/** id of the pack's SKU */
|
|
60
|
+
sku_id: snowflake;
|
|
61
|
+
/** id of a sticker in the pack which is shown as the pack's icon */
|
|
62
|
+
cover_sticker_id?: snowflake;
|
|
63
|
+
/** description of the sticker pack */
|
|
64
|
+
description: string;
|
|
65
|
+
/** id of the sticker pack's banner image */
|
|
66
|
+
banner_asset_id: snowflake;
|
|
67
|
+
}
|
|
68
|
+
/** https://discord.com/developers/docs/topics/gateway#guild-stickers-update-guild-stickers-update-event-fields */
|
|
69
|
+
export interface GuildStickersUpdateEvent {
|
|
70
|
+
/** id of the guild */
|
|
71
|
+
guild_id: snowflake;
|
|
72
|
+
/** array of stickers */
|
|
73
|
+
stickers: Sticker[];
|
|
74
|
+
}
|
|
75
|
+
declare module './gateway' {
|
|
76
|
+
interface GatewayEvents {
|
|
77
|
+
/** guild stickers were updated */
|
|
78
|
+
GUILD_STICKERS_UPDATE: GuildStickersUpdateEvent;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { snowflake, User } from '.';
|
|
2
|
+
/** https://discord.com/developers/docs/topics/teams#data-models-team-object */
|
|
3
|
+
export interface Team {
|
|
4
|
+
/** a hash of the image of the team's icon */
|
|
5
|
+
icon?: string;
|
|
6
|
+
/** the unique id of the team */
|
|
7
|
+
id: snowflake;
|
|
8
|
+
/** the members of the team */
|
|
9
|
+
members: TeamMember[];
|
|
10
|
+
/** the name of the team */
|
|
11
|
+
name: string;
|
|
12
|
+
/** the user id of the current team owner */
|
|
13
|
+
owner_user_id: snowflake;
|
|
14
|
+
}
|
|
15
|
+
/** https://discord.com/developers/docs/topics/teams#data-models-team-member-object */
|
|
16
|
+
export interface TeamMember {
|
|
17
|
+
/** the user's membership state on the team */
|
|
18
|
+
membership_state: MembershipState;
|
|
19
|
+
/** will always be ["*"] */
|
|
20
|
+
permissions: string[];
|
|
21
|
+
/** the id of the parent team of which they are a member */
|
|
22
|
+
team_id: snowflake;
|
|
23
|
+
/** the avatar, discriminator, id, and username of the user */
|
|
24
|
+
user: Partial<User>;
|
|
25
|
+
}
|
|
26
|
+
/** https://discord.com/developers/docs/topics/teams#data-models-membership-state-enum */
|
|
27
|
+
export declare enum MembershipState {
|
|
28
|
+
INVITED = 1,
|
|
29
|
+
ACCEPTED = 2
|
|
30
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { integer, Integration, snowflake } from '.';
|
|
2
|
+
/** https://discord.com/developers/docs/resources/user#user-object-user-structure */
|
|
3
|
+
export interface User {
|
|
4
|
+
/** the user's id */
|
|
5
|
+
id: snowflake;
|
|
6
|
+
/** the user's username, not unique across the platform */
|
|
7
|
+
username: string;
|
|
8
|
+
/** the user's 4-digit discord-tag */
|
|
9
|
+
discriminator: string;
|
|
10
|
+
/** the user's avatar hash */
|
|
11
|
+
avatar?: string;
|
|
12
|
+
/** whether the user belongs to an OAuth2 application */
|
|
13
|
+
bot?: boolean;
|
|
14
|
+
/** whether the user is an Official Discord System user (part of the urgent message system) */
|
|
15
|
+
system?: boolean;
|
|
16
|
+
/** whether the user has two factor enabled on their account */
|
|
17
|
+
mfa_enabled?: boolean;
|
|
18
|
+
/** the user's banner hash */
|
|
19
|
+
banner?: string;
|
|
20
|
+
/** the user's banner color encoded as an integer representation of hexadecimal color code */
|
|
21
|
+
accent_color?: integer;
|
|
22
|
+
/** the user's chosen language option */
|
|
23
|
+
locale?: string;
|
|
24
|
+
/** whether the email on this account has been verified */
|
|
25
|
+
verified?: boolean;
|
|
26
|
+
/** the user's email */
|
|
27
|
+
email?: string;
|
|
28
|
+
/** the flags on a user's account */
|
|
29
|
+
flags?: integer;
|
|
30
|
+
/** the type of Nitro subscription on a user's account */
|
|
31
|
+
premium_type?: integer;
|
|
32
|
+
/** the public flags on a user's account */
|
|
33
|
+
public_flags?: integer;
|
|
34
|
+
}
|
|
35
|
+
/** https://discord.com/developers/docs/resources/user#user-object-user-flags */
|
|
36
|
+
export declare enum UserFlag {
|
|
37
|
+
NONE = 0,
|
|
38
|
+
DISCORD_EMPLOYEE = 1,
|
|
39
|
+
PARTNERED_SERVER_OWNER = 2,
|
|
40
|
+
HYPESQUAD_EVENTS = 4,
|
|
41
|
+
BUG_HUNTER_LEVEL_1 = 8,
|
|
42
|
+
HOUSE_BRAVERY = 64,
|
|
43
|
+
HOUSE_BRILLIANCE = 128,
|
|
44
|
+
HOUSE_BALANCE = 256,
|
|
45
|
+
EARLY_SUPPORTER = 512,
|
|
46
|
+
TEAM_USER = 1024,
|
|
47
|
+
BUG_HUNTER_LEVEL_2 = 16384,
|
|
48
|
+
VERIFIED_BOT = 65536,
|
|
49
|
+
EARLY_VERIFIED_BOT_DEVELOPER = 131072,
|
|
50
|
+
DISCORD_CERTIFIED_MODERATOR = 262144
|
|
51
|
+
}
|
|
52
|
+
/** https://discord.com/developers/docs/resources/user#connection-object-connection-structure */
|
|
53
|
+
export interface Connection {
|
|
54
|
+
/** id of the connection account */
|
|
55
|
+
id: string;
|
|
56
|
+
/** the username of the connection account */
|
|
57
|
+
name: string;
|
|
58
|
+
/** the service of the connection (twitch, youtube) */
|
|
59
|
+
type: string;
|
|
60
|
+
/** whether the connection is revoked */
|
|
61
|
+
revoked?: boolean;
|
|
62
|
+
/** an array of partial server integrations */
|
|
63
|
+
integrations?: Partial<Integration>[];
|
|
64
|
+
/** whether the connection is verified */
|
|
65
|
+
verified: boolean;
|
|
66
|
+
/** whether friend sync is enabled for this connection */
|
|
67
|
+
friend_sync: boolean;
|
|
68
|
+
/** whether activities related to this connection will be shown in presence updates */
|
|
69
|
+
show_activity: boolean;
|
|
70
|
+
/** visibility of this connection */
|
|
71
|
+
visibility: integer;
|
|
72
|
+
}
|
|
73
|
+
/** https://discord.com/developers/docs/resources/user#connection-object-visibility-types */
|
|
74
|
+
export declare enum VisibilityType {
|
|
75
|
+
/** invisible to everyone except the user themselves */
|
|
76
|
+
NONE = 0,
|
|
77
|
+
/** visible to everyone */
|
|
78
|
+
EVERYONE = 1
|
|
79
|
+
}
|
|
80
|
+
export interface UserUpdateEvent extends User {
|
|
81
|
+
}
|
|
82
|
+
declare module './gateway' {
|
|
83
|
+
interface GatewayEvents {
|
|
84
|
+
/** properties about the user changed */
|
|
85
|
+
USER_UPDATE: UserUpdateEvent;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
export interface ModifyUserOptions {
|
|
89
|
+
/** user's username, if changed may cause the user's discriminator to be randomized. */
|
|
90
|
+
username?: string;
|
|
91
|
+
/** if passed, modifies the user's avatar */
|
|
92
|
+
avatar?: string;
|
|
93
|
+
}
|
|
94
|
+
declare module './internal' {
|
|
95
|
+
interface Internal {
|
|
96
|
+
/** https://discord.com/developers/docs/resources/user#get-current-user */
|
|
97
|
+
getCurrentUser(): Promise<User>;
|
|
98
|
+
/** https://discord.com/developers/docs/resources/user#get-user */
|
|
99
|
+
getUser(id: snowflake): Promise<User>;
|
|
100
|
+
/** https://discord.com/developers/docs/resources/user#modify-current-user */
|
|
101
|
+
modifyCurrentUser(options: ModifyUserOptions): Promise<User>;
|
|
102
|
+
/** https://discord.com/developers/docs/resources/user#get-user-connections */
|
|
103
|
+
getUserConnections(): Promise<Connection[]>;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { GuildMember, snowflake, timestamp } from '.';
|
|
2
|
+
/** https://discord.com/developers/docs/resources/voice#voice-state-object-voice-state-structure */
|
|
3
|
+
export interface VoiceState {
|
|
4
|
+
/** the guild id this voice state is for */
|
|
5
|
+
guild_id?: snowflake;
|
|
6
|
+
/** the channel id this user is connected to */
|
|
7
|
+
channel_id?: snowflake;
|
|
8
|
+
/** the user id this voice state is for */
|
|
9
|
+
user_id: snowflake;
|
|
10
|
+
/** the guild member this voice state is for */
|
|
11
|
+
member?: GuildMember;
|
|
12
|
+
/** the session id for this voice state */
|
|
13
|
+
session_id: string;
|
|
14
|
+
/** whether this user is deafened by the server */
|
|
15
|
+
deaf: boolean;
|
|
16
|
+
/** whether this user is muted by the server */
|
|
17
|
+
mute: boolean;
|
|
18
|
+
/** whether this user is locally deafened */
|
|
19
|
+
self_deaf: boolean;
|
|
20
|
+
/** whether this user is locally muted */
|
|
21
|
+
self_mute: boolean;
|
|
22
|
+
/** whether this user is streaming using "Go Live" */
|
|
23
|
+
self_stream?: boolean;
|
|
24
|
+
/** whether this user's camera is enabled */
|
|
25
|
+
self_video: boolean;
|
|
26
|
+
/** whether this user is muted by the current user */
|
|
27
|
+
suppress: boolean;
|
|
28
|
+
/** the time at which the user requested to speak */
|
|
29
|
+
request_to_speak_timestamp?: timestamp;
|
|
30
|
+
}
|
|
31
|
+
/** https://discord.com/developers/docs/resources/voice#voice-region-object-voice-region-structure */
|
|
32
|
+
export interface VoiceRegion {
|
|
33
|
+
/** unique ID for the region */
|
|
34
|
+
id: string;
|
|
35
|
+
/** name of the region */
|
|
36
|
+
name: string;
|
|
37
|
+
/** true for a single server that is closest to the current user's client */
|
|
38
|
+
optimal: boolean;
|
|
39
|
+
/** whether this is a deprecated voice region (avoid switching to these) */
|
|
40
|
+
deprecated: boolean;
|
|
41
|
+
/** whether this is a custom voice region (used for events/etc) */
|
|
42
|
+
custom: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface VoiceStateUpdateEvent extends VoiceState {
|
|
45
|
+
}
|
|
46
|
+
/** https://discord.com/developers/docs/topics/gateway#voice-server-update-voice-server-update-event-fields */
|
|
47
|
+
export interface VoiceServerUpdateEvent {
|
|
48
|
+
/** voice connection token */
|
|
49
|
+
token: string;
|
|
50
|
+
/** the guild this voice server update is for */
|
|
51
|
+
guild_id: snowflake;
|
|
52
|
+
/** the voice server host */
|
|
53
|
+
endpoint?: string;
|
|
54
|
+
}
|
|
55
|
+
declare module './gateway' {
|
|
56
|
+
interface GatewayEvents {
|
|
57
|
+
/** someone joined, left, or moved a voice channel */
|
|
58
|
+
VOICE_STATE_UPDATE: VoiceStateUpdateEvent;
|
|
59
|
+
/** guild's voice server was updated */
|
|
60
|
+
VOICE_SERVER_UPDATE: VoiceServerUpdateEvent;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
declare module './internal' {
|
|
64
|
+
interface Internal {
|
|
65
|
+
/** https://discord.com/developers/docs/resources/voice#list-voice-regions */
|
|
66
|
+
listVoiceRegions(): Promise<VoiceRegion[]>;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Channel, Guild, integer, Message, snowflake, User } from '.';
|
|
2
|
+
/** https://discord.com/developers/docs/resources/webhook#webhook-object-webhook-structure */
|
|
3
|
+
export interface Webhook {
|
|
4
|
+
/** the id of the webhook */
|
|
5
|
+
id: snowflake;
|
|
6
|
+
/** the type of the webhook */
|
|
7
|
+
type: integer;
|
|
8
|
+
/** the guild id this webhook is for, if any */
|
|
9
|
+
guild_id?: snowflake;
|
|
10
|
+
/** the channel id this webhook is for, if any */
|
|
11
|
+
channel_id?: snowflake;
|
|
12
|
+
/** the user this webhook was created by (not returned when getting a webhook with its token) */
|
|
13
|
+
user?: User;
|
|
14
|
+
/** the default name of the webhook */
|
|
15
|
+
name?: string;
|
|
16
|
+
/** the default user avatar hash of the webhook */
|
|
17
|
+
avatar?: string;
|
|
18
|
+
/** the secure token of the webhook (returned for Incoming Webhooks) */
|
|
19
|
+
token?: string;
|
|
20
|
+
/** the bot/OAuth2 application that created this webhook */
|
|
21
|
+
application_id?: snowflake;
|
|
22
|
+
/** the guild of the channel that this webhook is following (returned for Channel Follower Webhooks) */
|
|
23
|
+
source_guild?: Partial<Guild>;
|
|
24
|
+
/** the channel that this webhook is following (returned for Channel Follower Webhooks) */
|
|
25
|
+
source_channel?: Partial<Channel>;
|
|
26
|
+
/** the url used for executing the webhook (returned by the webhooks OAuth2 flow) */
|
|
27
|
+
url?: string;
|
|
28
|
+
}
|
|
29
|
+
/** https://discord.com/developers/docs/resources/webhook#webhook-object-webhook-types */
|
|
30
|
+
export declare enum WebhookType {
|
|
31
|
+
/** Incoming Webhooks can post messages to channels with a generated token */
|
|
32
|
+
INCOMING = 1,
|
|
33
|
+
/** Channel Follower Webhooks are internal webhooks used with Channel Following to post new messages into channels */
|
|
34
|
+
CHANNEL_FOLLOWER = 2,
|
|
35
|
+
/** Application webhooks are webhooks used with Interactions */
|
|
36
|
+
APPLICATION = 3
|
|
37
|
+
}
|
|
38
|
+
/** https://discord.com/developers/docs/topics/gateway#webhooks-update-webhook-update-event-fields */
|
|
39
|
+
export interface WebhooksUpdateEvent {
|
|
40
|
+
/** id of the guild */
|
|
41
|
+
guild_id: snowflake;
|
|
42
|
+
/** id of the channel */
|
|
43
|
+
channel_id: snowflake;
|
|
44
|
+
}
|
|
45
|
+
declare module './gateway' {
|
|
46
|
+
interface GatewayEvents {
|
|
47
|
+
/** guild channel webhook was created, update, or deleted */
|
|
48
|
+
WEBHOOKS_UPDATE: WebhooksUpdateEvent;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export interface ModifyWebhookParams {
|
|
52
|
+
/** the default name of the webhook */
|
|
53
|
+
name?: string;
|
|
54
|
+
/** data image for the default webhook avatar */
|
|
55
|
+
avatar?: string;
|
|
56
|
+
/** the new channel id this webhook should be moved to */
|
|
57
|
+
channel_id?: snowflake;
|
|
58
|
+
}
|
|
59
|
+
declare module './internal' {
|
|
60
|
+
interface Internal {
|
|
61
|
+
/** https://discord.com/developers/docs/resources/webhook#get-channel-webhooks */
|
|
62
|
+
getChannelWebhooks(channel_id: snowflake): Promise<Webhook[]>;
|
|
63
|
+
/** https://discord.com/developers/docs/resources/webhook#get-guild-webhooks */
|
|
64
|
+
getGuildWebhooks(guild_id: snowflake): Promise<Webhook[]>;
|
|
65
|
+
/** https://discord.com/developers/docs/resources/webhook#get-webhook */
|
|
66
|
+
getWebhook(webhook_id: snowflake): Promise<Webhook>;
|
|
67
|
+
/** https://discord.com/developers/docs/resources/webhook#get-webhook-with-token */
|
|
68
|
+
getWebhookWithToken(webhook_id: snowflake, token: string): Promise<Webhook>;
|
|
69
|
+
/** https://discord.com/developers/docs/resources/webhook#modify-webhook */
|
|
70
|
+
modifyWebhook(webhook_id: snowflake, options: ModifyWebhookParams): Promise<Webhook>;
|
|
71
|
+
/** https://discord.com/developers/docs/resources/webhook#modify-webhook-with-token */
|
|
72
|
+
modifyWebhookWithToken(webhook_id: snowflake, token: string, options: ModifyWebhookParams): Promise<Webhook>;
|
|
73
|
+
/** https://discord.com/developers/docs/resources/webhook#delete-webhook */
|
|
74
|
+
deleteWebhook(webhook_id: snowflake): Promise<void>;
|
|
75
|
+
/** https://discord.com/developers/docs/resources/webhook#delete-webhook-with-token */
|
|
76
|
+
deleteWebhookWithToken(webhook_id: snowflake, token: string): Promise<void>;
|
|
77
|
+
/** https://discord.com/developers/docs/resources/webhook#execute-webhook */
|
|
78
|
+
/** https://discord.com/developers/docs/resources/webhook#execute-slackcompatible-webhook */
|
|
79
|
+
/** https://discord.com/developers/docs/resources/webhook#execute-githubcompatible-webhook */
|
|
80
|
+
/** https://discord.com/developers/docs/resources/webhook#get-webhook-message */
|
|
81
|
+
getWebhookMessage(webhook_id: snowflake, token: string, message_id: snowflake): Promise<Message>;
|
|
82
|
+
/** https://discord.com/developers/docs/resources/webhook#edit-webhook-message */
|
|
83
|
+
/** https://discord.com/developers/docs/resources/webhook#delete-webhook-message */
|
|
84
|
+
deleteWebhookMessage(webhook_id: snowflake, token: string, message_id: snowflake): Promise<void>;
|
|
85
|
+
}
|
|
86
|
+
}
|
package/lib/utils.d.ts
CHANGED
|
@@ -5,9 +5,9 @@ import * as DC from './types';
|
|
|
5
5
|
export interface AdapterConfig extends Adapter.WebSocketClient.Config, App.Config.Request {
|
|
6
6
|
}
|
|
7
7
|
export declare const AdapterConfig: Schema<AdapterConfig>;
|
|
8
|
-
export declare const adaptUser: (user: DC.
|
|
9
|
-
export declare function adaptGroup(data: DC.
|
|
8
|
+
export declare const adaptUser: (user: DC.User) => Bot.User;
|
|
9
|
+
export declare function adaptGroup(data: DC.Guild): Bot.Guild;
|
|
10
10
|
export declare function adaptChannel(data: DC.Channel): Bot.Channel;
|
|
11
11
|
export declare const adaptAuthor: (author: DC.User) => Bot.Author;
|
|
12
12
|
export declare function adaptMessage(bot: DiscordBot, meta: DC.Message, session?: Partial<Session>): Bot.Message;
|
|
13
|
-
export declare function adaptSession(bot: DiscordBot, input: DC.
|
|
13
|
+
export declare function adaptSession(bot: DiscordBot, input: DC.GatewayPayload): Promise<Session<never, never, keyof Session.Events, keyof Session.MessageType | "role" | "ban" | "nickname" | keyof Session.GroupMemberChangeType | "poke" | "lucky-king" | "honor" | "one" | "all" | "emoji">>;
|
package/lib/ws.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/// <reference path="index.d.ts" />
|
|
2
2
|
/// <reference types="koishi/lib" />
|
|
3
|
-
import { Adapter,
|
|
3
|
+
import { Adapter, Context } from 'koishi';
|
|
4
4
|
import { AdapterConfig } from './utils';
|
|
5
5
|
import { BotConfig, DiscordBot } from './bot';
|
|
6
6
|
import WebSocket from 'ws';
|
|
7
|
-
/** https://discord.com/developers/docs/topics/gateway */
|
|
8
7
|
export default class WebSocketClient extends Adapter.WebSocketClient<BotConfig, AdapterConfig> {
|
|
9
|
-
static schema: import("
|
|
10
|
-
constructor(
|
|
8
|
+
static schema: import("schemastery").Schema<unknown, any>;
|
|
9
|
+
constructor(ctx: Context, config: AdapterConfig);
|
|
11
10
|
prepare(): WebSocket;
|
|
12
11
|
heartbeat(bot: DiscordBot): void;
|
|
13
12
|
accept(bot: DiscordBot): void;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koishijs/plugin-adapter-discord",
|
|
3
3
|
"description": "Discord adapter for Koishi",
|
|
4
|
-
"version": "2.0.0-
|
|
4
|
+
"version": "2.0.0-beta.3",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
],
|
|
10
10
|
"author": "LittleC <i@ltlec.cn>",
|
|
11
11
|
"maintainers": [
|
|
12
|
-
"Shigma <
|
|
12
|
+
"Shigma <shigma10826@gmail.com>",
|
|
13
13
|
"LittleC <i@ltlec.cn>"
|
|
14
14
|
],
|
|
15
15
|
"license": "MIT",
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"koishi"
|
|
29
29
|
],
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"koishi": "^4.0.0-
|
|
31
|
+
"koishi": "^4.0.0-beta.3"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/es-aggregate-error": "^1.0.2",
|
|
35
35
|
"@types/ws": "^7.4.7",
|
|
36
|
-
"@koishijs/test-utils": "^8.0.0-
|
|
36
|
+
"@koishijs/test-utils": "^8.0.0-beta.3"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"es-aggregate-error": "^1.0.5",
|