@agentjam/sdk 0.6.0 → 0.7.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/dist/events.d.ts.map +1 -1
- package/dist/events.js +27 -0
- package/dist/events.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/managedWebhooks.d.ts +15 -0
- package/dist/managedWebhooks.d.ts.map +1 -0
- package/dist/managedWebhooks.js +115 -0
- package/dist/managedWebhooks.js.map +1 -0
- package/dist/platforms/atlassian.d.ts +18 -0
- package/dist/platforms/atlassian.d.ts.map +1 -0
- package/dist/platforms/atlassian.js +24 -0
- package/dist/platforms/atlassian.js.map +1 -0
- package/dist/platforms/datadog.d.ts +45 -1
- package/dist/platforms/datadog.d.ts.map +1 -1
- package/dist/platforms/datadog.js +207 -0
- package/dist/platforms/datadog.js.map +1 -1
- package/dist/platforms/discord.d.ts +64 -16
- package/dist/platforms/discord.d.ts.map +1 -1
- package/dist/platforms/discord.js +15 -48
- package/dist/platforms/discord.js.map +1 -1
- package/dist/platforms/discordEvents.d.ts +213 -0
- package/dist/platforms/discordEvents.d.ts.map +1 -0
- package/dist/platforms/discordEvents.js +270 -0
- package/dist/platforms/discordEvents.js.map +1 -0
- package/dist/platforms/discordGateway.d.ts +14 -14
- package/dist/platforms/discordGateway.d.ts.map +1 -1
- package/dist/platforms/discordGateway.js +29 -45
- package/dist/platforms/discordGateway.js.map +1 -1
- package/dist/platforms/discordInteractions.d.ts +35 -0
- package/dist/platforms/discordInteractions.d.ts.map +1 -0
- package/dist/platforms/discordInteractions.js +125 -0
- package/dist/platforms/discordInteractions.js.map +1 -0
- package/dist/platforms/github.d.ts +45 -13
- package/dist/platforms/github.d.ts.map +1 -1
- package/dist/platforms/github.js +20 -40
- package/dist/platforms/github.js.map +1 -1
- package/dist/platforms/githubApi.d.ts +2 -0
- package/dist/platforms/githubApi.d.ts.map +1 -0
- package/dist/platforms/githubApi.js +38 -0
- package/dist/platforms/githubApi.js.map +1 -0
- package/dist/platforms/githubEvents.d.ts +160 -0
- package/dist/platforms/githubEvents.d.ts.map +1 -0
- package/dist/platforms/githubEvents.js +446 -0
- package/dist/platforms/githubEvents.js.map +1 -0
- package/dist/platforms/grafana.d.ts +47 -1
- package/dist/platforms/grafana.d.ts.map +1 -1
- package/dist/platforms/grafana.js +187 -0
- package/dist/platforms/grafana.js.map +1 -1
- package/dist/platforms/pagerduty.d.ts +59 -0
- package/dist/platforms/pagerduty.d.ts.map +1 -0
- package/dist/platforms/pagerduty.js +175 -0
- package/dist/platforms/pagerduty.js.map +1 -0
- package/dist/platforms/sentry.d.ts +35 -17
- package/dist/platforms/sentry.d.ts.map +1 -1
- package/dist/platforms/sentry.js +48 -25
- package/dist/platforms/sentry.js.map +1 -1
- package/dist/platforms/sentryApi.d.ts +3 -0
- package/dist/platforms/sentryApi.d.ts.map +1 -0
- package/dist/platforms/sentryApi.js +29 -0
- package/dist/platforms/sentryApi.js.map +1 -0
- package/dist/platforms/sentryEvents.d.ts +64 -0
- package/dist/platforms/sentryEvents.d.ts.map +1 -0
- package/dist/platforms/sentryEvents.js +183 -0
- package/dist/platforms/sentryEvents.js.map +1 -0
- package/dist/platforms/slack.d.ts +69 -33
- package/dist/platforms/slack.d.ts.map +1 -1
- package/dist/platforms/slack.js +29 -36
- package/dist/platforms/slack.js.map +1 -1
- package/dist/platforms/slackEvents.d.ts +204 -0
- package/dist/platforms/slackEvents.d.ts.map +1 -0
- package/dist/platforms/slackEvents.js +241 -0
- package/dist/platforms/slackEvents.js.map +1 -0
- package/dist/platforms/slackInteractions.d.ts +79 -0
- package/dist/platforms/slackInteractions.d.ts.map +1 -0
- package/dist/platforms/slackInteractions.js +160 -0
- package/dist/platforms/slackInteractions.js.map +1 -0
- package/package.json +9 -1
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { CredentialSource, OAuthConnection, OAuthPresetOptions } from "../connections.js";
|
|
2
2
|
import type { OAuthProfile } from "../providers.js";
|
|
3
|
-
import type { JsonSchema,
|
|
4
|
-
export
|
|
3
|
+
import type { JsonSchema, Trigger } from "../types.js";
|
|
4
|
+
export type { DiscordEventData, DiscordEventName } from "./discordEvents.js";
|
|
5
|
+
export { connectDiscordGateway, discordIntents, type DiscordCommand, type DiscordGateway, type DiscordGatewayOptions, type DiscordMessageData, } from "./discordGateway.js";
|
|
6
|
+
export type { DiscordCommandData, DiscordComponentData, } from "./discordInteractions.js";
|
|
5
7
|
/** Options for `discordConnection()`. */
|
|
6
8
|
export type DiscordConnectionOptions = OAuthPresetOptions & {
|
|
7
9
|
/** The permissions the bot asks for in the server, as Discord's permission bitfield, such as `"2048"` to send messages. Defaults to none. */
|
|
@@ -31,25 +33,26 @@ export declare const discordProfile: OAuthProfile;
|
|
|
31
33
|
*/
|
|
32
34
|
export declare const discordConnection: ({ permissions, scopes, ...options }?: DiscordConnectionOptions) => OAuthConnection<"default">;
|
|
33
35
|
/**
|
|
34
|
-
* Triggers that run a schedule on
|
|
35
|
-
*
|
|
36
|
-
*
|
|
36
|
+
* Triggers that run a schedule on what `connectDiscordGateway()` dispatches, for a skill whose connections include
|
|
37
|
+
* `connection`: messages, slash commands, components and modals, and one per Gateway event type such as
|
|
38
|
+
* `message_reaction_add`. Every schedule watching one gets its own run, with a `DiscordMessageData`,
|
|
39
|
+
* `DiscordCommandData`, `DiscordComponentData` or `DiscordEventData` as `task.event.data`.
|
|
37
40
|
*
|
|
38
41
|
* @param connection The skill's Discord connection.
|
|
39
|
-
* @returns The
|
|
42
|
+
* @returns The triggers, for a skill's `triggers`.
|
|
40
43
|
*/
|
|
41
44
|
export declare const discordTriggers: (connection: CredentialSource) => {
|
|
42
45
|
/** A message in a channel the bot can read in the server, or only in `config.channel` when the requester sets it. */
|
|
43
46
|
message: {
|
|
44
47
|
description: string;
|
|
45
48
|
config: JsonSchema;
|
|
46
|
-
onScheduleActive: (schedule: TriggerSchedule, context: TriggerContext) => import("../types.js").Awaitable<import("../types.js").TriggerActivation | void>;
|
|
49
|
+
onScheduleActive: (schedule: import("../types.js").TriggerSchedule, context: import("../types.js").TriggerContext) => import("../types.js").Awaitable<import("../types.js").TriggerActivation | void>;
|
|
47
50
|
};
|
|
48
51
|
/** A message that mentions the bot, in any channel of the server or only in `config.channel`. */
|
|
49
52
|
mention: {
|
|
50
53
|
description: string;
|
|
51
54
|
config: JsonSchema;
|
|
52
|
-
onScheduleActive: (schedule: TriggerSchedule, context: TriggerContext) => import("../types.js").Awaitable<import("../types.js").TriggerActivation | void>;
|
|
55
|
+
onScheduleActive: (schedule: import("../types.js").TriggerSchedule, context: import("../types.js").TriggerContext) => import("../types.js").Awaitable<import("../types.js").TriggerActivation | void>;
|
|
53
56
|
};
|
|
54
57
|
/** A direct message to the bot from the human who added it to the server. */
|
|
55
58
|
directMessage: {
|
|
@@ -58,17 +61,62 @@ export declare const discordTriggers: (connection: CredentialSource) => {
|
|
|
58
61
|
type: string;
|
|
59
62
|
properties: {};
|
|
60
63
|
};
|
|
61
|
-
onScheduleActive: (_schedule: TriggerSchedule, context: TriggerContext) => Promise<{
|
|
64
|
+
onScheduleActive: (_schedule: import("../types.js").TriggerSchedule, context: import("../types.js").TriggerContext) => Promise<{
|
|
62
65
|
eventKeys: string[];
|
|
63
66
|
}>;
|
|
64
67
|
};
|
|
65
68
|
/** The slash command `config.name`, run in the server, or in a direct message by the human who added the bot. */
|
|
66
|
-
command:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
command: Trigger;
|
|
70
|
+
/** A click or pick on the component `config.customId`, in the server or the human's direct messages. */
|
|
71
|
+
component: Trigger;
|
|
72
|
+
/** A submission of the modal `config.customId`, in the server or the human's direct messages. */
|
|
73
|
+
modal: Trigger;
|
|
74
|
+
auto_moderation_action_execution: Trigger;
|
|
75
|
+
auto_moderation_rule_create: Trigger;
|
|
76
|
+
auto_moderation_rule_delete: Trigger;
|
|
77
|
+
auto_moderation_rule_update: Trigger;
|
|
78
|
+
channel_create: Trigger;
|
|
79
|
+
channel_delete: Trigger;
|
|
80
|
+
channel_pins_update: Trigger;
|
|
81
|
+
channel_update: Trigger;
|
|
82
|
+
guild_audit_log_entry_create: Trigger;
|
|
83
|
+
guild_ban_add: Trigger;
|
|
84
|
+
guild_ban_remove: Trigger;
|
|
85
|
+
guild_emojis_update: Trigger;
|
|
86
|
+
guild_member_add: Trigger;
|
|
87
|
+
guild_member_remove: Trigger;
|
|
88
|
+
guild_member_update: Trigger;
|
|
89
|
+
guild_role_create: Trigger;
|
|
90
|
+
guild_role_delete: Trigger;
|
|
91
|
+
guild_role_update: Trigger;
|
|
92
|
+
guild_scheduled_event_create: Trigger;
|
|
93
|
+
guild_scheduled_event_delete: Trigger;
|
|
94
|
+
guild_scheduled_event_update: Trigger;
|
|
95
|
+
guild_scheduled_event_user_add: Trigger;
|
|
96
|
+
guild_scheduled_event_user_remove: Trigger;
|
|
97
|
+
guild_stickers_update: Trigger;
|
|
98
|
+
guild_update: Trigger;
|
|
99
|
+
integration_create: Trigger;
|
|
100
|
+
integration_delete: Trigger;
|
|
101
|
+
integration_update: Trigger;
|
|
102
|
+
invite_create: Trigger;
|
|
103
|
+
invite_delete: Trigger;
|
|
104
|
+
message_delete: Trigger;
|
|
105
|
+
message_delete_bulk: Trigger;
|
|
106
|
+
message_poll_vote_add: Trigger;
|
|
107
|
+
message_poll_vote_remove: Trigger;
|
|
108
|
+
message_reaction_add: Trigger;
|
|
109
|
+
message_reaction_remove: Trigger;
|
|
110
|
+
message_reaction_remove_all: Trigger;
|
|
111
|
+
message_reaction_remove_emoji: Trigger;
|
|
112
|
+
message_update: Trigger;
|
|
113
|
+
stage_instance_create: Trigger;
|
|
114
|
+
stage_instance_delete: Trigger;
|
|
115
|
+
stage_instance_update: Trigger;
|
|
116
|
+
thread_create: Trigger;
|
|
117
|
+
thread_delete: Trigger;
|
|
118
|
+
thread_update: Trigger;
|
|
119
|
+
voice_state_update: Trigger;
|
|
120
|
+
webhooks_update: Trigger;
|
|
73
121
|
};
|
|
74
122
|
//# sourceMappingURL=discord.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discord.d.ts","sourceRoot":"","sources":["../../src/platforms/discord.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAW,YAAY,EAAiB,MAAM,iBAAiB,CAAC;AAM5E,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"discord.d.ts","sourceRoot":"","sources":["../../src/platforms/discord.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAW,YAAY,EAAiB,MAAM,iBAAiB,CAAC;AAM5E,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAavD,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,GACxB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAElC,yCAAyC;AACzC,MAAM,MAAM,wBAAwB,GAAG,kBAAkB,GAAG;IAC1D,6IAA6I;IAC7I,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iFAAiF;IACjF,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAqCF;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,4BAAwB,YAsD3D,CAAC;AAEF,yHAAyH;AACzH,eAAO,MAAM,cAAc,cAA4B,CAAC;AAExD;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,yCAI3B,wBAAwB,KAAQ,eAAe,CAAC,SAAS,CAQzD,CAAC;AAmBJ;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,eAAgB,gBAAgB;IAGxD,qHAAqH;;QAEnH,WAAW;QAEX,MAAM;QACN,gBAAgB;;IAElB,iGAAiG;;QAE/F,WAAW;QAEX,MAAM;QACN,gBAAgB;;IAElB,6EAA6E;;;;YAIjE,IAAI;YAAY,UAAU;;;;;;IAgBtC,iHAAiH;;IAMjH,wGAAwG;;IAMxG,iGAAiG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAM/D,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { AgentJamError } from "../errors.js";
|
|
2
2
|
import { constructStandardProfile, defaultToken, postForm, } from "../providers.js";
|
|
3
|
-
import { constructDiscordKey, directScope,
|
|
3
|
+
import { channelProperty, constructDiscordKey, constructEventTriggers, directScope, readConfigText, readDiscordAccount, } from "./discordEvents.js";
|
|
4
|
+
import { discordApi } from "./discordGateway.js";
|
|
5
|
+
import { constructInteractionTrigger } from "./discordInteractions.js";
|
|
4
6
|
import { constructOAuthPreset } from "./presets.js";
|
|
5
7
|
export { connectDiscordGateway, discordIntents, } from "./discordGateway.js";
|
|
6
8
|
const discordEndpoints = {
|
|
@@ -93,45 +95,24 @@ export const discordConnection = ({ permissions, scopes = [], ...options } = {})
|
|
|
93
95
|
}, { ...options, scopes });
|
|
94
96
|
const channelConfig = {
|
|
95
97
|
type: "object",
|
|
96
|
-
properties: {
|
|
97
|
-
channel: {
|
|
98
|
-
type: "string",
|
|
99
|
-
description: "The id of the channel to watch, such as 1234567890. Leave it out to watch every channel the bot can read.",
|
|
100
|
-
},
|
|
101
|
-
},
|
|
98
|
+
properties: { channel: channelProperty },
|
|
102
99
|
};
|
|
103
|
-
const commandConfig = {
|
|
104
|
-
type: "object",
|
|
105
|
-
properties: {
|
|
106
|
-
name: {
|
|
107
|
-
type: "string",
|
|
108
|
-
description: "The name of the slash command to run on, without its slash, such as standup.",
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
required: ["name"],
|
|
112
|
-
};
|
|
113
|
-
const readDiscordAccount = async ({ account }, connection) => {
|
|
114
|
-
const connected = await account(connection);
|
|
115
|
-
if (!connected) {
|
|
116
|
-
throw new AgentJamError("The schedule has no Discord server connected, so it can't watch Discord");
|
|
117
|
-
}
|
|
118
|
-
return connected;
|
|
119
|
-
};
|
|
120
|
-
const readConfigText = ({ config }, key) => typeof config[key] === "string" ? config[key] : undefined;
|
|
121
100
|
const watchChannel = (kind, connection) => async (schedule, context) => {
|
|
122
101
|
const { id } = await readDiscordAccount(context, connection);
|
|
123
102
|
const channel = readConfigText(schedule, "channel");
|
|
124
103
|
return { eventKeys: [constructDiscordKey(id, kind, channel)] };
|
|
125
104
|
};
|
|
126
105
|
/**
|
|
127
|
-
* Triggers that run a schedule on
|
|
128
|
-
*
|
|
129
|
-
*
|
|
106
|
+
* Triggers that run a schedule on what `connectDiscordGateway()` dispatches, for a skill whose connections include
|
|
107
|
+
* `connection`: messages, slash commands, components and modals, and one per Gateway event type such as
|
|
108
|
+
* `message_reaction_add`. Every schedule watching one gets its own run, with a `DiscordMessageData`,
|
|
109
|
+
* `DiscordCommandData`, `DiscordComponentData` or `DiscordEventData` as `task.event.data`.
|
|
130
110
|
*
|
|
131
111
|
* @param connection The skill's Discord connection.
|
|
132
|
-
* @returns The
|
|
112
|
+
* @returns The triggers, for a skill's `triggers`.
|
|
133
113
|
*/
|
|
134
114
|
export const discordTriggers = (connection) => ({
|
|
115
|
+
...constructEventTriggers(connection),
|
|
135
116
|
/** A message in a channel the bot can read in the server, or only in `config.channel` when the requester sets it. */
|
|
136
117
|
message: {
|
|
137
118
|
description: "A message is posted in a channel the bot can read, or in one channel when `channel` is set",
|
|
@@ -161,24 +142,10 @@ export const discordTriggers = (connection) => ({
|
|
|
161
142
|
},
|
|
162
143
|
},
|
|
163
144
|
/** The slash command `config.name`, run in the server, or in a direct message by the human who added the bot. */
|
|
164
|
-
command:
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
const name = readConfigText(schedule, "name");
|
|
170
|
-
if (name === undefined) {
|
|
171
|
-
throw new AgentJamError("The schedule names no slash command, so set `name` in its config");
|
|
172
|
-
}
|
|
173
|
-
const direct = subject === undefined
|
|
174
|
-
? []
|
|
175
|
-
: [
|
|
176
|
-
constructDiscordKey(directScope, "command", `${name}:${subject}`),
|
|
177
|
-
];
|
|
178
|
-
return {
|
|
179
|
-
eventKeys: [constructDiscordKey(id, "command", name), ...direct],
|
|
180
|
-
};
|
|
181
|
-
},
|
|
182
|
-
},
|
|
145
|
+
command: constructInteractionTrigger("command", "Someone runs the slash command `name` in the server, or the human who added the bot runs it in a direct message", connection),
|
|
146
|
+
/** A click or pick on the component `config.customId`, in the server or the human's direct messages. */
|
|
147
|
+
component: constructInteractionTrigger("component", "Someone clicks the button or picks from the select menu `customId` in the server, or the human who added the bot does in a direct message", connection),
|
|
148
|
+
/** A submission of the modal `config.customId`, in the server or the human's direct messages. */
|
|
149
|
+
modal: constructInteractionTrigger("modal", "Someone submits the modal `customId` in the server, or the human who added the bot does in a direct message", connection),
|
|
183
150
|
});
|
|
184
151
|
//# sourceMappingURL=discord.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discord.js","sourceRoot":"","sources":["../../src/platforms/discord.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EACL,wBAAwB,EACxB,YAAY,EACZ,QAAQ,GACT,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"discord.js","sourceRoot":"","sources":["../../src/platforms/discord.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C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AW,EAAE,eAAe,EAAE,OAAO,CAAC;iBAC3D;aACF,CAAC;QACJ,CAAC;KACF;IACD,iHAAiH;IACjH,OAAO,EAAE,2BAA2B,CAClC,SAAS,EACT,iHAAiH,EACjH,UAAU,CACX;IACD,wGAAwG;IACxG,SAAS,EAAE,2BAA2B,CACpC,WAAW,EACX,2IAA2I,EAC3I,UAAU,CACX;IACD,iGAAiG;IACjG,KAAK,EAAE,2BAA2B,CAChC,OAAO,EACP,6GAA6G,EAC7G,UAAU,CACX;CACF,CAAmC,CAAC"}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import type { JsonObject } from "../types.js";
|
|
2
|
+
type FieldReader = (event: JsonObject) => string | undefined;
|
|
3
|
+
declare const discordEventTypes: {
|
|
4
|
+
message_update: {
|
|
5
|
+
description: string;
|
|
6
|
+
channel: FieldReader;
|
|
7
|
+
user: FieldReader;
|
|
8
|
+
};
|
|
9
|
+
message_delete: {
|
|
10
|
+
description: string;
|
|
11
|
+
channel: FieldReader;
|
|
12
|
+
};
|
|
13
|
+
message_delete_bulk: {
|
|
14
|
+
description: string;
|
|
15
|
+
channel: FieldReader;
|
|
16
|
+
};
|
|
17
|
+
message_reaction_add: {
|
|
18
|
+
description: string;
|
|
19
|
+
channel: FieldReader;
|
|
20
|
+
user: FieldReader;
|
|
21
|
+
};
|
|
22
|
+
message_reaction_remove: {
|
|
23
|
+
description: string;
|
|
24
|
+
channel: FieldReader;
|
|
25
|
+
user: FieldReader;
|
|
26
|
+
};
|
|
27
|
+
message_reaction_remove_all: {
|
|
28
|
+
description: string;
|
|
29
|
+
channel: FieldReader;
|
|
30
|
+
};
|
|
31
|
+
message_reaction_remove_emoji: {
|
|
32
|
+
description: string;
|
|
33
|
+
channel: FieldReader;
|
|
34
|
+
};
|
|
35
|
+
message_poll_vote_add: {
|
|
36
|
+
description: string;
|
|
37
|
+
channel: FieldReader;
|
|
38
|
+
user: FieldReader;
|
|
39
|
+
};
|
|
40
|
+
message_poll_vote_remove: {
|
|
41
|
+
description: string;
|
|
42
|
+
channel: FieldReader;
|
|
43
|
+
user: FieldReader;
|
|
44
|
+
};
|
|
45
|
+
channel_create: {
|
|
46
|
+
description: string;
|
|
47
|
+
channel: FieldReader;
|
|
48
|
+
};
|
|
49
|
+
channel_update: {
|
|
50
|
+
description: string;
|
|
51
|
+
channel: FieldReader;
|
|
52
|
+
};
|
|
53
|
+
channel_delete: {
|
|
54
|
+
description: string;
|
|
55
|
+
channel: FieldReader;
|
|
56
|
+
};
|
|
57
|
+
channel_pins_update: {
|
|
58
|
+
description: string;
|
|
59
|
+
channel: FieldReader;
|
|
60
|
+
};
|
|
61
|
+
thread_create: {
|
|
62
|
+
description: string;
|
|
63
|
+
channel: FieldReader;
|
|
64
|
+
user: FieldReader;
|
|
65
|
+
};
|
|
66
|
+
thread_update: {
|
|
67
|
+
description: string;
|
|
68
|
+
channel: FieldReader;
|
|
69
|
+
};
|
|
70
|
+
thread_delete: {
|
|
71
|
+
description: string;
|
|
72
|
+
channel: FieldReader;
|
|
73
|
+
};
|
|
74
|
+
guild_update: {
|
|
75
|
+
description: string;
|
|
76
|
+
guild: FieldReader;
|
|
77
|
+
};
|
|
78
|
+
guild_member_add: {
|
|
79
|
+
description: string;
|
|
80
|
+
user: FieldReader;
|
|
81
|
+
};
|
|
82
|
+
guild_member_update: {
|
|
83
|
+
description: string;
|
|
84
|
+
user: FieldReader;
|
|
85
|
+
};
|
|
86
|
+
guild_member_remove: {
|
|
87
|
+
description: string;
|
|
88
|
+
user: FieldReader;
|
|
89
|
+
};
|
|
90
|
+
guild_ban_add: {
|
|
91
|
+
description: string;
|
|
92
|
+
user: FieldReader;
|
|
93
|
+
};
|
|
94
|
+
guild_ban_remove: {
|
|
95
|
+
description: string;
|
|
96
|
+
user: FieldReader;
|
|
97
|
+
};
|
|
98
|
+
guild_audit_log_entry_create: {
|
|
99
|
+
description: string;
|
|
100
|
+
user: FieldReader;
|
|
101
|
+
};
|
|
102
|
+
guild_role_create: {
|
|
103
|
+
description: string;
|
|
104
|
+
};
|
|
105
|
+
guild_role_update: {
|
|
106
|
+
description: string;
|
|
107
|
+
};
|
|
108
|
+
guild_role_delete: {
|
|
109
|
+
description: string;
|
|
110
|
+
};
|
|
111
|
+
guild_emojis_update: {
|
|
112
|
+
description: string;
|
|
113
|
+
};
|
|
114
|
+
guild_stickers_update: {
|
|
115
|
+
description: string;
|
|
116
|
+
};
|
|
117
|
+
guild_scheduled_event_create: {
|
|
118
|
+
description: string;
|
|
119
|
+
channel: FieldReader;
|
|
120
|
+
user: FieldReader;
|
|
121
|
+
};
|
|
122
|
+
guild_scheduled_event_update: {
|
|
123
|
+
description: string;
|
|
124
|
+
channel: FieldReader;
|
|
125
|
+
user: FieldReader;
|
|
126
|
+
};
|
|
127
|
+
guild_scheduled_event_delete: {
|
|
128
|
+
description: string;
|
|
129
|
+
channel: FieldReader;
|
|
130
|
+
user: FieldReader;
|
|
131
|
+
};
|
|
132
|
+
guild_scheduled_event_user_add: {
|
|
133
|
+
description: string;
|
|
134
|
+
user: FieldReader;
|
|
135
|
+
};
|
|
136
|
+
guild_scheduled_event_user_remove: {
|
|
137
|
+
description: string;
|
|
138
|
+
user: FieldReader;
|
|
139
|
+
};
|
|
140
|
+
invite_create: {
|
|
141
|
+
description: string;
|
|
142
|
+
channel: FieldReader;
|
|
143
|
+
user: FieldReader;
|
|
144
|
+
};
|
|
145
|
+
invite_delete: {
|
|
146
|
+
description: string;
|
|
147
|
+
channel: FieldReader;
|
|
148
|
+
};
|
|
149
|
+
voice_state_update: {
|
|
150
|
+
description: string;
|
|
151
|
+
channel: FieldReader;
|
|
152
|
+
user: FieldReader;
|
|
153
|
+
};
|
|
154
|
+
stage_instance_create: {
|
|
155
|
+
description: string;
|
|
156
|
+
channel: FieldReader;
|
|
157
|
+
};
|
|
158
|
+
stage_instance_update: {
|
|
159
|
+
description: string;
|
|
160
|
+
channel: FieldReader;
|
|
161
|
+
};
|
|
162
|
+
stage_instance_delete: {
|
|
163
|
+
description: string;
|
|
164
|
+
channel: FieldReader;
|
|
165
|
+
};
|
|
166
|
+
webhooks_update: {
|
|
167
|
+
description: string;
|
|
168
|
+
channel: FieldReader;
|
|
169
|
+
};
|
|
170
|
+
integration_create: {
|
|
171
|
+
description: string;
|
|
172
|
+
};
|
|
173
|
+
integration_update: {
|
|
174
|
+
description: string;
|
|
175
|
+
};
|
|
176
|
+
integration_delete: {
|
|
177
|
+
description: string;
|
|
178
|
+
};
|
|
179
|
+
auto_moderation_rule_create: {
|
|
180
|
+
description: string;
|
|
181
|
+
user: FieldReader;
|
|
182
|
+
};
|
|
183
|
+
auto_moderation_rule_update: {
|
|
184
|
+
description: string;
|
|
185
|
+
user: FieldReader;
|
|
186
|
+
};
|
|
187
|
+
auto_moderation_rule_delete: {
|
|
188
|
+
description: string;
|
|
189
|
+
user: FieldReader;
|
|
190
|
+
};
|
|
191
|
+
auto_moderation_action_execution: {
|
|
192
|
+
description: string;
|
|
193
|
+
channel: FieldReader;
|
|
194
|
+
user: FieldReader;
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
/** A Gateway event `discordTriggers` has a trigger for, as its lowercased name, such as `message_reaction_add`. */
|
|
198
|
+
export type DiscordEventName = keyof typeof discordEventTypes;
|
|
199
|
+
/** What a schedule's task gets as `task.event.data` when a Discord event type's trigger runs it. */
|
|
200
|
+
export type DiscordEventData = {
|
|
201
|
+
type: DiscordEventName;
|
|
202
|
+
guildId: string;
|
|
203
|
+
/** The channel the event happened in, or a thread's parent channel. */
|
|
204
|
+
channelId: string | null;
|
|
205
|
+
/** The user who caused the event, or who it's about, such as the member who joined. */
|
|
206
|
+
userId: string | null;
|
|
207
|
+
/** The event's fields as Discord sent them. */
|
|
208
|
+
event: JsonObject;
|
|
209
|
+
/** The fields of `event` left out, largest first, to fit an event's size limit. */
|
|
210
|
+
omitted?: string[];
|
|
211
|
+
};
|
|
212
|
+
export {};
|
|
213
|
+
//# sourceMappingURL=discordEvents.d.ts.map
|
|
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