shardwire 1.0.0 → 1.1.0
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/README.md +86 -51
- package/dist/index.d.mts +42 -2
- package/dist/index.d.ts +42 -2
- package/dist/index.js +182 -55
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +184 -55
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
# Shardwire
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/shardwire)
|
|
4
|
+
[](https://www.npmjs.com/package/shardwire)
|
|
5
|
+
[](https://nodejs.org/)
|
|
6
|
+
[](./LICENSE)
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
Discord-first bridge for streaming bot events to external apps and executing bot actions over one WebSocket connection.
|
|
6
9
|
|
|
7
|
-
|
|
8
|
-
- replying to interactions
|
|
9
|
-
- sending and editing messages
|
|
10
|
-
- moderation actions like ban, kick, and role changes
|
|
10
|
+
Shardwire is built for a common architecture: your Discord bot runs in one process, while your web app, backend API, worker, or dashboard runs in another.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
## Why Shardwire
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
- **Discord-first API**: no generic command bus wiring required.
|
|
15
|
+
- **App-friendly payloads**: receive normalized JSON payloads instead of live `discord.js` objects.
|
|
16
|
+
- **Built-in actions**: send messages, reply to interactions, moderate members, and more from your app process.
|
|
17
|
+
- **Scoped permissions**: restrict each app secret to specific events and actions.
|
|
18
|
+
- **Capability-aware runtime**: apps can inspect what they are allowed to subscribe to and invoke.
|
|
15
19
|
|
|
16
|
-
##
|
|
20
|
+
## Requirements
|
|
17
21
|
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
- **Scoped secrets**: optionally limit which apps can subscribe to which events or invoke which actions
|
|
22
|
+
- Node.js `>=18.18`
|
|
23
|
+
- A Discord bot token (`DISCORD_TOKEN`)
|
|
24
|
+
- At least one shared bridge secret (`SHARDWIRE_SECRET`)
|
|
25
|
+
- Discord gateway intents that match the events you want
|
|
23
26
|
|
|
24
27
|
## Install
|
|
25
28
|
|
|
@@ -29,14 +32,14 @@ npm install shardwire
|
|
|
29
32
|
|
|
30
33
|
## Quick Start
|
|
31
34
|
|
|
32
|
-
### 1
|
|
35
|
+
### 1) Start the bot bridge process
|
|
33
36
|
|
|
34
37
|
```ts
|
|
35
38
|
import { createBotBridge } from "shardwire";
|
|
36
39
|
|
|
37
40
|
const bridge = createBotBridge({
|
|
38
41
|
token: process.env.DISCORD_TOKEN!,
|
|
39
|
-
intents: ["Guilds", "GuildMessages", "MessageContent", "GuildMembers"],
|
|
42
|
+
intents: ["Guilds", "GuildMessages", "GuildMessageReactions", "MessageContent", "GuildMembers"],
|
|
40
43
|
server: {
|
|
41
44
|
port: 3001,
|
|
42
45
|
secrets: [process.env.SHARDWIRE_SECRET!],
|
|
@@ -44,9 +47,10 @@ const bridge = createBotBridge({
|
|
|
44
47
|
});
|
|
45
48
|
|
|
46
49
|
await bridge.ready();
|
|
50
|
+
console.log("Bot bridge listening on ws://127.0.0.1:3001/shardwire");
|
|
47
51
|
```
|
|
48
52
|
|
|
49
|
-
### 2
|
|
53
|
+
### 2) Connect from your app process
|
|
50
54
|
|
|
51
55
|
```ts
|
|
52
56
|
import { connectBotBridge } from "shardwire";
|
|
@@ -68,24 +72,12 @@ app.on("messageCreate", ({ message }) => {
|
|
|
68
72
|
await app.ready();
|
|
69
73
|
```
|
|
70
74
|
|
|
71
|
-
###
|
|
72
|
-
|
|
73
|
-
```ts
|
|
74
|
-
app.on(
|
|
75
|
-
"messageCreate",
|
|
76
|
-
({ message }) => {
|
|
77
|
-
console.log("Only channel 123:", message.content);
|
|
78
|
-
},
|
|
79
|
-
{ channelId: "123456789012345678" },
|
|
80
|
-
);
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
### 3. Call built-in bot actions
|
|
75
|
+
### 3) Call bot actions from your app
|
|
84
76
|
|
|
85
77
|
```ts
|
|
86
78
|
const result = await app.actions.sendMessage({
|
|
87
79
|
channelId: "123456789012345678",
|
|
88
|
-
content: "Hello from
|
|
80
|
+
content: "Hello from app side",
|
|
89
81
|
});
|
|
90
82
|
|
|
91
83
|
if (!result.ok) {
|
|
@@ -93,30 +85,49 @@ if (!result.ok) {
|
|
|
93
85
|
}
|
|
94
86
|
```
|
|
95
87
|
|
|
88
|
+
### 4) Filter subscriptions when needed
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
app.on(
|
|
92
|
+
"messageCreate",
|
|
93
|
+
({ message }) => {
|
|
94
|
+
console.log("Only this channel:", message.content);
|
|
95
|
+
},
|
|
96
|
+
{ channelId: "123456789012345678" },
|
|
97
|
+
);
|
|
98
|
+
```
|
|
99
|
+
|
|
96
100
|
## Built-In Events
|
|
97
101
|
|
|
98
|
-
|
|
102
|
+
Apps subscribe to events with `app.on(...)`. The bridge forwards only what each app subscribes to.
|
|
99
103
|
|
|
100
104
|
- `ready`
|
|
101
105
|
- `interactionCreate`
|
|
102
106
|
- `messageCreate`
|
|
103
107
|
- `messageUpdate`
|
|
104
108
|
- `messageDelete`
|
|
109
|
+
- `messageReactionAdd`
|
|
110
|
+
- `messageReactionRemove`
|
|
105
111
|
- `guildMemberAdd`
|
|
106
112
|
- `guildMemberRemove`
|
|
107
113
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
Optional filters can narrow delivery by:
|
|
114
|
+
Supported filters:
|
|
111
115
|
|
|
112
116
|
- `guildId`
|
|
113
117
|
- `channelId`
|
|
114
118
|
- `userId`
|
|
115
|
-
- `commandName` for `interactionCreate`
|
|
119
|
+
- `commandName` (for `interactionCreate`)
|
|
120
|
+
|
|
121
|
+
### Intent Notes
|
|
122
|
+
|
|
123
|
+
- `ready` and `interactionCreate`: no specific event intent requirement
|
|
124
|
+
- `messageCreate`, `messageUpdate`, `messageDelete`: `GuildMessages`
|
|
125
|
+
- `messageReactionAdd`, `messageReactionRemove`: `GuildMessageReactions`
|
|
126
|
+
- `guildMemberAdd`, `guildMemberRemove`: `GuildMembers`
|
|
116
127
|
|
|
117
128
|
## Built-In Actions
|
|
118
129
|
|
|
119
|
-
`app.actions.*`
|
|
130
|
+
`app.actions.*` includes:
|
|
120
131
|
|
|
121
132
|
- `sendMessage`
|
|
122
133
|
- `editMessage`
|
|
@@ -128,8 +139,10 @@ Optional filters can narrow delivery by:
|
|
|
128
139
|
- `kickMember`
|
|
129
140
|
- `addMemberRole`
|
|
130
141
|
- `removeMemberRole`
|
|
142
|
+
- `addMessageReaction`
|
|
143
|
+
- `removeOwnMessageReaction`
|
|
131
144
|
|
|
132
|
-
|
|
145
|
+
All actions return:
|
|
133
146
|
|
|
134
147
|
```ts
|
|
135
148
|
type ActionResult<T> =
|
|
@@ -139,7 +152,7 @@ type ActionResult<T> =
|
|
|
139
152
|
|
|
140
153
|
## Secret Scopes
|
|
141
154
|
|
|
142
|
-
Use a plain string secret for full access:
|
|
155
|
+
Use a plain string secret for full event/action access:
|
|
143
156
|
|
|
144
157
|
```ts
|
|
145
158
|
server: {
|
|
@@ -148,7 +161,7 @@ server: {
|
|
|
148
161
|
}
|
|
149
162
|
```
|
|
150
163
|
|
|
151
|
-
|
|
164
|
+
Use a scoped secret to limit what an app can do:
|
|
152
165
|
|
|
153
166
|
```ts
|
|
154
167
|
server: {
|
|
@@ -166,35 +179,57 @@ server: {
|
|
|
166
179
|
}
|
|
167
180
|
```
|
|
168
181
|
|
|
169
|
-
|
|
182
|
+
Inspect negotiated capabilities in the app:
|
|
170
183
|
|
|
171
184
|
```ts
|
|
172
185
|
const capabilities = app.capabilities();
|
|
173
186
|
console.log(capabilities.events, capabilities.actions);
|
|
174
187
|
```
|
|
175
188
|
|
|
189
|
+
## Run the Included Examples
|
|
190
|
+
|
|
191
|
+
In two terminals:
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
# terminal 1
|
|
195
|
+
DISCORD_TOKEN=your-token SHARDWIRE_SECRET=dev-secret npm run example:bot
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
# terminal 2
|
|
200
|
+
SHARDWIRE_SECRET=dev-secret npm run example:app
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Examples:
|
|
204
|
+
|
|
205
|
+
- Bot bridge: `examples/bot-basic.ts`
|
|
206
|
+
- App client: `examples/app-basic.ts`
|
|
207
|
+
|
|
176
208
|
## Public API
|
|
177
209
|
|
|
178
210
|
```ts
|
|
179
211
|
import { createBotBridge, connectBotBridge } from "shardwire";
|
|
180
212
|
```
|
|
181
213
|
|
|
182
|
-
Main exports:
|
|
214
|
+
Main exports include:
|
|
183
215
|
|
|
184
216
|
- `createBotBridge(options)`
|
|
185
217
|
- `connectBotBridge(options)`
|
|
186
218
|
- `BridgeCapabilityError`
|
|
187
219
|
- bot/app option types
|
|
188
|
-
- normalized event payload types
|
|
189
|
-
- action payload
|
|
220
|
+
- normalized event payload types (for example `BridgeMessage`, `BridgeInteraction`, `BridgeGuildMember`)
|
|
221
|
+
- action payload and result types
|
|
222
|
+
|
|
223
|
+
## Security and Transport Notes
|
|
224
|
+
|
|
225
|
+
- Use `wss://` for non-loopback deployments.
|
|
226
|
+
- `ws://` is only accepted for loopback hosts (`127.0.0.1`, `localhost`, `::1`).
|
|
227
|
+
- Event availability depends on enabled intents and secret scope.
|
|
190
228
|
|
|
191
|
-
##
|
|
229
|
+
## Contributing
|
|
192
230
|
|
|
193
|
-
|
|
194
|
-
- `discord.js` is used internally by the default runtime, but apps interact with Shardwire through Shardwire's own JSON payloads
|
|
195
|
-
- Event availability depends on the intents you enable for the bot bridge
|
|
231
|
+
Issues and pull requests are welcome: [github.com/unloopedmido/shardwire](https://github.com/unloopedmido/shardwire).
|
|
196
232
|
|
|
197
|
-
##
|
|
233
|
+
## License
|
|
198
234
|
|
|
199
|
-
-
|
|
200
|
-
- App: [examples/app-basic.ts](./examples/app-basic.ts)
|
|
235
|
+
MIT - see [`LICENSE`](./LICENSE).
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Snowflake, APIEmbed, APIAllowedMentions } from 'discord-api-types/v10';
|
|
2
|
+
import { GatewayIntentBits } from 'discord.js';
|
|
2
3
|
|
|
3
4
|
type Unsubscribe = () => void;
|
|
4
5
|
interface ShardwireLogger {
|
|
@@ -7,7 +8,7 @@ interface ShardwireLogger {
|
|
|
7
8
|
warn?: (message: string, meta?: Record<string, unknown>) => void;
|
|
8
9
|
error?: (message: string, meta?: Record<string, unknown>) => void;
|
|
9
10
|
}
|
|
10
|
-
type BotIntentName =
|
|
11
|
+
type BotIntentName = keyof typeof GatewayIntentBits;
|
|
11
12
|
interface BridgeUser {
|
|
12
13
|
id: Snowflake;
|
|
13
14
|
username: string;
|
|
@@ -60,6 +61,18 @@ interface BridgeDeletedMessage {
|
|
|
60
61
|
guildId?: Snowflake;
|
|
61
62
|
deletedAt: string;
|
|
62
63
|
}
|
|
64
|
+
interface BridgeReactionEmoji {
|
|
65
|
+
id?: Snowflake;
|
|
66
|
+
name?: string | null;
|
|
67
|
+
animated?: boolean;
|
|
68
|
+
}
|
|
69
|
+
interface BridgeMessageReaction {
|
|
70
|
+
messageId: Snowflake;
|
|
71
|
+
channelId: Snowflake;
|
|
72
|
+
guildId?: Snowflake;
|
|
73
|
+
user?: BridgeUser;
|
|
74
|
+
emoji: BridgeReactionEmoji;
|
|
75
|
+
}
|
|
63
76
|
type BridgeInteractionKind = "chatInput" | "contextMenu" | "button" | "stringSelect" | "userSelect" | "roleSelect" | "mentionableSelect" | "channelSelect" | "modalSubmit" | "unknown";
|
|
64
77
|
interface BridgeInteraction {
|
|
65
78
|
id: Snowflake;
|
|
@@ -102,12 +115,20 @@ interface GuildMemberAddEventPayload extends EventEnvelopeBase {
|
|
|
102
115
|
interface GuildMemberRemoveEventPayload extends EventEnvelopeBase {
|
|
103
116
|
member: BridgeGuildMember;
|
|
104
117
|
}
|
|
118
|
+
interface MessageReactionAddEventPayload extends EventEnvelopeBase {
|
|
119
|
+
reaction: BridgeMessageReaction;
|
|
120
|
+
}
|
|
121
|
+
interface MessageReactionRemoveEventPayload extends EventEnvelopeBase {
|
|
122
|
+
reaction: BridgeMessageReaction;
|
|
123
|
+
}
|
|
105
124
|
interface BotEventPayloadMap {
|
|
106
125
|
ready: ReadyEventPayload;
|
|
107
126
|
interactionCreate: InteractionCreateEventPayload;
|
|
108
127
|
messageCreate: MessageCreateEventPayload;
|
|
109
128
|
messageUpdate: MessageUpdateEventPayload;
|
|
110
129
|
messageDelete: MessageDeleteEventPayload;
|
|
130
|
+
messageReactionAdd: MessageReactionAddEventPayload;
|
|
131
|
+
messageReactionRemove: MessageReactionRemoveEventPayload;
|
|
111
132
|
guildMemberAdd: GuildMemberAddEventPayload;
|
|
112
133
|
guildMemberRemove: GuildMemberRemoveEventPayload;
|
|
113
134
|
}
|
|
@@ -163,6 +184,16 @@ interface RemoveMemberRoleActionPayload {
|
|
|
163
184
|
roleId: Snowflake;
|
|
164
185
|
reason?: string;
|
|
165
186
|
}
|
|
187
|
+
interface AddMessageReactionActionPayload {
|
|
188
|
+
channelId: Snowflake;
|
|
189
|
+
messageId: Snowflake;
|
|
190
|
+
emoji: string;
|
|
191
|
+
}
|
|
192
|
+
interface RemoveOwnMessageReactionActionPayload {
|
|
193
|
+
channelId: Snowflake;
|
|
194
|
+
messageId: Snowflake;
|
|
195
|
+
emoji: string;
|
|
196
|
+
}
|
|
166
197
|
interface BotActionPayloadMap {
|
|
167
198
|
sendMessage: SendMessageActionPayload;
|
|
168
199
|
editMessage: EditMessageActionPayload;
|
|
@@ -174,6 +205,8 @@ interface BotActionPayloadMap {
|
|
|
174
205
|
kickMember: KickMemberActionPayload;
|
|
175
206
|
addMemberRole: AddMemberRoleActionPayload;
|
|
176
207
|
removeMemberRole: RemoveMemberRoleActionPayload;
|
|
208
|
+
addMessageReaction: AddMessageReactionActionPayload;
|
|
209
|
+
removeOwnMessageReaction: RemoveOwnMessageReactionActionPayload;
|
|
177
210
|
}
|
|
178
211
|
interface DeleteMessageActionResult {
|
|
179
212
|
deleted: true;
|
|
@@ -188,6 +221,11 @@ interface MemberModerationActionResult {
|
|
|
188
221
|
guildId: Snowflake;
|
|
189
222
|
userId: Snowflake;
|
|
190
223
|
}
|
|
224
|
+
interface MessageReactionActionResult {
|
|
225
|
+
messageId: Snowflake;
|
|
226
|
+
channelId: Snowflake;
|
|
227
|
+
emoji: string;
|
|
228
|
+
}
|
|
191
229
|
interface BotActionResultDataMap {
|
|
192
230
|
sendMessage: BridgeMessage;
|
|
193
231
|
editMessage: BridgeMessage;
|
|
@@ -199,6 +237,8 @@ interface BotActionResultDataMap {
|
|
|
199
237
|
kickMember: MemberModerationActionResult;
|
|
200
238
|
addMemberRole: BridgeGuildMember;
|
|
201
239
|
removeMemberRole: BridgeGuildMember;
|
|
240
|
+
addMessageReaction: MessageReactionActionResult;
|
|
241
|
+
removeOwnMessageReaction: MessageReactionActionResult;
|
|
202
242
|
}
|
|
203
243
|
type BotActionName = keyof BotActionPayloadMap;
|
|
204
244
|
interface BridgeCapabilities {
|
|
@@ -305,4 +345,4 @@ declare function createBotBridge(options: BotBridgeOptions): BotBridge;
|
|
|
305
345
|
|
|
306
346
|
declare function connectBotBridge(options: AppBridgeOptions): AppBridge;
|
|
307
347
|
|
|
308
|
-
export { type ActionError, type ActionFailure, type ActionResult, type ActionSuccess, type AddMemberRoleActionPayload, type AppBridge, type AppBridgeActions, type AppBridgeOptions, type BanMemberActionPayload, type BotActionName, type BotActionPayloadMap, type BotActionResultDataMap, type BotBridge, type BotBridgeOptions, type BotBridgeSecret, type BotEventName, type BotEventPayloadMap, type BotIntentName, type BridgeAttachment, type BridgeCapabilities, BridgeCapabilityError, type BridgeDeletedMessage, type BridgeGuildMember, type BridgeInteraction, type BridgeInteractionKind, type BridgeMessage, type BridgeMessageInput, type BridgeMessageReference, type BridgeUser, type DeferInteractionActionPayload, type DeleteMessageActionPayload, type EditMessageActionPayload, type EventEnvelopeBase, type EventHandler, type EventSubscription, type EventSubscriptionFilter, type FollowUpInteractionActionPayload, type GuildMemberAddEventPayload, type GuildMemberRemoveEventPayload, type InteractionCreateEventPayload, type KickMemberActionPayload, type MessageCreateEventPayload, type MessageDeleteEventPayload, type MessageUpdateEventPayload, type ReadyEventPayload, type RemoveMemberRoleActionPayload, type ReplyToInteractionActionPayload, type ScopedSecretConfig, type SecretPermissions, type SendMessageActionPayload, type ShardwireLogger, type Unsubscribe, connectBotBridge, createBotBridge };
|
|
348
|
+
export { type ActionError, type ActionFailure, type ActionResult, type ActionSuccess, type AddMemberRoleActionPayload, type AddMessageReactionActionPayload, type AppBridge, type AppBridgeActions, type AppBridgeOptions, type BanMemberActionPayload, type BotActionName, type BotActionPayloadMap, type BotActionResultDataMap, type BotBridge, type BotBridgeOptions, type BotBridgeSecret, type BotEventName, type BotEventPayloadMap, type BotIntentName, type BridgeAttachment, type BridgeCapabilities, BridgeCapabilityError, type BridgeDeletedMessage, type BridgeGuildMember, type BridgeInteraction, type BridgeInteractionKind, type BridgeMessage, type BridgeMessageInput, type BridgeMessageReaction, type BridgeMessageReference, type BridgeReactionEmoji, type BridgeUser, type DeferInteractionActionPayload, type DeleteMessageActionPayload, type EditMessageActionPayload, type EventEnvelopeBase, type EventHandler, type EventSubscription, type EventSubscriptionFilter, type FollowUpInteractionActionPayload, type GuildMemberAddEventPayload, type GuildMemberRemoveEventPayload, type InteractionCreateEventPayload, type KickMemberActionPayload, type MessageCreateEventPayload, type MessageDeleteEventPayload, type MessageReactionActionResult, type MessageReactionAddEventPayload, type MessageReactionRemoveEventPayload, type MessageUpdateEventPayload, type ReadyEventPayload, type RemoveMemberRoleActionPayload, type RemoveOwnMessageReactionActionPayload, type ReplyToInteractionActionPayload, type ScopedSecretConfig, type SecretPermissions, type SendMessageActionPayload, type ShardwireLogger, type Unsubscribe, connectBotBridge, createBotBridge };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Snowflake, APIEmbed, APIAllowedMentions } from 'discord-api-types/v10';
|
|
2
|
+
import { GatewayIntentBits } from 'discord.js';
|
|
2
3
|
|
|
3
4
|
type Unsubscribe = () => void;
|
|
4
5
|
interface ShardwireLogger {
|
|
@@ -7,7 +8,7 @@ interface ShardwireLogger {
|
|
|
7
8
|
warn?: (message: string, meta?: Record<string, unknown>) => void;
|
|
8
9
|
error?: (message: string, meta?: Record<string, unknown>) => void;
|
|
9
10
|
}
|
|
10
|
-
type BotIntentName =
|
|
11
|
+
type BotIntentName = keyof typeof GatewayIntentBits;
|
|
11
12
|
interface BridgeUser {
|
|
12
13
|
id: Snowflake;
|
|
13
14
|
username: string;
|
|
@@ -60,6 +61,18 @@ interface BridgeDeletedMessage {
|
|
|
60
61
|
guildId?: Snowflake;
|
|
61
62
|
deletedAt: string;
|
|
62
63
|
}
|
|
64
|
+
interface BridgeReactionEmoji {
|
|
65
|
+
id?: Snowflake;
|
|
66
|
+
name?: string | null;
|
|
67
|
+
animated?: boolean;
|
|
68
|
+
}
|
|
69
|
+
interface BridgeMessageReaction {
|
|
70
|
+
messageId: Snowflake;
|
|
71
|
+
channelId: Snowflake;
|
|
72
|
+
guildId?: Snowflake;
|
|
73
|
+
user?: BridgeUser;
|
|
74
|
+
emoji: BridgeReactionEmoji;
|
|
75
|
+
}
|
|
63
76
|
type BridgeInteractionKind = "chatInput" | "contextMenu" | "button" | "stringSelect" | "userSelect" | "roleSelect" | "mentionableSelect" | "channelSelect" | "modalSubmit" | "unknown";
|
|
64
77
|
interface BridgeInteraction {
|
|
65
78
|
id: Snowflake;
|
|
@@ -102,12 +115,20 @@ interface GuildMemberAddEventPayload extends EventEnvelopeBase {
|
|
|
102
115
|
interface GuildMemberRemoveEventPayload extends EventEnvelopeBase {
|
|
103
116
|
member: BridgeGuildMember;
|
|
104
117
|
}
|
|
118
|
+
interface MessageReactionAddEventPayload extends EventEnvelopeBase {
|
|
119
|
+
reaction: BridgeMessageReaction;
|
|
120
|
+
}
|
|
121
|
+
interface MessageReactionRemoveEventPayload extends EventEnvelopeBase {
|
|
122
|
+
reaction: BridgeMessageReaction;
|
|
123
|
+
}
|
|
105
124
|
interface BotEventPayloadMap {
|
|
106
125
|
ready: ReadyEventPayload;
|
|
107
126
|
interactionCreate: InteractionCreateEventPayload;
|
|
108
127
|
messageCreate: MessageCreateEventPayload;
|
|
109
128
|
messageUpdate: MessageUpdateEventPayload;
|
|
110
129
|
messageDelete: MessageDeleteEventPayload;
|
|
130
|
+
messageReactionAdd: MessageReactionAddEventPayload;
|
|
131
|
+
messageReactionRemove: MessageReactionRemoveEventPayload;
|
|
111
132
|
guildMemberAdd: GuildMemberAddEventPayload;
|
|
112
133
|
guildMemberRemove: GuildMemberRemoveEventPayload;
|
|
113
134
|
}
|
|
@@ -163,6 +184,16 @@ interface RemoveMemberRoleActionPayload {
|
|
|
163
184
|
roleId: Snowflake;
|
|
164
185
|
reason?: string;
|
|
165
186
|
}
|
|
187
|
+
interface AddMessageReactionActionPayload {
|
|
188
|
+
channelId: Snowflake;
|
|
189
|
+
messageId: Snowflake;
|
|
190
|
+
emoji: string;
|
|
191
|
+
}
|
|
192
|
+
interface RemoveOwnMessageReactionActionPayload {
|
|
193
|
+
channelId: Snowflake;
|
|
194
|
+
messageId: Snowflake;
|
|
195
|
+
emoji: string;
|
|
196
|
+
}
|
|
166
197
|
interface BotActionPayloadMap {
|
|
167
198
|
sendMessage: SendMessageActionPayload;
|
|
168
199
|
editMessage: EditMessageActionPayload;
|
|
@@ -174,6 +205,8 @@ interface BotActionPayloadMap {
|
|
|
174
205
|
kickMember: KickMemberActionPayload;
|
|
175
206
|
addMemberRole: AddMemberRoleActionPayload;
|
|
176
207
|
removeMemberRole: RemoveMemberRoleActionPayload;
|
|
208
|
+
addMessageReaction: AddMessageReactionActionPayload;
|
|
209
|
+
removeOwnMessageReaction: RemoveOwnMessageReactionActionPayload;
|
|
177
210
|
}
|
|
178
211
|
interface DeleteMessageActionResult {
|
|
179
212
|
deleted: true;
|
|
@@ -188,6 +221,11 @@ interface MemberModerationActionResult {
|
|
|
188
221
|
guildId: Snowflake;
|
|
189
222
|
userId: Snowflake;
|
|
190
223
|
}
|
|
224
|
+
interface MessageReactionActionResult {
|
|
225
|
+
messageId: Snowflake;
|
|
226
|
+
channelId: Snowflake;
|
|
227
|
+
emoji: string;
|
|
228
|
+
}
|
|
191
229
|
interface BotActionResultDataMap {
|
|
192
230
|
sendMessage: BridgeMessage;
|
|
193
231
|
editMessage: BridgeMessage;
|
|
@@ -199,6 +237,8 @@ interface BotActionResultDataMap {
|
|
|
199
237
|
kickMember: MemberModerationActionResult;
|
|
200
238
|
addMemberRole: BridgeGuildMember;
|
|
201
239
|
removeMemberRole: BridgeGuildMember;
|
|
240
|
+
addMessageReaction: MessageReactionActionResult;
|
|
241
|
+
removeOwnMessageReaction: MessageReactionActionResult;
|
|
202
242
|
}
|
|
203
243
|
type BotActionName = keyof BotActionPayloadMap;
|
|
204
244
|
interface BridgeCapabilities {
|
|
@@ -305,4 +345,4 @@ declare function createBotBridge(options: BotBridgeOptions): BotBridge;
|
|
|
305
345
|
|
|
306
346
|
declare function connectBotBridge(options: AppBridgeOptions): AppBridge;
|
|
307
347
|
|
|
308
|
-
export { type ActionError, type ActionFailure, type ActionResult, type ActionSuccess, type AddMemberRoleActionPayload, type AppBridge, type AppBridgeActions, type AppBridgeOptions, type BanMemberActionPayload, type BotActionName, type BotActionPayloadMap, type BotActionResultDataMap, type BotBridge, type BotBridgeOptions, type BotBridgeSecret, type BotEventName, type BotEventPayloadMap, type BotIntentName, type BridgeAttachment, type BridgeCapabilities, BridgeCapabilityError, type BridgeDeletedMessage, type BridgeGuildMember, type BridgeInteraction, type BridgeInteractionKind, type BridgeMessage, type BridgeMessageInput, type BridgeMessageReference, type BridgeUser, type DeferInteractionActionPayload, type DeleteMessageActionPayload, type EditMessageActionPayload, type EventEnvelopeBase, type EventHandler, type EventSubscription, type EventSubscriptionFilter, type FollowUpInteractionActionPayload, type GuildMemberAddEventPayload, type GuildMemberRemoveEventPayload, type InteractionCreateEventPayload, type KickMemberActionPayload, type MessageCreateEventPayload, type MessageDeleteEventPayload, type MessageUpdateEventPayload, type ReadyEventPayload, type RemoveMemberRoleActionPayload, type ReplyToInteractionActionPayload, type ScopedSecretConfig, type SecretPermissions, type SendMessageActionPayload, type ShardwireLogger, type Unsubscribe, connectBotBridge, createBotBridge };
|
|
348
|
+
export { type ActionError, type ActionFailure, type ActionResult, type ActionSuccess, type AddMemberRoleActionPayload, type AddMessageReactionActionPayload, type AppBridge, type AppBridgeActions, type AppBridgeOptions, type BanMemberActionPayload, type BotActionName, type BotActionPayloadMap, type BotActionResultDataMap, type BotBridge, type BotBridgeOptions, type BotBridgeSecret, type BotEventName, type BotEventPayloadMap, type BotIntentName, type BridgeAttachment, type BridgeCapabilities, BridgeCapabilityError, type BridgeDeletedMessage, type BridgeGuildMember, type BridgeInteraction, type BridgeInteractionKind, type BridgeMessage, type BridgeMessageInput, type BridgeMessageReaction, type BridgeMessageReference, type BridgeReactionEmoji, type BridgeUser, type DeferInteractionActionPayload, type DeleteMessageActionPayload, type EditMessageActionPayload, type EventEnvelopeBase, type EventHandler, type EventSubscription, type EventSubscriptionFilter, type FollowUpInteractionActionPayload, type GuildMemberAddEventPayload, type GuildMemberRemoveEventPayload, type InteractionCreateEventPayload, type KickMemberActionPayload, type MessageCreateEventPayload, type MessageDeleteEventPayload, type MessageReactionActionResult, type MessageReactionAddEventPayload, type MessageReactionRemoveEventPayload, type MessageUpdateEventPayload, type ReadyEventPayload, type RemoveMemberRoleActionPayload, type RemoveOwnMessageReactionActionPayload, type ReplyToInteractionActionPayload, type ScopedSecretConfig, type SecretPermissions, type SendMessageActionPayload, type ShardwireLogger, type Unsubscribe, connectBotBridge, createBotBridge };
|