@furlow/builtins 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.
- package/dist/afk/index.d.ts +21 -0
- package/dist/afk/index.js +195 -0
- package/dist/afk/index.js.map +1 -0
- package/dist/auto-responder/index.d.ts +21 -0
- package/dist/auto-responder/index.js +356 -0
- package/dist/auto-responder/index.js.map +1 -0
- package/dist/giveaways/index.d.ts +25 -0
- package/dist/giveaways/index.js +416 -0
- package/dist/giveaways/index.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +5402 -0
- package/dist/index.js.map +1 -0
- package/dist/leveling/index.d.ts +46 -0
- package/dist/leveling/index.js +521 -0
- package/dist/leveling/index.js.map +1 -0
- package/dist/logging/index.d.ts +52 -0
- package/dist/logging/index.js +519 -0
- package/dist/logging/index.js.map +1 -0
- package/dist/moderation/index.d.ts +83 -0
- package/dist/moderation/index.js +221 -0
- package/dist/moderation/index.js.map +1 -0
- package/dist/music/index.d.ts +33 -0
- package/dist/music/index.js +414 -0
- package/dist/music/index.js.map +1 -0
- package/dist/polls/index.d.ts +21 -0
- package/dist/polls/index.js +395 -0
- package/dist/polls/index.js.map +1 -0
- package/dist/reaction-roles/index.d.ts +19 -0
- package/dist/reaction-roles/index.js +551 -0
- package/dist/reaction-roles/index.js.map +1 -0
- package/dist/reminders/index.d.ts +23 -0
- package/dist/reminders/index.js +224 -0
- package/dist/reminders/index.js.map +1 -0
- package/dist/starboard/index.d.ts +35 -0
- package/dist/starboard/index.js +401 -0
- package/dist/starboard/index.js.map +1 -0
- package/dist/tickets/index.d.ts +43 -0
- package/dist/tickets/index.js +614 -0
- package/dist/tickets/index.js.map +1 -0
- package/dist/utilities/index.d.ts +15 -0
- package/dist/utilities/index.js +299 -0
- package/dist/utilities/index.js.map +1 -0
- package/dist/welcome/index.d.ts +48 -0
- package/dist/welcome/index.js +302 -0
- package/dist/welcome/index.js.map +1 -0
- package/package.json +109 -0
|
@@ -0,0 +1,551 @@
|
|
|
1
|
+
// src/reaction-roles/index.ts
|
|
2
|
+
var reactionRolesTables = {
|
|
3
|
+
reaction_role_panels: {
|
|
4
|
+
columns: {
|
|
5
|
+
id: { type: "number", primary: true },
|
|
6
|
+
guild_id: { type: "string", index: true },
|
|
7
|
+
channel_id: { type: "string" },
|
|
8
|
+
message_id: { type: "string", unique: true },
|
|
9
|
+
type: { type: "string" },
|
|
10
|
+
// 'button', 'reaction', 'select'
|
|
11
|
+
mode: { type: "string", default: "toggle" },
|
|
12
|
+
// 'toggle', 'give', 'take', 'unique'
|
|
13
|
+
max_roles: { type: "number" },
|
|
14
|
+
created_at: { type: "timestamp" }
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
reaction_role_entries: {
|
|
18
|
+
columns: {
|
|
19
|
+
id: { type: "number", primary: true },
|
|
20
|
+
panel_id: { type: "number", index: true },
|
|
21
|
+
role_id: { type: "string" },
|
|
22
|
+
emoji: { type: "string" },
|
|
23
|
+
label: { type: "string" },
|
|
24
|
+
description: { type: "string" },
|
|
25
|
+
style: { type: "string" }
|
|
26
|
+
// button style
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
var reactionRolesEventHandlers = [
|
|
31
|
+
// Handle button clicks
|
|
32
|
+
{
|
|
33
|
+
event: "button_click",
|
|
34
|
+
condition: '${interaction.customId.startsWith("rr_")}',
|
|
35
|
+
actions: [
|
|
36
|
+
{
|
|
37
|
+
action: "set",
|
|
38
|
+
key: "roleId",
|
|
39
|
+
value: '${interaction.customId.replace("rr_", "")}'
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
action: "db_query",
|
|
43
|
+
table: "reaction_role_panels",
|
|
44
|
+
where: { message_id: "${interaction.message.id}" },
|
|
45
|
+
as: "panel"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
action: "flow_if",
|
|
49
|
+
condition: "${!panel[0]}",
|
|
50
|
+
then: [
|
|
51
|
+
{ action: "reply", content: "This role panel is no longer valid.", ephemeral: true },
|
|
52
|
+
{ action: "abort" }
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
action: "set",
|
|
57
|
+
key: "hasRole",
|
|
58
|
+
value: "${member.roles.cache.has(roleId)}"
|
|
59
|
+
},
|
|
60
|
+
// Handle based on mode
|
|
61
|
+
{
|
|
62
|
+
action: "flow_switch",
|
|
63
|
+
value: "${panel[0].mode}",
|
|
64
|
+
cases: {
|
|
65
|
+
toggle: [
|
|
66
|
+
{
|
|
67
|
+
action: "flow_if",
|
|
68
|
+
condition: "${hasRole}",
|
|
69
|
+
then: [
|
|
70
|
+
{ action: "remove_role", user: "${member.id}", role: "${roleId}" },
|
|
71
|
+
{ action: "reply", content: "Removed <@&${roleId}>", ephemeral: true }
|
|
72
|
+
],
|
|
73
|
+
else: [
|
|
74
|
+
{ action: "assign_role", user: "${member.id}", role: "${roleId}" },
|
|
75
|
+
{ action: "reply", content: "Added <@&${roleId}>", ephemeral: true }
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
give: [
|
|
80
|
+
{
|
|
81
|
+
action: "flow_if",
|
|
82
|
+
condition: "${hasRole}",
|
|
83
|
+
then: [
|
|
84
|
+
{ action: "reply", content: "You already have <@&${roleId}>", ephemeral: true }
|
|
85
|
+
],
|
|
86
|
+
else: [
|
|
87
|
+
{ action: "assign_role", user: "${member.id}", role: "${roleId}" },
|
|
88
|
+
{ action: "reply", content: "Added <@&${roleId}>", ephemeral: true }
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
take: [
|
|
93
|
+
{
|
|
94
|
+
action: "flow_if",
|
|
95
|
+
condition: "${!hasRole}",
|
|
96
|
+
then: [
|
|
97
|
+
{ action: "reply", content: "You don't have <@&${roleId}>", ephemeral: true }
|
|
98
|
+
],
|
|
99
|
+
else: [
|
|
100
|
+
{ action: "remove_role", user: "${member.id}", role: "${roleId}" },
|
|
101
|
+
{ action: "reply", content: "Removed <@&${roleId}>", ephemeral: true }
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
unique: [
|
|
106
|
+
// Remove other roles from this panel first
|
|
107
|
+
{
|
|
108
|
+
action: "db_query",
|
|
109
|
+
table: "reaction_role_entries",
|
|
110
|
+
where: { panel_id: "${panel[0].id}" },
|
|
111
|
+
as: "entries"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
action: "batch",
|
|
115
|
+
items: "${entries.filter(e => e.role_id !== roleId && member.roles.cache.has(e.role_id))}",
|
|
116
|
+
each: { action: "remove_role", user: "${member.id}", role: "${item.role_id}" }
|
|
117
|
+
},
|
|
118
|
+
{ action: "assign_role", user: "${member.id}", role: "${roleId}" },
|
|
119
|
+
{ action: "reply", content: "Set role to <@&${roleId}>", ephemeral: true }
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
// Log if configured
|
|
124
|
+
{
|
|
125
|
+
action: "flow_if",
|
|
126
|
+
condition: "${config.reactionRoles?.logChannel}",
|
|
127
|
+
then: [
|
|
128
|
+
{
|
|
129
|
+
action: "send_message",
|
|
130
|
+
channel: "${config.reactionRoles.logChannel}",
|
|
131
|
+
embed: {
|
|
132
|
+
description: '${member} ${hasRole ? "removed" : "added"} <@&${roleId}>',
|
|
133
|
+
color: '${hasRole ? "#ed4245" : "#57f287"}',
|
|
134
|
+
timestamp: "${now()}"
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
]
|
|
140
|
+
},
|
|
141
|
+
// Handle select menu
|
|
142
|
+
{
|
|
143
|
+
event: "select_menu",
|
|
144
|
+
condition: '${interaction.customId.startsWith("rr_select_")}',
|
|
145
|
+
actions: [
|
|
146
|
+
{
|
|
147
|
+
action: "set",
|
|
148
|
+
key: "panelId",
|
|
149
|
+
value: '${interaction.customId.replace("rr_select_", "")}'
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
action: "db_query",
|
|
153
|
+
table: "reaction_role_panels",
|
|
154
|
+
where: { id: "${panelId}" },
|
|
155
|
+
as: "panel"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
action: "db_query",
|
|
159
|
+
table: "reaction_role_entries",
|
|
160
|
+
where: { panel_id: "${panelId}" },
|
|
161
|
+
as: "entries"
|
|
162
|
+
},
|
|
163
|
+
// Get selected role IDs
|
|
164
|
+
{
|
|
165
|
+
action: "set",
|
|
166
|
+
key: "selectedRoles",
|
|
167
|
+
value: "${interaction.values}"
|
|
168
|
+
},
|
|
169
|
+
// Remove roles not selected
|
|
170
|
+
{
|
|
171
|
+
action: "batch",
|
|
172
|
+
items: "${entries.filter(e => !selectedRoles.includes(e.role_id) && member.roles.cache.has(e.role_id))}",
|
|
173
|
+
each: { action: "remove_role", user: "${member.id}", role: "${item.role_id}" }
|
|
174
|
+
},
|
|
175
|
+
// Add selected roles
|
|
176
|
+
{
|
|
177
|
+
action: "batch",
|
|
178
|
+
items: "${selectedRoles.filter(r => !member.roles.cache.has(r))}",
|
|
179
|
+
each: { action: "assign_role", user: "${member.id}", role: "${item}" }
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
action: "reply",
|
|
183
|
+
content: "Roles updated!",
|
|
184
|
+
ephemeral: true
|
|
185
|
+
}
|
|
186
|
+
]
|
|
187
|
+
},
|
|
188
|
+
// Handle reactions
|
|
189
|
+
{
|
|
190
|
+
event: "reaction_add",
|
|
191
|
+
actions: [
|
|
192
|
+
{
|
|
193
|
+
action: "db_query",
|
|
194
|
+
table: "reaction_role_panels",
|
|
195
|
+
where: { message_id: "${message.id}", type: "reaction" },
|
|
196
|
+
as: "panel"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
action: "flow_if",
|
|
200
|
+
condition: "${panel[0]}",
|
|
201
|
+
then: [
|
|
202
|
+
{
|
|
203
|
+
action: "db_query",
|
|
204
|
+
table: "reaction_role_entries",
|
|
205
|
+
where: { panel_id: "${panel[0].id}", emoji: "${reaction.emoji.name || reaction.emoji.id}" },
|
|
206
|
+
as: "entry"
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
action: "flow_if",
|
|
210
|
+
condition: "${entry[0]}",
|
|
211
|
+
then: [
|
|
212
|
+
{ action: "assign_role", user: "${user.id}", role: "${entry[0].role_id}" }
|
|
213
|
+
]
|
|
214
|
+
}
|
|
215
|
+
]
|
|
216
|
+
}
|
|
217
|
+
]
|
|
218
|
+
},
|
|
219
|
+
// Handle reaction remove
|
|
220
|
+
{
|
|
221
|
+
event: "reaction_remove",
|
|
222
|
+
actions: [
|
|
223
|
+
{
|
|
224
|
+
action: "db_query",
|
|
225
|
+
table: "reaction_role_panels",
|
|
226
|
+
where: { message_id: "${message.id}", type: "reaction" },
|
|
227
|
+
as: "panel"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
action: "flow_if",
|
|
231
|
+
condition: '${panel[0] && panel[0].mode !== "give"}',
|
|
232
|
+
then: [
|
|
233
|
+
{
|
|
234
|
+
action: "db_query",
|
|
235
|
+
table: "reaction_role_entries",
|
|
236
|
+
where: { panel_id: "${panel[0].id}", emoji: "${reaction.emoji.name || reaction.emoji.id}" },
|
|
237
|
+
as: "entry"
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
action: "flow_if",
|
|
241
|
+
condition: "${entry[0]}",
|
|
242
|
+
then: [
|
|
243
|
+
{ action: "remove_role", user: "${user.id}", role: "${entry[0].role_id}" }
|
|
244
|
+
]
|
|
245
|
+
}
|
|
246
|
+
]
|
|
247
|
+
}
|
|
248
|
+
]
|
|
249
|
+
}
|
|
250
|
+
];
|
|
251
|
+
var reactionRolesCommands = [
|
|
252
|
+
{
|
|
253
|
+
name: "reactionroles",
|
|
254
|
+
description: "Reaction roles management",
|
|
255
|
+
subcommands: [
|
|
256
|
+
{
|
|
257
|
+
name: "create-button",
|
|
258
|
+
description: "Create a button role panel",
|
|
259
|
+
options: [
|
|
260
|
+
{ name: "title", description: "Panel title", type: "string", required: false },
|
|
261
|
+
{ name: "description", description: "Panel description", type: "string", required: false },
|
|
262
|
+
{ name: "mode", description: "Role mode", type: "string", required: false, choices: [
|
|
263
|
+
{ name: "Toggle (add/remove)", value: "toggle" },
|
|
264
|
+
{ name: "Give only", value: "give" },
|
|
265
|
+
{ name: "Take only", value: "take" },
|
|
266
|
+
{ name: "Unique (one at a time)", value: "unique" }
|
|
267
|
+
] }
|
|
268
|
+
],
|
|
269
|
+
actions: [
|
|
270
|
+
{
|
|
271
|
+
action: "send_message",
|
|
272
|
+
channel: "${channel.id}",
|
|
273
|
+
embed: {
|
|
274
|
+
title: '${args.title || "Role Selection"}',
|
|
275
|
+
description: '${args.description || "Click a button to get a role!"}',
|
|
276
|
+
color: "#5865f2"
|
|
277
|
+
},
|
|
278
|
+
as: "panelMessage"
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
action: "db_insert",
|
|
282
|
+
table: "reaction_role_panels",
|
|
283
|
+
data: {
|
|
284
|
+
guild_id: "${guild.id}",
|
|
285
|
+
channel_id: "${channel.id}",
|
|
286
|
+
message_id: "${panelMessage.id}",
|
|
287
|
+
type: "button",
|
|
288
|
+
mode: '${args.mode || "toggle"}',
|
|
289
|
+
created_at: "${now()}"
|
|
290
|
+
},
|
|
291
|
+
as: "panel"
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
action: "reply",
|
|
295
|
+
content: "Button role panel created! Use `/reactionroles add-button` to add roles.\nPanel ID: ${panel.id}",
|
|
296
|
+
ephemeral: true
|
|
297
|
+
}
|
|
298
|
+
]
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
name: "add-button",
|
|
302
|
+
description: "Add a button to a role panel",
|
|
303
|
+
options: [
|
|
304
|
+
{ name: "message_id", description: "Panel message ID", type: "string", required: true },
|
|
305
|
+
{ name: "role", description: "Role to assign", type: "role", required: true },
|
|
306
|
+
{ name: "label", description: "Button label", type: "string", required: false },
|
|
307
|
+
{ name: "emoji", description: "Button emoji", type: "string", required: false },
|
|
308
|
+
{ name: "style", description: "Button style", type: "string", required: false, choices: [
|
|
309
|
+
{ name: "Blue (Primary)", value: "primary" },
|
|
310
|
+
{ name: "Gray (Secondary)", value: "secondary" },
|
|
311
|
+
{ name: "Green (Success)", value: "success" },
|
|
312
|
+
{ name: "Red (Danger)", value: "danger" }
|
|
313
|
+
] }
|
|
314
|
+
],
|
|
315
|
+
actions: [
|
|
316
|
+
{
|
|
317
|
+
action: "db_query",
|
|
318
|
+
table: "reaction_role_panels",
|
|
319
|
+
where: { message_id: "${args.message_id}" },
|
|
320
|
+
as: "panel"
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
action: "flow_if",
|
|
324
|
+
condition: "${!panel[0]}",
|
|
325
|
+
then: [
|
|
326
|
+
{ action: "reply", content: "Panel not found!", ephemeral: true },
|
|
327
|
+
{ action: "abort" }
|
|
328
|
+
]
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
action: "db_insert",
|
|
332
|
+
table: "reaction_role_entries",
|
|
333
|
+
data: {
|
|
334
|
+
panel_id: "${panel[0].id}",
|
|
335
|
+
role_id: "${args.role.id}",
|
|
336
|
+
label: "${args.label || args.role.name}",
|
|
337
|
+
emoji: "${args.emoji}",
|
|
338
|
+
style: '${args.style || "primary"}'
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
// Get all entries for this panel
|
|
342
|
+
{
|
|
343
|
+
action: "db_query",
|
|
344
|
+
table: "reaction_role_entries",
|
|
345
|
+
where: { panel_id: "${panel[0].id}" },
|
|
346
|
+
as: "entries"
|
|
347
|
+
},
|
|
348
|
+
// Build components
|
|
349
|
+
{
|
|
350
|
+
action: "set",
|
|
351
|
+
key: "buttons",
|
|
352
|
+
value: '${entries.map(e => ({ type: "button", style: e.style, label: e.label, emoji: e.emoji, custom_id: "rr_" + e.role_id }))}'
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
action: "set",
|
|
356
|
+
key: "rows",
|
|
357
|
+
value: '${chunk(buttons, 5).map(row => ({ type: "action_row", components: row }))}'
|
|
358
|
+
},
|
|
359
|
+
// Update message
|
|
360
|
+
{
|
|
361
|
+
action: "edit_message",
|
|
362
|
+
channel: "${panel[0].channel_id}",
|
|
363
|
+
message: "${panel[0].message_id}",
|
|
364
|
+
components: "${rows}"
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
action: "reply",
|
|
368
|
+
content: "Added ${args.role.name} to the panel!",
|
|
369
|
+
ephemeral: true
|
|
370
|
+
}
|
|
371
|
+
]
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
name: "create-select",
|
|
375
|
+
description: "Create a select menu role panel",
|
|
376
|
+
options: [
|
|
377
|
+
{ name: "title", description: "Panel title", type: "string", required: false },
|
|
378
|
+
{ name: "description", description: "Panel description", type: "string", required: false },
|
|
379
|
+
{ name: "max_roles", description: "Maximum roles that can be selected", type: "integer", required: false }
|
|
380
|
+
],
|
|
381
|
+
actions: [
|
|
382
|
+
{
|
|
383
|
+
action: "send_message",
|
|
384
|
+
channel: "${channel.id}",
|
|
385
|
+
embed: {
|
|
386
|
+
title: '${args.title || "Role Selection"}',
|
|
387
|
+
description: '${args.description || "Select your roles from the menu below!"}',
|
|
388
|
+
color: "#5865f2"
|
|
389
|
+
},
|
|
390
|
+
as: "panelMessage"
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
action: "db_insert",
|
|
394
|
+
table: "reaction_role_panels",
|
|
395
|
+
data: {
|
|
396
|
+
guild_id: "${guild.id}",
|
|
397
|
+
channel_id: "${channel.id}",
|
|
398
|
+
message_id: "${panelMessage.id}",
|
|
399
|
+
type: "select",
|
|
400
|
+
mode: "toggle",
|
|
401
|
+
max_roles: "${args.max_roles}",
|
|
402
|
+
created_at: "${now()}"
|
|
403
|
+
},
|
|
404
|
+
as: "panel"
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
action: "reply",
|
|
408
|
+
content: "Select menu role panel created! Use `/reactionroles add-option` to add roles.\nPanel ID: ${panel.id}",
|
|
409
|
+
ephemeral: true
|
|
410
|
+
}
|
|
411
|
+
]
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
name: "add-option",
|
|
415
|
+
description: "Add an option to a select menu panel",
|
|
416
|
+
options: [
|
|
417
|
+
{ name: "message_id", description: "Panel message ID", type: "string", required: true },
|
|
418
|
+
{ name: "role", description: "Role to assign", type: "role", required: true },
|
|
419
|
+
{ name: "label", description: "Option label", type: "string", required: false },
|
|
420
|
+
{ name: "description", description: "Option description", type: "string", required: false },
|
|
421
|
+
{ name: "emoji", description: "Option emoji", type: "string", required: false }
|
|
422
|
+
],
|
|
423
|
+
actions: [
|
|
424
|
+
{
|
|
425
|
+
action: "db_query",
|
|
426
|
+
table: "reaction_role_panels",
|
|
427
|
+
where: { message_id: "${args.message_id}", type: "select" },
|
|
428
|
+
as: "panel"
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
action: "flow_if",
|
|
432
|
+
condition: "${!panel[0]}",
|
|
433
|
+
then: [
|
|
434
|
+
{ action: "reply", content: "Select menu panel not found!", ephemeral: true },
|
|
435
|
+
{ action: "abort" }
|
|
436
|
+
]
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
action: "db_insert",
|
|
440
|
+
table: "reaction_role_entries",
|
|
441
|
+
data: {
|
|
442
|
+
panel_id: "${panel[0].id}",
|
|
443
|
+
role_id: "${args.role.id}",
|
|
444
|
+
label: "${args.label || args.role.name}",
|
|
445
|
+
description: "${args.description}",
|
|
446
|
+
emoji: "${args.emoji}"
|
|
447
|
+
}
|
|
448
|
+
},
|
|
449
|
+
// Get all entries for this panel
|
|
450
|
+
{
|
|
451
|
+
action: "db_query",
|
|
452
|
+
table: "reaction_role_entries",
|
|
453
|
+
where: { panel_id: "${panel[0].id}" },
|
|
454
|
+
as: "entries"
|
|
455
|
+
},
|
|
456
|
+
// Build select menu
|
|
457
|
+
{
|
|
458
|
+
action: "set",
|
|
459
|
+
key: "options",
|
|
460
|
+
value: "${entries.map(e => ({ label: e.label, value: e.role_id, description: e.description, emoji: e.emoji }))}"
|
|
461
|
+
},
|
|
462
|
+
// Update message
|
|
463
|
+
{
|
|
464
|
+
action: "edit_message",
|
|
465
|
+
channel: "${panel[0].channel_id}",
|
|
466
|
+
message: "${panel[0].message_id}",
|
|
467
|
+
components: [
|
|
468
|
+
{
|
|
469
|
+
type: "action_row",
|
|
470
|
+
components: [
|
|
471
|
+
{
|
|
472
|
+
type: "select_menu",
|
|
473
|
+
custom_id: "rr_select_${panel[0].id}",
|
|
474
|
+
placeholder: "Select roles...",
|
|
475
|
+
min_values: 0,
|
|
476
|
+
max_values: "${panel[0].max_roles || entries.length}",
|
|
477
|
+
options: "${options}"
|
|
478
|
+
}
|
|
479
|
+
]
|
|
480
|
+
}
|
|
481
|
+
]
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
action: "reply",
|
|
485
|
+
content: "Added ${args.role.name} to the panel!",
|
|
486
|
+
ephemeral: true
|
|
487
|
+
}
|
|
488
|
+
]
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
name: "delete",
|
|
492
|
+
description: "Delete a role panel",
|
|
493
|
+
options: [
|
|
494
|
+
{ name: "message_id", description: "Panel message ID", type: "string", required: true }
|
|
495
|
+
],
|
|
496
|
+
actions: [
|
|
497
|
+
{
|
|
498
|
+
action: "db_query",
|
|
499
|
+
table: "reaction_role_panels",
|
|
500
|
+
where: { message_id: "${args.message_id}" },
|
|
501
|
+
as: "panel"
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
action: "flow_if",
|
|
505
|
+
condition: "${!panel[0]}",
|
|
506
|
+
then: [
|
|
507
|
+
{ action: "reply", content: "Panel not found!", ephemeral: true },
|
|
508
|
+
{ action: "abort" }
|
|
509
|
+
]
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
action: "db_delete",
|
|
513
|
+
table: "reaction_role_entries",
|
|
514
|
+
where: { panel_id: "${panel[0].id}" }
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
action: "db_delete",
|
|
518
|
+
table: "reaction_role_panels",
|
|
519
|
+
where: { id: "${panel[0].id}" }
|
|
520
|
+
},
|
|
521
|
+
{
|
|
522
|
+
action: "delete_message",
|
|
523
|
+
channel: "${panel[0].channel_id}",
|
|
524
|
+
message: "${panel[0].message_id}"
|
|
525
|
+
},
|
|
526
|
+
{
|
|
527
|
+
action: "reply",
|
|
528
|
+
content: "Panel deleted!",
|
|
529
|
+
ephemeral: true
|
|
530
|
+
}
|
|
531
|
+
]
|
|
532
|
+
}
|
|
533
|
+
]
|
|
534
|
+
}
|
|
535
|
+
];
|
|
536
|
+
function getReactionRolesSpec(config = {}) {
|
|
537
|
+
return {
|
|
538
|
+
events: reactionRolesEventHandlers,
|
|
539
|
+
commands: reactionRolesCommands,
|
|
540
|
+
state: {
|
|
541
|
+
tables: reactionRolesTables
|
|
542
|
+
}
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
export {
|
|
546
|
+
getReactionRolesSpec,
|
|
547
|
+
reactionRolesCommands,
|
|
548
|
+
reactionRolesEventHandlers,
|
|
549
|
+
reactionRolesTables
|
|
550
|
+
};
|
|
551
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/reaction-roles/index.ts"],"sourcesContent":["/**\n * Reaction Roles builtin module\n * Handles button roles, reaction roles, and select menu roles\n */\n\nimport type { FurlowSpec, CommandDefinition, EventHandler, TableDefinition } from '@furlow/schema';\n\nexport interface ReactionRolesConfig {\n /** Maximum roles a user can have from a single panel */\n maxRolesPerPanel?: number;\n /** Log channel for role assignments */\n logChannel?: string;\n}\n\nexport const reactionRolesTables: Record<string, TableDefinition> = {\n reaction_role_panels: {\n columns: {\n id: { type: 'number', primary: true },\n guild_id: { type: 'string', index: true },\n channel_id: { type: 'string' },\n message_id: { type: 'string', unique: true },\n type: { type: 'string' }, // 'button', 'reaction', 'select'\n mode: { type: 'string', default: 'toggle' }, // 'toggle', 'give', 'take', 'unique'\n max_roles: { type: 'number' },\n created_at: { type: 'timestamp' },\n },\n },\n reaction_role_entries: {\n columns: {\n id: { type: 'number', primary: true },\n panel_id: { type: 'number', index: true },\n role_id: { type: 'string' },\n emoji: { type: 'string' },\n label: { type: 'string' },\n description: { type: 'string' },\n style: { type: 'string' }, // button style\n },\n },\n};\n\nexport const reactionRolesEventHandlers: EventHandler[] = [\n // Handle button clicks\n {\n event: 'button_click',\n condition: '${interaction.customId.startsWith(\"rr_\")}',\n actions: [\n {\n action: 'set',\n key: 'roleId',\n value: '${interaction.customId.replace(\"rr_\", \"\")}',\n },\n {\n action: 'db_query',\n table: 'reaction_role_panels',\n where: { message_id: '${interaction.message.id}' },\n as: 'panel',\n },\n {\n action: 'flow_if',\n condition: '${!panel[0]}',\n then: [\n { action: 'reply', content: 'This role panel is no longer valid.', ephemeral: true },\n { action: 'abort' },\n ],\n },\n {\n action: 'set',\n key: 'hasRole',\n value: '${member.roles.cache.has(roleId)}',\n },\n // Handle based on mode\n {\n action: 'flow_switch',\n value: '${panel[0].mode}',\n cases: {\n toggle: [\n {\n action: 'flow_if',\n condition: '${hasRole}',\n then: [\n { action: 'remove_role', user: '${member.id}', role: '${roleId}' },\n { action: 'reply', content: 'Removed <@&${roleId}>', ephemeral: true },\n ],\n else: [\n { action: 'assign_role', user: '${member.id}', role: '${roleId}' },\n { action: 'reply', content: 'Added <@&${roleId}>', ephemeral: true },\n ],\n },\n ],\n give: [\n {\n action: 'flow_if',\n condition: '${hasRole}',\n then: [\n { action: 'reply', content: 'You already have <@&${roleId}>', ephemeral: true },\n ],\n else: [\n { action: 'assign_role', user: '${member.id}', role: '${roleId}' },\n { action: 'reply', content: 'Added <@&${roleId}>', ephemeral: true },\n ],\n },\n ],\n take: [\n {\n action: 'flow_if',\n condition: '${!hasRole}',\n then: [\n { action: 'reply', content: 'You don\\'t have <@&${roleId}>', ephemeral: true },\n ],\n else: [\n { action: 'remove_role', user: '${member.id}', role: '${roleId}' },\n { action: 'reply', content: 'Removed <@&${roleId}>', ephemeral: true },\n ],\n },\n ],\n unique: [\n // Remove other roles from this panel first\n {\n action: 'db_query',\n table: 'reaction_role_entries',\n where: { panel_id: '${panel[0].id}' },\n as: 'entries',\n },\n {\n action: 'batch',\n items: '${entries.filter(e => e.role_id !== roleId && member.roles.cache.has(e.role_id))}',\n each: { action: 'remove_role', user: '${member.id}', role: '${item.role_id}' },\n },\n { action: 'assign_role', user: '${member.id}', role: '${roleId}' },\n { action: 'reply', content: 'Set role to <@&${roleId}>', ephemeral: true },\n ],\n },\n },\n // Log if configured\n {\n action: 'flow_if',\n condition: '${config.reactionRoles?.logChannel}',\n then: [\n {\n action: 'send_message',\n channel: '${config.reactionRoles.logChannel}',\n embed: {\n description: '${member} ${hasRole ? \"removed\" : \"added\"} <@&${roleId}>',\n color: '${hasRole ? \"#ed4245\" : \"#57f287\"}',\n timestamp: '${now()}',\n },\n },\n ],\n },\n ],\n },\n // Handle select menu\n {\n event: 'select_menu',\n condition: '${interaction.customId.startsWith(\"rr_select_\")}',\n actions: [\n {\n action: 'set',\n key: 'panelId',\n value: '${interaction.customId.replace(\"rr_select_\", \"\")}',\n },\n {\n action: 'db_query',\n table: 'reaction_role_panels',\n where: { id: '${panelId}' },\n as: 'panel',\n },\n {\n action: 'db_query',\n table: 'reaction_role_entries',\n where: { panel_id: '${panelId}' },\n as: 'entries',\n },\n // Get selected role IDs\n {\n action: 'set',\n key: 'selectedRoles',\n value: '${interaction.values}',\n },\n // Remove roles not selected\n {\n action: 'batch',\n items: '${entries.filter(e => !selectedRoles.includes(e.role_id) && member.roles.cache.has(e.role_id))}',\n each: { action: 'remove_role', user: '${member.id}', role: '${item.role_id}' },\n },\n // Add selected roles\n {\n action: 'batch',\n items: '${selectedRoles.filter(r => !member.roles.cache.has(r))}',\n each: { action: 'assign_role', user: '${member.id}', role: '${item}' },\n },\n {\n action: 'reply',\n content: 'Roles updated!',\n ephemeral: true,\n },\n ],\n },\n // Handle reactions\n {\n event: 'reaction_add',\n actions: [\n {\n action: 'db_query',\n table: 'reaction_role_panels',\n where: { message_id: '${message.id}', type: 'reaction' },\n as: 'panel',\n },\n {\n action: 'flow_if',\n condition: '${panel[0]}',\n then: [\n {\n action: 'db_query',\n table: 'reaction_role_entries',\n where: { panel_id: '${panel[0].id}', emoji: '${reaction.emoji.name || reaction.emoji.id}' },\n as: 'entry',\n },\n {\n action: 'flow_if',\n condition: '${entry[0]}',\n then: [\n { action: 'assign_role', user: '${user.id}', role: '${entry[0].role_id}' },\n ],\n },\n ],\n },\n ],\n },\n // Handle reaction remove\n {\n event: 'reaction_remove',\n actions: [\n {\n action: 'db_query',\n table: 'reaction_role_panels',\n where: { message_id: '${message.id}', type: 'reaction' },\n as: 'panel',\n },\n {\n action: 'flow_if',\n condition: '${panel[0] && panel[0].mode !== \"give\"}',\n then: [\n {\n action: 'db_query',\n table: 'reaction_role_entries',\n where: { panel_id: '${panel[0].id}', emoji: '${reaction.emoji.name || reaction.emoji.id}' },\n as: 'entry',\n },\n {\n action: 'flow_if',\n condition: '${entry[0]}',\n then: [\n { action: 'remove_role', user: '${user.id}', role: '${entry[0].role_id}' },\n ],\n },\n ],\n },\n ],\n },\n];\n\nexport const reactionRolesCommands: CommandDefinition[] = [\n {\n name: 'reactionroles',\n description: 'Reaction roles management',\n subcommands: [\n {\n name: 'create-button',\n description: 'Create a button role panel',\n options: [\n { name: 'title', description: 'Panel title', type: 'string', required: false },\n { name: 'description', description: 'Panel description', type: 'string', required: false },\n { name: 'mode', description: 'Role mode', type: 'string', required: false, choices: [\n { name: 'Toggle (add/remove)', value: 'toggle' },\n { name: 'Give only', value: 'give' },\n { name: 'Take only', value: 'take' },\n { name: 'Unique (one at a time)', value: 'unique' },\n ]},\n ],\n actions: [\n {\n action: 'send_message',\n channel: '${channel.id}',\n embed: {\n title: '${args.title || \"Role Selection\"}',\n description: '${args.description || \"Click a button to get a role!\"}',\n color: '#5865f2',\n },\n as: 'panelMessage',\n },\n {\n action: 'db_insert',\n table: 'reaction_role_panels',\n data: {\n guild_id: '${guild.id}',\n channel_id: '${channel.id}',\n message_id: '${panelMessage.id}',\n type: 'button',\n mode: '${args.mode || \"toggle\"}',\n created_at: '${now()}',\n },\n as: 'panel',\n },\n {\n action: 'reply',\n content: 'Button role panel created! Use `/reactionroles add-button` to add roles.\\nPanel ID: ${panel.id}',\n ephemeral: true,\n },\n ],\n },\n {\n name: 'add-button',\n description: 'Add a button to a role panel',\n options: [\n { name: 'message_id', description: 'Panel message ID', type: 'string', required: true },\n { name: 'role', description: 'Role to assign', type: 'role', required: true },\n { name: 'label', description: 'Button label', type: 'string', required: false },\n { name: 'emoji', description: 'Button emoji', type: 'string', required: false },\n { name: 'style', description: 'Button style', type: 'string', required: false, choices: [\n { name: 'Blue (Primary)', value: 'primary' },\n { name: 'Gray (Secondary)', value: 'secondary' },\n { name: 'Green (Success)', value: 'success' },\n { name: 'Red (Danger)', value: 'danger' },\n ]},\n ],\n actions: [\n {\n action: 'db_query',\n table: 'reaction_role_panels',\n where: { message_id: '${args.message_id}' },\n as: 'panel',\n },\n {\n action: 'flow_if',\n condition: '${!panel[0]}',\n then: [\n { action: 'reply', content: 'Panel not found!', ephemeral: true },\n { action: 'abort' },\n ],\n },\n {\n action: 'db_insert',\n table: 'reaction_role_entries',\n data: {\n panel_id: '${panel[0].id}',\n role_id: '${args.role.id}',\n label: '${args.label || args.role.name}',\n emoji: '${args.emoji}',\n style: '${args.style || \"primary\"}',\n },\n },\n // Get all entries for this panel\n {\n action: 'db_query',\n table: 'reaction_role_entries',\n where: { panel_id: '${panel[0].id}' },\n as: 'entries',\n },\n // Build components\n {\n action: 'set',\n key: 'buttons',\n value: '${entries.map(e => ({ type: \"button\", style: e.style, label: e.label, emoji: e.emoji, custom_id: \"rr_\" + e.role_id }))}',\n },\n {\n action: 'set',\n key: 'rows',\n value: '${chunk(buttons, 5).map(row => ({ type: \"action_row\", components: row }))}',\n },\n // Update message\n {\n action: 'edit_message',\n channel: '${panel[0].channel_id}',\n message: '${panel[0].message_id}',\n components: '${rows}',\n },\n {\n action: 'reply',\n content: 'Added ${args.role.name} to the panel!',\n ephemeral: true,\n },\n ],\n },\n {\n name: 'create-select',\n description: 'Create a select menu role panel',\n options: [\n { name: 'title', description: 'Panel title', type: 'string', required: false },\n { name: 'description', description: 'Panel description', type: 'string', required: false },\n { name: 'max_roles', description: 'Maximum roles that can be selected', type: 'integer', required: false },\n ],\n actions: [\n {\n action: 'send_message',\n channel: '${channel.id}',\n embed: {\n title: '${args.title || \"Role Selection\"}',\n description: '${args.description || \"Select your roles from the menu below!\"}',\n color: '#5865f2',\n },\n as: 'panelMessage',\n },\n {\n action: 'db_insert',\n table: 'reaction_role_panels',\n data: {\n guild_id: '${guild.id}',\n channel_id: '${channel.id}',\n message_id: '${panelMessage.id}',\n type: 'select',\n mode: 'toggle',\n max_roles: '${args.max_roles}',\n created_at: '${now()}',\n },\n as: 'panel',\n },\n {\n action: 'reply',\n content: 'Select menu role panel created! Use `/reactionroles add-option` to add roles.\\nPanel ID: ${panel.id}',\n ephemeral: true,\n },\n ],\n },\n {\n name: 'add-option',\n description: 'Add an option to a select menu panel',\n options: [\n { name: 'message_id', description: 'Panel message ID', type: 'string', required: true },\n { name: 'role', description: 'Role to assign', type: 'role', required: true },\n { name: 'label', description: 'Option label', type: 'string', required: false },\n { name: 'description', description: 'Option description', type: 'string', required: false },\n { name: 'emoji', description: 'Option emoji', type: 'string', required: false },\n ],\n actions: [\n {\n action: 'db_query',\n table: 'reaction_role_panels',\n where: { message_id: '${args.message_id}', type: 'select' },\n as: 'panel',\n },\n {\n action: 'flow_if',\n condition: '${!panel[0]}',\n then: [\n { action: 'reply', content: 'Select menu panel not found!', ephemeral: true },\n { action: 'abort' },\n ],\n },\n {\n action: 'db_insert',\n table: 'reaction_role_entries',\n data: {\n panel_id: '${panel[0].id}',\n role_id: '${args.role.id}',\n label: '${args.label || args.role.name}',\n description: '${args.description}',\n emoji: '${args.emoji}',\n },\n },\n // Get all entries for this panel\n {\n action: 'db_query',\n table: 'reaction_role_entries',\n where: { panel_id: '${panel[0].id}' },\n as: 'entries',\n },\n // Build select menu\n {\n action: 'set',\n key: 'options',\n value: '${entries.map(e => ({ label: e.label, value: e.role_id, description: e.description, emoji: e.emoji }))}',\n },\n // Update message\n {\n action: 'edit_message',\n channel: '${panel[0].channel_id}',\n message: '${panel[0].message_id}',\n components: [\n {\n type: 'action_row',\n components: [\n {\n type: 'select_menu',\n custom_id: 'rr_select_${panel[0].id}',\n placeholder: 'Select roles...',\n min_values: 0,\n max_values: '${panel[0].max_roles || entries.length}',\n options: '${options}',\n },\n ],\n },\n ],\n },\n {\n action: 'reply',\n content: 'Added ${args.role.name} to the panel!',\n ephemeral: true,\n },\n ],\n },\n {\n name: 'delete',\n description: 'Delete a role panel',\n options: [\n { name: 'message_id', description: 'Panel message ID', type: 'string', required: true },\n ],\n actions: [\n {\n action: 'db_query',\n table: 'reaction_role_panels',\n where: { message_id: '${args.message_id}' },\n as: 'panel',\n },\n {\n action: 'flow_if',\n condition: '${!panel[0]}',\n then: [\n { action: 'reply', content: 'Panel not found!', ephemeral: true },\n { action: 'abort' },\n ],\n },\n {\n action: 'db_delete',\n table: 'reaction_role_entries',\n where: { panel_id: '${panel[0].id}' },\n },\n {\n action: 'db_delete',\n table: 'reaction_role_panels',\n where: { id: '${panel[0].id}' },\n },\n {\n action: 'delete_message',\n channel: '${panel[0].channel_id}',\n message: '${panel[0].message_id}',\n },\n {\n action: 'reply',\n content: 'Panel deleted!',\n ephemeral: true,\n },\n ],\n },\n ],\n },\n];\n\nexport function getReactionRolesSpec(config: ReactionRolesConfig = {}): Partial<FurlowSpec> {\n return {\n events: reactionRolesEventHandlers,\n commands: reactionRolesCommands,\n state: {\n tables: reactionRolesTables,\n },\n };\n}\n"],"mappings":";AAcO,IAAM,sBAAu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A,QACN,aAAa;AAAA,QACb,SAAS;AAAA,UACP,EAAE,MAAM,cAAc,aAAa,oBAAoB,MAAM,UAAU,UAAU,KAAK;AAAA,QACxF;AAAA,QACA,SAAS;AAAA,UACP;AAAA,YACE,QAAQ;AAAA,YACR,OAAO;AAAA,YACP,OAAO,EAAE,YAAY,qBAAqB;AAAA,YAC1C,IAAI;AAAA,UACN;AAAA,UACA;AAAA,YACE,QAAQ;AAAA,YACR,WAAW;AAAA,YACX,MAAM;AAAA,cACJ,EAAE,QAAQ,SAAS,SAAS,oBAAoB,WAAW,KAAK;AAAA,cAChE,EAAE,QAAQ,QAAQ;AAAA,YACpB;AAAA,UACF;AAAA,UACA;AAAA,YACE,QAAQ;AAAA,YACR,OAAO;AAAA,YACP,OAAO,EAAE,UAAU,iBAAiB;AAAA,UACtC;AAAA,UACA;AAAA,YACE,QAAQ;AAAA,YACR,OAAO;AAAA,YACP,OAAO,EAAE,IAAI,iBAAiB;AAAA,UAChC;AAAA,UACA;AAAA,YACE,QAAQ;AAAA,YACR,SAAS;AAAA,YACT,SAAS;AAAA,UACX;AAAA,UACA;AAAA,YACE,QAAQ;AAAA,YACR,SAAS;AAAA,YACT,WAAW;AAAA,UACb;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEO,SAAS,qBAAqB,SAA8B,CAAC,GAAwB;AAC1F,SAAO;AAAA,IACL,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,OAAO;AAAA,MACL,QAAQ;AAAA,IACV;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FurlowSpec, CommandDefinition, EventHandler, TableDefinition } from '@furlow/schema';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Reminders builtin module
|
|
5
|
+
* Handles scheduled reminders with DM delivery
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
interface RemindersConfig {
|
|
9
|
+
/** Maximum reminders per user */
|
|
10
|
+
maxRemindersPerUser?: number;
|
|
11
|
+
/** Minimum reminder duration */
|
|
12
|
+
minDuration?: string;
|
|
13
|
+
/** Maximum reminder duration */
|
|
14
|
+
maxDuration?: string;
|
|
15
|
+
/** Allow DM reminders */
|
|
16
|
+
allowDM?: boolean;
|
|
17
|
+
}
|
|
18
|
+
declare const remindersTables: Record<string, TableDefinition>;
|
|
19
|
+
declare const remindersEventHandlers: EventHandler[];
|
|
20
|
+
declare const remindersCommands: CommandDefinition[];
|
|
21
|
+
declare function getRemindersSpec(config?: RemindersConfig): Partial<FurlowSpec>;
|
|
22
|
+
|
|
23
|
+
export { type RemindersConfig, getRemindersSpec, remindersCommands, remindersEventHandlers, remindersTables };
|