runline 0.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.
Files changed (230) hide show
  1. package/.pi/extensions/runline-context/index.ts +135 -0
  2. package/.pi/extensions/runline-context/package.json +17 -0
  3. package/README.md +273 -0
  4. package/dist/commands/actions.d.ts +3 -0
  5. package/dist/commands/actions.js +43 -0
  6. package/dist/commands/connection.d.ts +11 -0
  7. package/dist/commands/connection.js +56 -0
  8. package/dist/commands/exec.d.ts +5 -0
  9. package/dist/commands/exec.js +46 -0
  10. package/dist/commands/init.d.ts +4 -0
  11. package/dist/commands/init.js +26 -0
  12. package/dist/commands/plugin.d.ts +10 -0
  13. package/dist/commands/plugin.js +57 -0
  14. package/dist/config/index.d.ts +3 -0
  15. package/dist/config/index.js +2 -0
  16. package/dist/config/loader.d.ts +11 -0
  17. package/dist/config/loader.js +82 -0
  18. package/dist/config/types.d.ts +9 -0
  19. package/dist/config/types.js +5 -0
  20. package/dist/core/engine.d.ts +21 -0
  21. package/dist/core/engine.js +280 -0
  22. package/dist/index.d.ts +16 -0
  23. package/dist/index.js +9 -0
  24. package/dist/main.d.ts +2 -0
  25. package/dist/main.js +127 -0
  26. package/dist/plugin/api.d.ts +32 -0
  27. package/dist/plugin/api.js +68 -0
  28. package/dist/plugin/installer.d.ts +27 -0
  29. package/dist/plugin/installer.js +181 -0
  30. package/dist/plugin/loader.d.ts +13 -0
  31. package/dist/plugin/loader.js +164 -0
  32. package/dist/plugin/registry.d.ts +18 -0
  33. package/dist/plugin/registry.js +43 -0
  34. package/dist/plugin/types.d.ts +40 -0
  35. package/dist/plugin/types.js +1 -0
  36. package/dist/plugins/actionNetwork/src/index.js +353 -0
  37. package/dist/plugins/activeCampaign/src/index.js +711 -0
  38. package/dist/plugins/adalo/src/index.js +131 -0
  39. package/dist/plugins/affinity/src/index.js +279 -0
  40. package/dist/plugins/agileCrm/src/index.js +415 -0
  41. package/dist/plugins/airtable/src/index.js +280 -0
  42. package/dist/plugins/airtop/src/index.js +527 -0
  43. package/dist/plugins/apiTemplateIo/src/index.js +86 -0
  44. package/dist/plugins/asana/src/index.js +413 -0
  45. package/dist/plugins/autopilot/src/index.js +203 -0
  46. package/dist/plugins/bambooHr/src/index.js +252 -0
  47. package/dist/plugins/bannerbear/src/index.js +100 -0
  48. package/dist/plugins/baserow/src/index.js +180 -0
  49. package/dist/plugins/beeminder/src/index.js +298 -0
  50. package/dist/plugins/bitly/src/index.js +107 -0
  51. package/dist/plugins/bitwarden/src/index.js +383 -0
  52. package/dist/plugins/box/src/index.js +300 -0
  53. package/dist/plugins/brandfetch/src/index.js +80 -0
  54. package/dist/plugins/brevo/src/index.js +305 -0
  55. package/dist/plugins/bubble/src/index.js +181 -0
  56. package/dist/plugins/chargebee/src/index.js +126 -0
  57. package/dist/plugins/circleci/src/index.js +111 -0
  58. package/dist/plugins/ciscoWebex/src/index.js +245 -0
  59. package/dist/plugins/clearbit/src/index.js +103 -0
  60. package/dist/plugins/clickup/src/index.js +1043 -0
  61. package/dist/plugins/clockify/src/index.js +443 -0
  62. package/dist/plugins/cloudflare/src/index.js +93 -0
  63. package/dist/plugins/cockpit/src/index.js +131 -0
  64. package/dist/plugins/coda/src/index.js +327 -0
  65. package/dist/plugins/coingecko/src/index.js +244 -0
  66. package/dist/plugins/contentful/src/index.js +146 -0
  67. package/dist/plugins/convertkit/src/index.js +270 -0
  68. package/dist/plugins/copper/src/index.js +140 -0
  69. package/dist/plugins/cortex/src/index.js +147 -0
  70. package/dist/plugins/currents/src/index.js +405 -0
  71. package/dist/plugins/customerIo/src/index.js +184 -0
  72. package/dist/plugins/databricks/src/index.js +342 -0
  73. package/dist/plugins/deepl/src/index.js +87 -0
  74. package/dist/plugins/demio/src/index.js +111 -0
  75. package/dist/plugins/dhl/src/index.js +40 -0
  76. package/dist/plugins/discord/src/index.js +275 -0
  77. package/dist/plugins/discourse/src/index.js +273 -0
  78. package/dist/plugins/disqus/src/index.js +145 -0
  79. package/dist/plugins/docker/src/index.js +76 -0
  80. package/dist/plugins/drift/src/index.js +89 -0
  81. package/dist/plugins/dropbox/src/index.js +159 -0
  82. package/dist/plugins/dropcontact/src/index.js +59 -0
  83. package/dist/plugins/egoi/src/index.js +151 -0
  84. package/dist/plugins/elasticsearch/src/index.js +157 -0
  85. package/dist/plugins/emelia/src/index.js +174 -0
  86. package/dist/plugins/erpnext/src/index.js +121 -0
  87. package/dist/plugins/facebookGraph/src/index.js +57 -0
  88. package/dist/plugins/freshdesk/src/index.js +320 -0
  89. package/dist/plugins/freshservice/src/index.js +146 -0
  90. package/dist/plugins/freshworksCrm/src/index.js +149 -0
  91. package/dist/plugins/getresponse/src/index.js +140 -0
  92. package/dist/plugins/ghost/src/index.js +192 -0
  93. package/dist/plugins/github/src/index.js +630 -0
  94. package/dist/plugins/gitlab/src/index.js +358 -0
  95. package/dist/plugins/gong/src/index.js +126 -0
  96. package/dist/plugins/gotify/src/index.js +77 -0
  97. package/dist/plugins/gotowebinar/src/index.js +316 -0
  98. package/dist/plugins/grafana/src/index.js +250 -0
  99. package/dist/plugins/graphql/src/index.js +78 -0
  100. package/dist/plugins/grist/src/index.js +106 -0
  101. package/dist/plugins/hackernews/src/index.js +89 -0
  102. package/dist/plugins/halopsa/src/index.js +79 -0
  103. package/dist/plugins/harvest/src/index.js +163 -0
  104. package/dist/plugins/helpscout/src/index.js +176 -0
  105. package/dist/plugins/highlevel/src/index.js +172 -0
  106. package/dist/plugins/homeAssistant/src/index.js +148 -0
  107. package/dist/plugins/hubspot/src/index.js +176 -0
  108. package/dist/plugins/humanticAi/src/index.js +60 -0
  109. package/dist/plugins/hunter/src/index.js +59 -0
  110. package/dist/plugins/intercom/src/index.js +156 -0
  111. package/dist/plugins/iterable/src/index.js +139 -0
  112. package/dist/plugins/jenkins/src/index.js +132 -0
  113. package/dist/plugins/jira/src/index.js +229 -0
  114. package/dist/plugins/keap/src/index.js +502 -0
  115. package/dist/plugins/kobotoolbox/src/index.js +281 -0
  116. package/dist/plugins/lemlist/src/index.js +231 -0
  117. package/dist/plugins/linear/src/index.js +133 -0
  118. package/dist/plugins/lingvanex/src/index.js +31 -0
  119. package/dist/plugins/linkedin/src/index.js +80 -0
  120. package/dist/plugins/lonescale/src/index.js +119 -0
  121. package/dist/plugins/magento/src/index.js +300 -0
  122. package/dist/plugins/mailcheck/src/index.js +27 -0
  123. package/dist/plugins/mailchimp/src/index.js +321 -0
  124. package/dist/plugins/mailerlite/src/index.js +123 -0
  125. package/dist/plugins/mailgun/src/index.js +48 -0
  126. package/dist/plugins/mailjet/src/index.js +155 -0
  127. package/dist/plugins/mandrill/src/index.js +145 -0
  128. package/dist/plugins/marketstack/src/index.js +97 -0
  129. package/dist/plugins/matrix/src/index.js +194 -0
  130. package/dist/plugins/mattermost/src/index.js +331 -0
  131. package/dist/plugins/mautic/src/index.js +311 -0
  132. package/dist/plugins/medium/src/index.js +77 -0
  133. package/dist/plugins/messagebird/src/index.js +57 -0
  134. package/dist/plugins/metabase/src/index.js +130 -0
  135. package/dist/plugins/misp/src/index.js +476 -0
  136. package/dist/plugins/mocean/src/index.js +67 -0
  137. package/dist/plugins/monday/src/index.js +231 -0
  138. package/dist/plugins/monicaCrm/src/index.js +52 -0
  139. package/dist/plugins/msg91/src/index.js +31 -0
  140. package/dist/plugins/nasa/src/index.js +146 -0
  141. package/dist/plugins/netlify/src/index.js +151 -0
  142. package/dist/plugins/netscalerAdc/src/index.js +131 -0
  143. package/dist/plugins/nextcloud/src/index.js +263 -0
  144. package/dist/plugins/nocodb/src/index.js +130 -0
  145. package/dist/plugins/notion/src/index.js +112 -0
  146. package/dist/plugins/npm/src/index.js +104 -0
  147. package/dist/plugins/odoo/src/index.js +157 -0
  148. package/dist/plugins/okta/src/index.js +141 -0
  149. package/dist/plugins/oneSimpleApi/src/index.js +155 -0
  150. package/dist/plugins/onfleet/src/index.js +254 -0
  151. package/dist/plugins/openThesaurus/src/index.js +32 -0
  152. package/dist/plugins/openweathermap/src/index.js +60 -0
  153. package/dist/plugins/oura/src/index.js +62 -0
  154. package/dist/plugins/paddle/src/index.js +247 -0
  155. package/dist/plugins/pagerduty/src/index.js +201 -0
  156. package/dist/plugins/paypal/src/index.js +106 -0
  157. package/dist/plugins/peekalink/src/index.js +35 -0
  158. package/dist/plugins/phantombuster/src/index.js +94 -0
  159. package/dist/plugins/philipsHue/src/index.js +98 -0
  160. package/dist/plugins/pipedrive/src/index.js +169 -0
  161. package/dist/plugins/plivo/src/index.js +66 -0
  162. package/dist/plugins/postbin/src/index.js +93 -0
  163. package/dist/plugins/posthog/src/index.js +113 -0
  164. package/dist/plugins/profitwell/src/index.js +50 -0
  165. package/dist/plugins/pushbullet/src/index.js +102 -0
  166. package/dist/plugins/pushcut/src/index.js +39 -0
  167. package/dist/plugins/pushover/src/index.js +65 -0
  168. package/dist/plugins/quickbase/src/index.js +153 -0
  169. package/dist/plugins/quickbooks/src/index.js +73 -0
  170. package/dist/plugins/quickchart/src/index.js +36 -0
  171. package/dist/plugins/raindrop/src/index.js +209 -0
  172. package/dist/plugins/reddit/src/index.js +185 -0
  173. package/dist/plugins/rocketchat/src/index.js +53 -0
  174. package/dist/plugins/rundeck/src/index.js +62 -0
  175. package/dist/plugins/salesforce/src/index.js +94 -0
  176. package/dist/plugins/salesmate/src/index.js +83 -0
  177. package/dist/plugins/securityScorecard/src/index.js +200 -0
  178. package/dist/plugins/segment/src/index.js +125 -0
  179. package/dist/plugins/sendgrid/src/index.js +187 -0
  180. package/dist/plugins/sendy/src/index.js +138 -0
  181. package/dist/plugins/sentry/src/index.js +233 -0
  182. package/dist/plugins/servicenow/src/index.js +108 -0
  183. package/dist/plugins/shopify/src/index.js +222 -0
  184. package/dist/plugins/signl4/src/index.js +61 -0
  185. package/dist/plugins/slack/src/index.js +236 -0
  186. package/dist/plugins/sms77/src/index.js +63 -0
  187. package/dist/plugins/splunk/src/index.js +207 -0
  188. package/dist/plugins/spotify/src/index.js +188 -0
  189. package/dist/plugins/stackby/src/index.js +82 -0
  190. package/dist/plugins/storyblok/src/index.js +141 -0
  191. package/dist/plugins/strapi/src/index.js +152 -0
  192. package/dist/plugins/strava/src/index.js +137 -0
  193. package/dist/plugins/stripe/src/index.js +222 -0
  194. package/dist/plugins/supabase/src/index.js +121 -0
  195. package/dist/plugins/syncromsp/src/index.js +255 -0
  196. package/dist/plugins/tapfiliate/src/index.js +125 -0
  197. package/dist/plugins/telegram/src/index.js +233 -0
  198. package/dist/plugins/thehive/src/index.js +142 -0
  199. package/dist/plugins/thehiveProject/src/index.js +194 -0
  200. package/dist/plugins/todoist/src/index.js +244 -0
  201. package/dist/plugins/travisci/src/index.js +71 -0
  202. package/dist/plugins/trello/src/index.js +341 -0
  203. package/dist/plugins/twake/src/index.js +40 -0
  204. package/dist/plugins/twilio/src/index.js +75 -0
  205. package/dist/plugins/twist/src/index.js +90 -0
  206. package/dist/plugins/twitter/src/index.js +123 -0
  207. package/dist/plugins/unleashedSoftware/src/index.js +84 -0
  208. package/dist/plugins/uplead/src/index.js +59 -0
  209. package/dist/plugins/uproc/src/index.js +34 -0
  210. package/dist/plugins/uptimerobot/src/index.js +264 -0
  211. package/dist/plugins/urlscanio/src/index.js +64 -0
  212. package/dist/plugins/vero/src/index.js +80 -0
  213. package/dist/plugins/vonage/src/index.js +42 -0
  214. package/dist/plugins/wekan/src/index.js +91 -0
  215. package/dist/plugins/woocommerce/src/index.js +92 -0
  216. package/dist/plugins/wordpress/src/index.js +121 -0
  217. package/dist/plugins/xero/src/index.js +136 -0
  218. package/dist/plugins/yourls/src/index.js +56 -0
  219. package/dist/plugins/zammad/src/index.js +91 -0
  220. package/dist/plugins/zendesk/src/index.js +137 -0
  221. package/dist/plugins/zoho/src/index.js +85 -0
  222. package/dist/plugins/zoom/src/index.js +122 -0
  223. package/dist/plugins/zulip/src/index.js +170 -0
  224. package/dist/sdk.d.ts +38 -0
  225. package/dist/sdk.js +105 -0
  226. package/dist/utils/cli.d.ts +13 -0
  227. package/dist/utils/cli.js +32 -0
  228. package/dist/utils/output.d.ts +4 -0
  229. package/dist/utils/output.js +13 -0
  230. package/package.json +57 -0
@@ -0,0 +1,111 @@
1
+ const BASE_URL = "https://my.demio.com/api/v1";
2
+ async function apiRequest(apiKey, apiSecret, method, endpoint, body, qs) {
3
+ const url = new URL(`${BASE_URL}${endpoint}`);
4
+ if (qs) {
5
+ for (const [k, v] of Object.entries(qs)) {
6
+ if (v !== undefined && v !== null)
7
+ url.searchParams.set(k, String(v));
8
+ }
9
+ }
10
+ const opts = {
11
+ method,
12
+ headers: {
13
+ "Content-Type": "application/json",
14
+ "Api-Key": apiKey,
15
+ "Api-Secret": apiSecret,
16
+ },
17
+ };
18
+ if (body && Object.keys(body).length > 0 && method !== "GET" && method !== "DELETE") {
19
+ opts.body = JSON.stringify(body);
20
+ }
21
+ const res = await fetch(url.toString(), opts);
22
+ if (!res.ok)
23
+ throw new Error(`Demio API error ${res.status}: ${await res.text()}`);
24
+ return res.json();
25
+ }
26
+ function getConn(ctx) {
27
+ return {
28
+ apiKey: ctx.connection.config.apiKey,
29
+ apiSecret: ctx.connection.config.apiSecret,
30
+ };
31
+ }
32
+ export default function demio(rl) {
33
+ rl.setName("demio");
34
+ rl.setVersion("0.1.0");
35
+ rl.setConnectionSchema({
36
+ apiKey: { type: "string", required: true, description: "Demio API key", env: "DEMIO_API_KEY" },
37
+ apiSecret: { type: "string", required: true, description: "Demio API secret", env: "DEMIO_API_SECRET" },
38
+ });
39
+ rl.registerAction("event.get", {
40
+ description: "Get an event (optionally a specific session/date)",
41
+ inputSchema: {
42
+ eventId: { type: "string", required: true, description: "Event ID" },
43
+ dateId: { type: "string", required: false, description: "Date/session ID (for specific session)" },
44
+ },
45
+ async execute(input, ctx) {
46
+ const { eventId, dateId } = input;
47
+ const { apiKey, apiSecret } = getConn(ctx);
48
+ if (dateId) {
49
+ return apiRequest(apiKey, apiSecret, "GET", `/event/${eventId}/date/${dateId}`);
50
+ }
51
+ return apiRequest(apiKey, apiSecret, "GET", `/event/${eventId}`);
52
+ },
53
+ });
54
+ rl.registerAction("event.list", {
55
+ description: "List events",
56
+ inputSchema: {
57
+ type: { type: "string", required: false, description: "Filter: upcoming, past, all" },
58
+ limit: { type: "number", required: false, description: "Max results" },
59
+ },
60
+ async execute(input, ctx) {
61
+ const { type, limit } = (input ?? {});
62
+ const { apiKey, apiSecret } = getConn(ctx);
63
+ const qs = {};
64
+ if (type)
65
+ qs.type = type;
66
+ const data = (await apiRequest(apiKey, apiSecret, "GET", "/events", undefined, qs));
67
+ if (limit)
68
+ return data.slice(0, limit);
69
+ return data;
70
+ },
71
+ });
72
+ rl.registerAction("event.register", {
73
+ description: "Register a person for an event",
74
+ inputSchema: {
75
+ eventId: { type: "string", required: true, description: "Event ID" },
76
+ email: { type: "string", required: true, description: "Registrant email" },
77
+ firstName: { type: "string", required: true, description: "First name" },
78
+ lastName: { type: "string", required: false, description: "Last name" },
79
+ dateId: { type: "string", required: false, description: "Specific session date ID" },
80
+ customFields: { type: "object", required: false, description: "Custom field key-value pairs" },
81
+ },
82
+ async execute(input, ctx) {
83
+ const { eventId, email, firstName, lastName, dateId, customFields } = input;
84
+ const { apiKey, apiSecret } = getConn(ctx);
85
+ const body = { id: eventId, email, name: firstName };
86
+ if (lastName)
87
+ body.last_name = lastName;
88
+ if (dateId)
89
+ body.date_id = dateId;
90
+ if (customFields)
91
+ Object.assign(body, customFields);
92
+ return apiRequest(apiKey, apiSecret, "PUT", "/event/register", body);
93
+ },
94
+ });
95
+ rl.registerAction("report.getParticipants", {
96
+ description: "Get participants report for a session",
97
+ inputSchema: {
98
+ dateId: { type: "string", required: true, description: "Session/date ID" },
99
+ status: { type: "string", required: false, description: "Filter: attended, did-not-attend, banned, left-early" },
100
+ },
101
+ async execute(input, ctx) {
102
+ const { dateId, status } = (input ?? {});
103
+ const { apiKey, apiSecret } = getConn(ctx);
104
+ const qs = {};
105
+ if (status)
106
+ qs.status = status;
107
+ const data = (await apiRequest(apiKey, apiSecret, "GET", `/report/${dateId}/participants`, undefined, qs));
108
+ return data.participants;
109
+ },
110
+ });
111
+ }
@@ -0,0 +1,40 @@
1
+ const BASE_URL = "https://api-eu.dhl.com";
2
+ async function apiRequest(apiKey, method, endpoint, qs) {
3
+ const url = new URL(`${BASE_URL}${endpoint}`);
4
+ if (qs) {
5
+ for (const [k, v] of Object.entries(qs)) {
6
+ if (v !== undefined && v !== null)
7
+ url.searchParams.set(k, String(v));
8
+ }
9
+ }
10
+ const res = await fetch(url.toString(), {
11
+ method,
12
+ headers: { "DHL-API-Key": apiKey, Accept: "application/json" },
13
+ });
14
+ if (!res.ok)
15
+ throw new Error(`DHL API error ${res.status}: ${await res.text()}`);
16
+ return res.json();
17
+ }
18
+ export default function dhl(rl) {
19
+ rl.setName("dhl");
20
+ rl.setVersion("0.1.0");
21
+ rl.setConnectionSchema({
22
+ apiKey: { type: "string", required: true, description: "DHL API key", env: "DHL_API_KEY" },
23
+ });
24
+ rl.registerAction("shipment.track", {
25
+ description: "Get tracking details for a shipment",
26
+ inputSchema: {
27
+ trackingNumber: { type: "string", required: true, description: "DHL tracking number" },
28
+ recipientPostalCode: { type: "string", required: false, description: "Recipient postal code for more detailed info" },
29
+ },
30
+ async execute(input, ctx) {
31
+ const { trackingNumber, recipientPostalCode } = input;
32
+ const apiKey = ctx.connection.config.apiKey;
33
+ const qs = { trackingNumber };
34
+ if (recipientPostalCode)
35
+ qs.recipientPostalCode = recipientPostalCode;
36
+ const data = (await apiRequest(apiKey, "GET", "/track/shipments", qs));
37
+ return data.shipments;
38
+ },
39
+ });
40
+ }
@@ -0,0 +1,275 @@
1
+ const BASE_URL = "https://discord.com/api/v10";
2
+ async function apiRequest(botToken, method, endpoint, body, qs) {
3
+ const url = new URL(`${BASE_URL}${endpoint}`);
4
+ if (qs) {
5
+ for (const [k, v] of Object.entries(qs)) {
6
+ if (v !== undefined && v !== null)
7
+ url.searchParams.set(k, String(v));
8
+ }
9
+ }
10
+ const opts = {
11
+ method,
12
+ headers: {
13
+ Authorization: `Bot ${botToken}`,
14
+ "Content-Type": "application/json",
15
+ },
16
+ };
17
+ if (body && Object.keys(body).length > 0 && method !== "GET" && method !== "DELETE") {
18
+ opts.body = JSON.stringify(body);
19
+ }
20
+ const res = await fetch(url.toString(), opts);
21
+ if (!res.ok)
22
+ throw new Error(`Discord API error ${res.status}: ${await res.text()}`);
23
+ if (res.status === 204)
24
+ return { success: true };
25
+ return res.json();
26
+ }
27
+ function getConn(ctx) {
28
+ return {
29
+ botToken: ctx.connection.config.botToken,
30
+ guildId: ctx.connection.config.guildId,
31
+ };
32
+ }
33
+ export default function discord(rl) {
34
+ rl.setName("discord");
35
+ rl.setVersion("0.1.0");
36
+ rl.setConnectionSchema({
37
+ botToken: { type: "string", required: true, description: "Discord bot token", env: "DISCORD_BOT_TOKEN" },
38
+ guildId: { type: "string", required: true, description: "Default guild (server) ID", env: "DISCORD_GUILD_ID" },
39
+ });
40
+ // ── Channel ─────────────────────────────────────────
41
+ rl.registerAction("channel.create", {
42
+ description: "Create a channel in the guild",
43
+ inputSchema: {
44
+ name: { type: "string", required: true, description: "Channel name" },
45
+ type: { type: "number", required: false, description: "Type: 0=text (default), 2=voice, 4=category" },
46
+ topic: { type: "string", required: false, description: "Channel topic (0-1024 chars)" },
47
+ parentId: { type: "string", required: false, description: "Category ID to nest under" },
48
+ position: { type: "number", required: false, description: "Sorting position" },
49
+ nsfw: { type: "boolean", required: false, description: "Mark as NSFW" },
50
+ bitrate: { type: "number", required: false, description: "Bitrate for voice channels (8000-96000)" },
51
+ userLimit: { type: "number", required: false, description: "User limit for voice channels (0=no limit)" },
52
+ rateLimitPerUser: { type: "number", required: false, description: "Slowmode seconds" },
53
+ },
54
+ async execute(input, ctx) {
55
+ const { botToken, guildId } = getConn(ctx);
56
+ const { name, type, topic, parentId, position, nsfw, bitrate, userLimit, rateLimitPerUser } = input;
57
+ const body = { name, type: type ?? 0 };
58
+ if (topic)
59
+ body.topic = topic;
60
+ if (parentId)
61
+ body.parent_id = parentId;
62
+ if (position !== undefined)
63
+ body.position = position;
64
+ if (nsfw !== undefined)
65
+ body.nsfw = nsfw;
66
+ if (bitrate !== undefined)
67
+ body.bitrate = bitrate;
68
+ if (userLimit !== undefined)
69
+ body.user_limit = userLimit;
70
+ if (rateLimitPerUser !== undefined)
71
+ body.rate_limit_per_user = rateLimitPerUser;
72
+ return apiRequest(botToken, "POST", `/guilds/${guildId}/channels`, body);
73
+ },
74
+ });
75
+ rl.registerAction("channel.get", {
76
+ description: "Get a channel by ID",
77
+ inputSchema: { channelId: { type: "string", required: true, description: "Channel ID" } },
78
+ async execute(input, ctx) {
79
+ const { botToken } = getConn(ctx);
80
+ return apiRequest(botToken, "GET", `/channels/${input.channelId}`);
81
+ },
82
+ });
83
+ rl.registerAction("channel.list", {
84
+ description: "List all channels in the guild",
85
+ inputSchema: {
86
+ limit: { type: "number", required: false, description: "Max results" },
87
+ filterType: { type: "array", required: false, description: "Filter by type numbers [0,2,4]" },
88
+ },
89
+ async execute(input, ctx) {
90
+ const { botToken, guildId } = getConn(ctx);
91
+ const { limit, filterType } = (input ?? {});
92
+ let channels = (await apiRequest(botToken, "GET", `/guilds/${guildId}/channels`));
93
+ if (filterType && Array.isArray(filterType) && filterType.length > 0) {
94
+ channels = channels.filter((c) => filterType.includes(c.type));
95
+ }
96
+ if (limit)
97
+ channels = channels.slice(0, limit);
98
+ return channels;
99
+ },
100
+ });
101
+ rl.registerAction("channel.update", {
102
+ description: "Update a channel",
103
+ inputSchema: {
104
+ channelId: { type: "string", required: true, description: "Channel ID" },
105
+ name: { type: "string", required: false, description: "New name" },
106
+ topic: { type: "string", required: false, description: "New topic" },
107
+ parentId: { type: "string", required: false, description: "New category ID" },
108
+ position: { type: "number", required: false, description: "New position" },
109
+ nsfw: { type: "boolean", required: false, description: "NSFW flag" },
110
+ bitrate: { type: "number", required: false, description: "Bitrate (voice)" },
111
+ userLimit: { type: "number", required: false, description: "User limit (voice)" },
112
+ rateLimitPerUser: { type: "number", required: false, description: "Slowmode seconds" },
113
+ },
114
+ async execute(input, ctx) {
115
+ const { botToken } = getConn(ctx);
116
+ const { channelId, name, topic, parentId, position, nsfw, bitrate, userLimit, rateLimitPerUser } = input;
117
+ const body = {};
118
+ if (name)
119
+ body.name = name;
120
+ if (topic !== undefined)
121
+ body.topic = topic;
122
+ if (parentId)
123
+ body.parent_id = parentId;
124
+ if (position !== undefined)
125
+ body.position = position;
126
+ if (nsfw !== undefined)
127
+ body.nsfw = nsfw;
128
+ if (bitrate !== undefined)
129
+ body.bitrate = bitrate;
130
+ if (userLimit !== undefined)
131
+ body.user_limit = userLimit;
132
+ if (rateLimitPerUser !== undefined)
133
+ body.rate_limit_per_user = rateLimitPerUser;
134
+ return apiRequest(botToken, "PATCH", `/channels/${channelId}`, body);
135
+ },
136
+ });
137
+ rl.registerAction("channel.delete", {
138
+ description: "Delete a channel",
139
+ inputSchema: { channelId: { type: "string", required: true, description: "Channel ID" } },
140
+ async execute(input, ctx) {
141
+ const { botToken } = getConn(ctx);
142
+ return apiRequest(botToken, "DELETE", `/channels/${input.channelId}`);
143
+ },
144
+ });
145
+ // ── Member ──────────────────────────────────────────
146
+ rl.registerAction("member.list", {
147
+ description: "List members in the guild",
148
+ inputSchema: {
149
+ limit: { type: "number", required: false, description: "Max results (default: 100, max: 1000)" },
150
+ after: { type: "string", required: false, description: "Fetch members after this user ID (pagination)" },
151
+ },
152
+ async execute(input, ctx) {
153
+ const { botToken, guildId } = getConn(ctx);
154
+ const { limit, after } = (input ?? {});
155
+ const qs = {};
156
+ if (limit)
157
+ qs.limit = limit;
158
+ if (after)
159
+ qs.after = after;
160
+ return apiRequest(botToken, "GET", `/guilds/${guildId}/members`, undefined, qs);
161
+ },
162
+ });
163
+ rl.registerAction("member.addRole", {
164
+ description: "Add a role to a guild member",
165
+ inputSchema: {
166
+ userId: { type: "string", required: true, description: "User ID" },
167
+ roleId: { type: "string", required: true, description: "Role ID" },
168
+ },
169
+ async execute(input, ctx) {
170
+ const { botToken, guildId } = getConn(ctx);
171
+ const { userId, roleId } = input;
172
+ await apiRequest(botToken, "PUT", `/guilds/${guildId}/members/${userId}/roles/${roleId}`);
173
+ return { success: true };
174
+ },
175
+ });
176
+ rl.registerAction("member.removeRole", {
177
+ description: "Remove a role from a guild member",
178
+ inputSchema: {
179
+ userId: { type: "string", required: true, description: "User ID" },
180
+ roleId: { type: "string", required: true, description: "Role ID" },
181
+ },
182
+ async execute(input, ctx) {
183
+ const { botToken, guildId } = getConn(ctx);
184
+ const { userId, roleId } = input;
185
+ await apiRequest(botToken, "DELETE", `/guilds/${guildId}/members/${userId}/roles/${roleId}`);
186
+ return { success: true };
187
+ },
188
+ });
189
+ // ── Message ─────────────────────────────────────────
190
+ rl.registerAction("message.send", {
191
+ description: "Send a message to a channel",
192
+ inputSchema: {
193
+ channelId: { type: "string", required: true, description: "Channel ID" },
194
+ content: { type: "string", required: true, description: "Message content (up to 2000 chars)" },
195
+ tts: { type: "boolean", required: false, description: "Text-to-speech" },
196
+ replyTo: { type: "string", required: false, description: "Message ID to reply to" },
197
+ embeds: { type: "array", required: false, description: "Array of embed objects" },
198
+ },
199
+ async execute(input, ctx) {
200
+ const { botToken } = getConn(ctx);
201
+ const { channelId, content, tts, replyTo, embeds } = input;
202
+ const body = { content };
203
+ if (tts)
204
+ body.tts = true;
205
+ if (replyTo)
206
+ body.message_reference = { message_id: replyTo };
207
+ if (embeds)
208
+ body.embeds = embeds;
209
+ return apiRequest(botToken, "POST", `/channels/${channelId}/messages`, body);
210
+ },
211
+ });
212
+ rl.registerAction("message.get", {
213
+ description: "Get a message by ID",
214
+ inputSchema: {
215
+ channelId: { type: "string", required: true, description: "Channel ID" },
216
+ messageId: { type: "string", required: true, description: "Message ID" },
217
+ },
218
+ async execute(input, ctx) {
219
+ const { botToken } = getConn(ctx);
220
+ const { channelId, messageId } = input;
221
+ return apiRequest(botToken, "GET", `/channels/${channelId}/messages/${messageId}`);
222
+ },
223
+ });
224
+ rl.registerAction("message.list", {
225
+ description: "List messages in a channel",
226
+ inputSchema: {
227
+ channelId: { type: "string", required: true, description: "Channel ID" },
228
+ limit: { type: "number", required: false, description: "Max results (default: 50, max: 100)" },
229
+ before: { type: "string", required: false, description: "Get messages before this ID" },
230
+ after: { type: "string", required: false, description: "Get messages after this ID" },
231
+ around: { type: "string", required: false, description: "Get messages around this ID" },
232
+ },
233
+ async execute(input, ctx) {
234
+ const { botToken } = getConn(ctx);
235
+ const { channelId, limit, before, after, around } = (input ?? {});
236
+ const qs = {};
237
+ if (limit)
238
+ qs.limit = limit;
239
+ if (before)
240
+ qs.before = before;
241
+ if (after)
242
+ qs.after = after;
243
+ if (around)
244
+ qs.around = around;
245
+ return apiRequest(botToken, "GET", `/channels/${channelId}/messages`, undefined, qs);
246
+ },
247
+ });
248
+ rl.registerAction("message.delete", {
249
+ description: "Delete a message",
250
+ inputSchema: {
251
+ channelId: { type: "string", required: true, description: "Channel ID" },
252
+ messageId: { type: "string", required: true, description: "Message ID" },
253
+ },
254
+ async execute(input, ctx) {
255
+ const { botToken } = getConn(ctx);
256
+ const { channelId, messageId } = input;
257
+ await apiRequest(botToken, "DELETE", `/channels/${channelId}/messages/${messageId}`);
258
+ return { success: true };
259
+ },
260
+ });
261
+ rl.registerAction("message.react", {
262
+ description: "Add a reaction to a message",
263
+ inputSchema: {
264
+ channelId: { type: "string", required: true, description: "Channel ID" },
265
+ messageId: { type: "string", required: true, description: "Message ID" },
266
+ emoji: { type: "string", required: true, description: "Emoji to react with (Unicode or name:id for custom)" },
267
+ },
268
+ async execute(input, ctx) {
269
+ const { botToken } = getConn(ctx);
270
+ const { channelId, messageId, emoji } = input;
271
+ await apiRequest(botToken, "PUT", `/channels/${channelId}/messages/${messageId}/reactions/${encodeURIComponent(emoji)}/@me`);
272
+ return { success: true };
273
+ },
274
+ });
275
+ }