@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.
Files changed (46) hide show
  1. package/dist/afk/index.d.ts +21 -0
  2. package/dist/afk/index.js +195 -0
  3. package/dist/afk/index.js.map +1 -0
  4. package/dist/auto-responder/index.d.ts +21 -0
  5. package/dist/auto-responder/index.js +356 -0
  6. package/dist/auto-responder/index.js.map +1 -0
  7. package/dist/giveaways/index.d.ts +25 -0
  8. package/dist/giveaways/index.js +416 -0
  9. package/dist/giveaways/index.js.map +1 -0
  10. package/dist/index.d.ts +15 -0
  11. package/dist/index.js +5402 -0
  12. package/dist/index.js.map +1 -0
  13. package/dist/leveling/index.d.ts +46 -0
  14. package/dist/leveling/index.js +521 -0
  15. package/dist/leveling/index.js.map +1 -0
  16. package/dist/logging/index.d.ts +52 -0
  17. package/dist/logging/index.js +519 -0
  18. package/dist/logging/index.js.map +1 -0
  19. package/dist/moderation/index.d.ts +83 -0
  20. package/dist/moderation/index.js +221 -0
  21. package/dist/moderation/index.js.map +1 -0
  22. package/dist/music/index.d.ts +33 -0
  23. package/dist/music/index.js +414 -0
  24. package/dist/music/index.js.map +1 -0
  25. package/dist/polls/index.d.ts +21 -0
  26. package/dist/polls/index.js +395 -0
  27. package/dist/polls/index.js.map +1 -0
  28. package/dist/reaction-roles/index.d.ts +19 -0
  29. package/dist/reaction-roles/index.js +551 -0
  30. package/dist/reaction-roles/index.js.map +1 -0
  31. package/dist/reminders/index.d.ts +23 -0
  32. package/dist/reminders/index.js +224 -0
  33. package/dist/reminders/index.js.map +1 -0
  34. package/dist/starboard/index.d.ts +35 -0
  35. package/dist/starboard/index.js +401 -0
  36. package/dist/starboard/index.js.map +1 -0
  37. package/dist/tickets/index.d.ts +43 -0
  38. package/dist/tickets/index.js +614 -0
  39. package/dist/tickets/index.js.map +1 -0
  40. package/dist/utilities/index.d.ts +15 -0
  41. package/dist/utilities/index.js +299 -0
  42. package/dist/utilities/index.js.map +1 -0
  43. package/dist/welcome/index.d.ts +48 -0
  44. package/dist/welcome/index.js +302 -0
  45. package/dist/welcome/index.js.map +1 -0
  46. package/package.json +109 -0
@@ -0,0 +1,25 @@
1
+ import { FurlowSpec, CommandDefinition, EventHandler, TableDefinition } from '@furlow/schema';
2
+
3
+ /**
4
+ * Giveaways builtin module
5
+ * Handles giveaway creation, entries, and winner selection
6
+ */
7
+
8
+ interface GiveawaysConfig {
9
+ /** Default giveaway duration */
10
+ defaultDuration?: string;
11
+ /** Giveaway manager role */
12
+ managerRole?: string;
13
+ /** Require role to enter */
14
+ requireRole?: string;
15
+ /** Embed color */
16
+ embedColor?: string;
17
+ /** End emoji */
18
+ emoji?: string;
19
+ }
20
+ declare const giveawaysTables: Record<string, TableDefinition>;
21
+ declare const giveawaysEventHandlers: EventHandler[];
22
+ declare const giveawaysCommands: CommandDefinition[];
23
+ declare function getGiveawaysSpec(config?: GiveawaysConfig): Partial<FurlowSpec>;
24
+
25
+ export { type GiveawaysConfig, getGiveawaysSpec, giveawaysCommands, giveawaysEventHandlers, giveawaysTables };
@@ -0,0 +1,416 @@
1
+ // src/giveaways/index.ts
2
+ var giveawaysTables = {
3
+ giveaways: {
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
+ host_id: { type: "string" },
10
+ prize: { type: "string" },
11
+ winners_count: { type: "number", default: 1 },
12
+ ends_at: { type: "timestamp", index: true },
13
+ ended: { type: "boolean", default: false },
14
+ require_role: { type: "string" },
15
+ created_at: { type: "timestamp" }
16
+ }
17
+ },
18
+ giveaway_entries: {
19
+ columns: {
20
+ id: { type: "number", primary: true },
21
+ giveaway_id: { type: "number", index: true },
22
+ user_id: { type: "string" },
23
+ created_at: { type: "timestamp" }
24
+ }
25
+ }
26
+ };
27
+ var giveawaysEventHandlers = [
28
+ // Handle giveaway button click
29
+ {
30
+ event: "button_click",
31
+ condition: '${interaction.customId.startsWith("giveaway_enter_")}',
32
+ actions: [
33
+ {
34
+ action: "set",
35
+ key: "giveawayId",
36
+ value: '${interaction.customId.replace("giveaway_enter_", "")}'
37
+ },
38
+ {
39
+ action: "db_query",
40
+ table: "giveaways",
41
+ where: { id: "${giveawayId}" },
42
+ as: "giveaway"
43
+ },
44
+ {
45
+ action: "flow_if",
46
+ condition: "${!giveaway[0] || giveaway[0].ended}",
47
+ then: [
48
+ { action: "reply", content: "This giveaway has ended!", ephemeral: true },
49
+ { action: "abort" }
50
+ ]
51
+ },
52
+ // Check role requirement
53
+ {
54
+ action: "flow_if",
55
+ condition: "${giveaway[0].require_role && !member.roles.cache.has(giveaway[0].require_role)}",
56
+ then: [
57
+ { action: "reply", content: "You need the <@&${giveaway[0].require_role}> role to enter!", ephemeral: true },
58
+ { action: "abort" }
59
+ ]
60
+ },
61
+ // Check if already entered
62
+ {
63
+ action: "db_query",
64
+ table: "giveaway_entries",
65
+ where: { giveaway_id: "${giveawayId}", user_id: "${user.id}" },
66
+ as: "existing"
67
+ },
68
+ {
69
+ action: "flow_if",
70
+ condition: "${existing.length > 0}",
71
+ then: [
72
+ // Remove entry
73
+ {
74
+ action: "db_delete",
75
+ table: "giveaway_entries",
76
+ where: { giveaway_id: "${giveawayId}", user_id: "${user.id}" }
77
+ },
78
+ { action: "reply", content: "You have left the giveaway!", ephemeral: true }
79
+ ],
80
+ else: [
81
+ // Add entry
82
+ {
83
+ action: "db_insert",
84
+ table: "giveaway_entries",
85
+ data: {
86
+ giveaway_id: "${giveawayId}",
87
+ user_id: "${user.id}",
88
+ created_at: "${now()}"
89
+ }
90
+ },
91
+ { action: "reply", content: "You have entered the giveaway!", ephemeral: true }
92
+ ]
93
+ },
94
+ // Update entry count on message
95
+ {
96
+ action: "db_query",
97
+ table: "giveaway_entries",
98
+ where: { giveaway_id: "${giveawayId}" },
99
+ as: "entries"
100
+ },
101
+ {
102
+ action: "edit_message",
103
+ channel: "${giveaway[0].channel_id}",
104
+ message: "${giveaway[0].message_id}",
105
+ embed: {
106
+ title: '${config.giveaways?.emoji || "\u{1F389}"} GIVEAWAY ${config.giveaways?.emoji || "\u{1F389}"}',
107
+ description: '**Prize:** ${giveaway[0].prize}\n**Hosted by:** <@${giveaway[0].host_id}>\n**Winners:** ${giveaway[0].winners_count}\n**Entries:** ${entries.length}\n\nEnds: ${timestamp(giveaway[0].ends_at, "R")}',
108
+ color: '${config.giveaways?.embedColor || "#ff73fa"}',
109
+ footer: { text: "ID: ${giveaway[0].id}" }
110
+ }
111
+ }
112
+ ]
113
+ },
114
+ // Scheduled giveaway end
115
+ {
116
+ event: "scheduler_tick",
117
+ actions: [
118
+ {
119
+ action: "db_query",
120
+ table: "giveaways",
121
+ where: { ended: false },
122
+ as: "activeGiveaways"
123
+ },
124
+ {
125
+ action: "batch",
126
+ items: "${activeGiveaways.filter(g => new Date(g.ends_at) <= now())}",
127
+ each: { action: "emit", event: "giveaway_end", data: { giveawayId: "${item.id}" } }
128
+ }
129
+ ]
130
+ },
131
+ // End giveaway
132
+ {
133
+ event: "giveaway_end",
134
+ actions: [
135
+ {
136
+ action: "db_query",
137
+ table: "giveaways",
138
+ where: { id: "${event.data.giveawayId}" },
139
+ as: "giveaway"
140
+ },
141
+ {
142
+ action: "db_query",
143
+ table: "giveaway_entries",
144
+ where: { giveaway_id: "${event.data.giveawayId}" },
145
+ as: "entries"
146
+ },
147
+ // Select winners
148
+ {
149
+ action: "set",
150
+ key: "shuffled",
151
+ value: "${shuffle(entries)}"
152
+ },
153
+ {
154
+ action: "set",
155
+ key: "winners",
156
+ value: "${shuffled.slice(0, giveaway[0].winners_count)}"
157
+ },
158
+ // Mark as ended
159
+ {
160
+ action: "db_update",
161
+ table: "giveaways",
162
+ where: { id: "${event.data.giveawayId}" },
163
+ data: { ended: true }
164
+ },
165
+ // Update message
166
+ {
167
+ action: "flow_if",
168
+ condition: "${winners.length === 0}",
169
+ then: [
170
+ {
171
+ action: "edit_message",
172
+ channel: "${giveaway[0].channel_id}",
173
+ message: "${giveaway[0].message_id}",
174
+ embed: {
175
+ title: "GIVEAWAY ENDED",
176
+ description: "**Prize:** ${giveaway[0].prize}\n\nNo valid entries.",
177
+ color: "#72767d"
178
+ },
179
+ components: []
180
+ }
181
+ ],
182
+ else: [
183
+ {
184
+ action: "set",
185
+ key: "winnerMentions",
186
+ value: '${winners.map(w => "<@" + w.user_id + ">").join(", ")}'
187
+ },
188
+ {
189
+ action: "edit_message",
190
+ channel: "${giveaway[0].channel_id}",
191
+ message: "${giveaway[0].message_id}",
192
+ embed: {
193
+ title: "GIVEAWAY ENDED",
194
+ description: "**Prize:** ${giveaway[0].prize}\n\n**Winners:** ${winnerMentions}",
195
+ color: "#57f287"
196
+ },
197
+ components: []
198
+ },
199
+ {
200
+ action: "send_message",
201
+ channel: "${giveaway[0].channel_id}",
202
+ content: "Congratulations ${winnerMentions}! You won **${giveaway[0].prize}**!"
203
+ }
204
+ ]
205
+ }
206
+ ]
207
+ }
208
+ ];
209
+ var giveawaysCommands = [
210
+ {
211
+ name: "giveaway",
212
+ description: "Giveaway management",
213
+ subcommands: [
214
+ {
215
+ name: "start",
216
+ description: "Start a giveaway",
217
+ options: [
218
+ { name: "prize", description: "Prize to give away", type: "string", required: true },
219
+ { name: "duration", description: "Duration (e.g., 1h, 1d, 1w)", type: "string", required: true },
220
+ { name: "winners", description: "Number of winners", type: "integer", required: false },
221
+ { name: "require_role", description: "Required role to enter", type: "role", required: false }
222
+ ],
223
+ actions: [
224
+ {
225
+ action: "set",
226
+ key: "endsAt",
227
+ value: "${addDuration(now(), args.duration)}"
228
+ },
229
+ {
230
+ action: "send_message",
231
+ channel: "${channel.id}",
232
+ embed: {
233
+ title: '${config.giveaways?.emoji || "\u{1F389}"} GIVEAWAY ${config.giveaways?.emoji || "\u{1F389}"}',
234
+ description: '**Prize:** ${args.prize}\n**Hosted by:** ${user}\n**Winners:** ${args.winners || 1}\n**Entries:** 0\n\nEnds: ${timestamp(endsAt, "R")}',
235
+ color: '${config.giveaways?.embedColor || "#ff73fa"}'
236
+ },
237
+ components: [
238
+ {
239
+ type: "action_row",
240
+ components: [
241
+ {
242
+ type: "button",
243
+ style: "primary",
244
+ label: "Enter",
245
+ emoji: "\u{1F389}",
246
+ custom_id: "giveaway_enter_PLACEHOLDER"
247
+ }
248
+ ]
249
+ }
250
+ ],
251
+ as: "giveawayMessage"
252
+ },
253
+ {
254
+ action: "db_insert",
255
+ table: "giveaways",
256
+ data: {
257
+ guild_id: "${guild.id}",
258
+ channel_id: "${channel.id}",
259
+ message_id: "${giveawayMessage.id}",
260
+ host_id: "${user.id}",
261
+ prize: "${args.prize}",
262
+ winners_count: "${args.winners || 1}",
263
+ ends_at: "${endsAt}",
264
+ require_role: "${args.require_role?.id}",
265
+ created_at: "${now()}"
266
+ },
267
+ as: "giveaway"
268
+ },
269
+ // Update button with correct ID
270
+ {
271
+ action: "edit_message",
272
+ channel: "${channel.id}",
273
+ message: "${giveawayMessage.id}",
274
+ embed: {
275
+ title: '${config.giveaways?.emoji || "\u{1F389}"} GIVEAWAY ${config.giveaways?.emoji || "\u{1F389}"}',
276
+ description: '**Prize:** ${args.prize}\n**Hosted by:** ${user}\n**Winners:** ${args.winners || 1}\n**Entries:** 0\n\nEnds: ${timestamp(endsAt, "R")}',
277
+ color: '${config.giveaways?.embedColor || "#ff73fa"}',
278
+ footer: { text: "ID: ${giveaway.id}" }
279
+ },
280
+ components: [
281
+ {
282
+ type: "action_row",
283
+ components: [
284
+ {
285
+ type: "button",
286
+ style: "primary",
287
+ label: "Enter",
288
+ emoji: "\u{1F389}",
289
+ custom_id: "giveaway_enter_${giveaway.id}"
290
+ }
291
+ ]
292
+ }
293
+ ]
294
+ },
295
+ {
296
+ action: "reply",
297
+ content: "Giveaway started!",
298
+ ephemeral: true
299
+ }
300
+ ]
301
+ },
302
+ {
303
+ name: "end",
304
+ description: "End a giveaway early",
305
+ options: [
306
+ { name: "message_id", description: "Giveaway message ID", type: "string", required: true }
307
+ ],
308
+ actions: [
309
+ {
310
+ action: "db_query",
311
+ table: "giveaways",
312
+ where: { message_id: "${args.message_id}" },
313
+ as: "giveaway"
314
+ },
315
+ {
316
+ action: "flow_if",
317
+ condition: "${!giveaway[0]}",
318
+ then: [
319
+ { action: "reply", content: "Giveaway not found!", ephemeral: true },
320
+ { action: "abort" }
321
+ ]
322
+ },
323
+ {
324
+ action: "emit",
325
+ event: "giveaway_end",
326
+ data: { giveawayId: "${giveaway[0].id}" }
327
+ },
328
+ {
329
+ action: "reply",
330
+ content: "Giveaway ended!",
331
+ ephemeral: true
332
+ }
333
+ ]
334
+ },
335
+ {
336
+ name: "reroll",
337
+ description: "Reroll winners for an ended giveaway",
338
+ options: [
339
+ { name: "message_id", description: "Giveaway message ID", type: "string", required: true },
340
+ { name: "winners", description: "Number of new winners", type: "integer", required: false }
341
+ ],
342
+ actions: [
343
+ {
344
+ action: "db_query",
345
+ table: "giveaways",
346
+ where: { message_id: "${args.message_id}" },
347
+ as: "giveaway"
348
+ },
349
+ {
350
+ action: "flow_if",
351
+ condition: "${!giveaway[0] || !giveaway[0].ended}",
352
+ then: [
353
+ { action: "reply", content: "Giveaway not found or not ended!", ephemeral: true },
354
+ { action: "abort" }
355
+ ]
356
+ },
357
+ {
358
+ action: "db_query",
359
+ table: "giveaway_entries",
360
+ where: { giveaway_id: "${giveaway[0].id}" },
361
+ as: "entries"
362
+ },
363
+ {
364
+ action: "set",
365
+ key: "shuffled",
366
+ value: "${shuffle(entries)}"
367
+ },
368
+ {
369
+ action: "set",
370
+ key: "winners",
371
+ value: "${shuffled.slice(0, args.winners || 1)}"
372
+ },
373
+ {
374
+ action: "flow_if",
375
+ condition: "${winners.length === 0}",
376
+ then: [
377
+ { action: "reply", content: "No valid entries to reroll!", ephemeral: true },
378
+ { action: "abort" }
379
+ ]
380
+ },
381
+ {
382
+ action: "set",
383
+ key: "winnerMentions",
384
+ value: '${winners.map(w => "<@" + w.user_id + ">").join(", ")}'
385
+ },
386
+ {
387
+ action: "send_message",
388
+ channel: "${giveaway[0].channel_id}",
389
+ content: "New winner(s): ${winnerMentions}! Congratulations on winning **${giveaway[0].prize}**!"
390
+ },
391
+ {
392
+ action: "reply",
393
+ content: "Rerolled successfully!",
394
+ ephemeral: true
395
+ }
396
+ ]
397
+ }
398
+ ]
399
+ }
400
+ ];
401
+ function getGiveawaysSpec(config = {}) {
402
+ return {
403
+ commands: giveawaysCommands,
404
+ events: giveawaysEventHandlers,
405
+ state: {
406
+ tables: giveawaysTables
407
+ }
408
+ };
409
+ }
410
+ export {
411
+ getGiveawaysSpec,
412
+ giveawaysCommands,
413
+ giveawaysEventHandlers,
414
+ giveawaysTables
415
+ };
416
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/giveaways/index.ts"],"sourcesContent":["/**\n * Giveaways builtin module\n * Handles giveaway creation, entries, and winner selection\n */\n\nimport type { FurlowSpec, CommandDefinition, EventHandler, TableDefinition } from '@furlow/schema';\n\nexport interface GiveawaysConfig {\n /** Default giveaway duration */\n defaultDuration?: string;\n /** Giveaway manager role */\n managerRole?: string;\n /** Require role to enter */\n requireRole?: string;\n /** Embed color */\n embedColor?: string;\n /** End emoji */\n emoji?: string;\n}\n\nexport const giveawaysTables: Record<string, TableDefinition> = {\n giveaways: {\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 host_id: { type: 'string' },\n prize: { type: 'string' },\n winners_count: { type: 'number', default: 1 },\n ends_at: { type: 'timestamp', index: true },\n ended: { type: 'boolean', default: false },\n require_role: { type: 'string' },\n created_at: { type: 'timestamp' },\n },\n },\n giveaway_entries: {\n columns: {\n id: { type: 'number', primary: true },\n giveaway_id: { type: 'number', index: true },\n user_id: { type: 'string' },\n created_at: { type: 'timestamp' },\n },\n },\n};\n\nexport const giveawaysEventHandlers: EventHandler[] = [\n // Handle giveaway button click\n {\n event: 'button_click',\n condition: '${interaction.customId.startsWith(\"giveaway_enter_\")}',\n actions: [\n {\n action: 'set',\n key: 'giveawayId',\n value: '${interaction.customId.replace(\"giveaway_enter_\", \"\")}',\n },\n {\n action: 'db_query',\n table: 'giveaways',\n where: { id: '${giveawayId}' },\n as: 'giveaway',\n },\n {\n action: 'flow_if',\n condition: '${!giveaway[0] || giveaway[0].ended}',\n then: [\n { action: 'reply', content: 'This giveaway has ended!', ephemeral: true },\n { action: 'abort' },\n ],\n },\n // Check role requirement\n {\n action: 'flow_if',\n condition: '${giveaway[0].require_role && !member.roles.cache.has(giveaway[0].require_role)}',\n then: [\n { action: 'reply', content: 'You need the <@&${giveaway[0].require_role}> role to enter!', ephemeral: true },\n { action: 'abort' },\n ],\n },\n // Check if already entered\n {\n action: 'db_query',\n table: 'giveaway_entries',\n where: { giveaway_id: '${giveawayId}', user_id: '${user.id}' },\n as: 'existing',\n },\n {\n action: 'flow_if',\n condition: '${existing.length > 0}',\n then: [\n // Remove entry\n {\n action: 'db_delete',\n table: 'giveaway_entries',\n where: { giveaway_id: '${giveawayId}', user_id: '${user.id}' },\n },\n { action: 'reply', content: 'You have left the giveaway!', ephemeral: true },\n ],\n else: [\n // Add entry\n {\n action: 'db_insert',\n table: 'giveaway_entries',\n data: {\n giveaway_id: '${giveawayId}',\n user_id: '${user.id}',\n created_at: '${now()}',\n },\n },\n { action: 'reply', content: 'You have entered the giveaway!', ephemeral: true },\n ],\n },\n // Update entry count on message\n {\n action: 'db_query',\n table: 'giveaway_entries',\n where: { giveaway_id: '${giveawayId}' },\n as: 'entries',\n },\n {\n action: 'edit_message',\n channel: '${giveaway[0].channel_id}',\n message: '${giveaway[0].message_id}',\n embed: {\n title: '${config.giveaways?.emoji || \"🎉\"} GIVEAWAY ${config.giveaways?.emoji || \"🎉\"}',\n description: '**Prize:** ${giveaway[0].prize}\\n**Hosted by:** <@${giveaway[0].host_id}>\\n**Winners:** ${giveaway[0].winners_count}\\n**Entries:** ${entries.length}\\n\\nEnds: ${timestamp(giveaway[0].ends_at, \"R\")}',\n color: '${config.giveaways?.embedColor || \"#ff73fa\"}',\n footer: { text: 'ID: ${giveaway[0].id}' },\n },\n },\n ],\n },\n // Scheduled giveaway end\n {\n event: 'scheduler_tick',\n actions: [\n {\n action: 'db_query',\n table: 'giveaways',\n where: { ended: false },\n as: 'activeGiveaways',\n },\n {\n action: 'batch',\n items: '${activeGiveaways.filter(g => new Date(g.ends_at) <= now())}',\n each: { action: 'emit', event: 'giveaway_end', data: { giveawayId: '${item.id}' } },\n },\n ],\n },\n // End giveaway\n {\n event: 'giveaway_end',\n actions: [\n {\n action: 'db_query',\n table: 'giveaways',\n where: { id: '${event.data.giveawayId}' },\n as: 'giveaway',\n },\n {\n action: 'db_query',\n table: 'giveaway_entries',\n where: { giveaway_id: '${event.data.giveawayId}' },\n as: 'entries',\n },\n // Select winners\n {\n action: 'set',\n key: 'shuffled',\n value: '${shuffle(entries)}',\n },\n {\n action: 'set',\n key: 'winners',\n value: '${shuffled.slice(0, giveaway[0].winners_count)}',\n },\n // Mark as ended\n {\n action: 'db_update',\n table: 'giveaways',\n where: { id: '${event.data.giveawayId}' },\n data: { ended: true },\n },\n // Update message\n {\n action: 'flow_if',\n condition: '${winners.length === 0}',\n then: [\n {\n action: 'edit_message',\n channel: '${giveaway[0].channel_id}',\n message: '${giveaway[0].message_id}',\n embed: {\n title: 'GIVEAWAY ENDED',\n description: '**Prize:** ${giveaway[0].prize}\\n\\nNo valid entries.',\n color: '#72767d',\n },\n components: [],\n },\n ],\n else: [\n {\n action: 'set',\n key: 'winnerMentions',\n value: '${winners.map(w => \"<@\" + w.user_id + \">\").join(\", \")}',\n },\n {\n action: 'edit_message',\n channel: '${giveaway[0].channel_id}',\n message: '${giveaway[0].message_id}',\n embed: {\n title: 'GIVEAWAY ENDED',\n description: '**Prize:** ${giveaway[0].prize}\\n\\n**Winners:** ${winnerMentions}',\n color: '#57f287',\n },\n components: [],\n },\n {\n action: 'send_message',\n channel: '${giveaway[0].channel_id}',\n content: 'Congratulations ${winnerMentions}! You won **${giveaway[0].prize}**!',\n },\n ],\n },\n ],\n },\n];\n\nexport const giveawaysCommands: CommandDefinition[] = [\n {\n name: 'giveaway',\n description: 'Giveaway management',\n subcommands: [\n {\n name: 'start',\n description: 'Start a giveaway',\n options: [\n { name: 'prize', description: 'Prize to give away', type: 'string', required: true },\n { name: 'duration', description: 'Duration (e.g., 1h, 1d, 1w)', type: 'string', required: true },\n { name: 'winners', description: 'Number of winners', type: 'integer', required: false },\n { name: 'require_role', description: 'Required role to enter', type: 'role', required: false },\n ],\n actions: [\n {\n action: 'set',\n key: 'endsAt',\n value: '${addDuration(now(), args.duration)}',\n },\n {\n action: 'send_message',\n channel: '${channel.id}',\n embed: {\n title: '${config.giveaways?.emoji || \"🎉\"} GIVEAWAY ${config.giveaways?.emoji || \"🎉\"}',\n description: '**Prize:** ${args.prize}\\n**Hosted by:** ${user}\\n**Winners:** ${args.winners || 1}\\n**Entries:** 0\\n\\nEnds: ${timestamp(endsAt, \"R\")}',\n color: '${config.giveaways?.embedColor || \"#ff73fa\"}',\n },\n components: [\n {\n type: 'action_row',\n components: [\n {\n type: 'button',\n style: 'primary',\n label: 'Enter',\n emoji: '🎉',\n custom_id: 'giveaway_enter_PLACEHOLDER',\n },\n ],\n },\n ],\n as: 'giveawayMessage',\n },\n {\n action: 'db_insert',\n table: 'giveaways',\n data: {\n guild_id: '${guild.id}',\n channel_id: '${channel.id}',\n message_id: '${giveawayMessage.id}',\n host_id: '${user.id}',\n prize: '${args.prize}',\n winners_count: '${args.winners || 1}',\n ends_at: '${endsAt}',\n require_role: '${args.require_role?.id}',\n created_at: '${now()}',\n },\n as: 'giveaway',\n },\n // Update button with correct ID\n {\n action: 'edit_message',\n channel: '${channel.id}',\n message: '${giveawayMessage.id}',\n embed: {\n title: '${config.giveaways?.emoji || \"🎉\"} GIVEAWAY ${config.giveaways?.emoji || \"🎉\"}',\n description: '**Prize:** ${args.prize}\\n**Hosted by:** ${user}\\n**Winners:** ${args.winners || 1}\\n**Entries:** 0\\n\\nEnds: ${timestamp(endsAt, \"R\")}',\n color: '${config.giveaways?.embedColor || \"#ff73fa\"}',\n footer: { text: 'ID: ${giveaway.id}' },\n },\n components: [\n {\n type: 'action_row',\n components: [\n {\n type: 'button',\n style: 'primary',\n label: 'Enter',\n emoji: '🎉',\n custom_id: 'giveaway_enter_${giveaway.id}',\n },\n ],\n },\n ],\n },\n {\n action: 'reply',\n content: 'Giveaway started!',\n ephemeral: true,\n },\n ],\n },\n {\n name: 'end',\n description: 'End a giveaway early',\n options: [\n { name: 'message_id', description: 'Giveaway message ID', type: 'string', required: true },\n ],\n actions: [\n {\n action: 'db_query',\n table: 'giveaways',\n where: { message_id: '${args.message_id}' },\n as: 'giveaway',\n },\n {\n action: 'flow_if',\n condition: '${!giveaway[0]}',\n then: [\n { action: 'reply', content: 'Giveaway not found!', ephemeral: true },\n { action: 'abort' },\n ],\n },\n {\n action: 'emit',\n event: 'giveaway_end',\n data: { giveawayId: '${giveaway[0].id}' },\n },\n {\n action: 'reply',\n content: 'Giveaway ended!',\n ephemeral: true,\n },\n ],\n },\n {\n name: 'reroll',\n description: 'Reroll winners for an ended giveaway',\n options: [\n { name: 'message_id', description: 'Giveaway message ID', type: 'string', required: true },\n { name: 'winners', description: 'Number of new winners', type: 'integer', required: false },\n ],\n actions: [\n {\n action: 'db_query',\n table: 'giveaways',\n where: { message_id: '${args.message_id}' },\n as: 'giveaway',\n },\n {\n action: 'flow_if',\n condition: '${!giveaway[0] || !giveaway[0].ended}',\n then: [\n { action: 'reply', content: 'Giveaway not found or not ended!', ephemeral: true },\n { action: 'abort' },\n ],\n },\n {\n action: 'db_query',\n table: 'giveaway_entries',\n where: { giveaway_id: '${giveaway[0].id}' },\n as: 'entries',\n },\n {\n action: 'set',\n key: 'shuffled',\n value: '${shuffle(entries)}',\n },\n {\n action: 'set',\n key: 'winners',\n value: '${shuffled.slice(0, args.winners || 1)}',\n },\n {\n action: 'flow_if',\n condition: '${winners.length === 0}',\n then: [\n { action: 'reply', content: 'No valid entries to reroll!', ephemeral: true },\n { action: 'abort' },\n ],\n },\n {\n action: 'set',\n key: 'winnerMentions',\n value: '${winners.map(w => \"<@\" + w.user_id + \">\").join(\", \")}',\n },\n {\n action: 'send_message',\n channel: '${giveaway[0].channel_id}',\n content: 'New winner(s): ${winnerMentions}! Congratulations on winning **${giveaway[0].prize}**!',\n },\n {\n action: 'reply',\n content: 'Rerolled successfully!',\n ephemeral: true,\n },\n ],\n },\n ],\n },\n];\n\nexport function getGiveawaysSpec(config: GiveawaysConfig = {}): Partial<FurlowSpec> {\n return {\n commands: giveawaysCommands,\n events: giveawaysEventHandlers,\n state: {\n tables: giveawaysTables,\n },\n };\n}\n"],"mappings":";AAoBO,IAAM,kBAAmD;AAAA,EAC9D,WAAW;AAAA,IACT,SAAS;AAAA,MACP,IAAI,EAAE,MAAM,UAAU,SAAS,KAAK;AAAA,MACpC,UAAU,EAAE,MAAM,UAAU,OAAO,KAAK;AAAA,MACxC,YAAY,EAAE,MAAM,SAAS;AAAA,MAC7B,YAAY,EAAE,MAAM,UAAU,QAAQ,KAAK;AAAA,MAC3C,SAAS,EAAE,MAAM,SAAS;AAAA,MAC1B,OAAO,EAAE,MAAM,SAAS;AAAA,MACxB,eAAe,EAAE,MAAM,UAAU,SAAS,EAAE;AAAA,MAC5C,SAAS,EAAE,MAAM,aAAa,OAAO,KAAK;AAAA,MAC1C,OAAO,EAAE,MAAM,WAAW,SAAS,MAAM;AAAA,MACzC,cAAc,EAAE,MAAM,SAAS;AAAA,MAC/B,YAAY,EAAE,MAAM,YAAY;AAAA,IAClC;AAAA,EACF;AAAA,EACA,kBAAkB;AAAA,IAChB,SAAS;AAAA,MACP,IAAI,EAAE,MAAM,UAAU,SAAS,KAAK;AAAA,MACpC,aAAa,EAAE,MAAM,UAAU,OAAO,KAAK;AAAA,MAC3C,SAAS,EAAE,MAAM,SAAS;AAAA,MAC1B,YAAY,EAAE,MAA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UACA;AAAA,YACE,QAAQ;AAAA,YACR,KAAK;AAAA,YACL,OAAO;AAAA,UACT;AAAA,UACA;AAAA,YACE,QAAQ;AAAA,YACR,WAAW;AAAA,YACX,MAAM;AAAA,cACJ,EAAE,QAAQ,SAAS,SAAS,+BAA+B,WAAW,KAAK;AAAA,cAC3E,EAAE,QAAQ,QAAQ;AAAA,YACpB;AAAA,UACF;AAAA,UACA;AAAA,YACE,QAAQ;AAAA,YACR,KAAK;AAAA,YACL,OAAO;AAAA,UACT;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,iBAAiB,SAA0B,CAAC,GAAwB;AAClF,SAAO;AAAA,IACL,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,OAAO;AAAA,MACL,QAAQ;AAAA,IACV;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,15 @@
1
+ export { ModerationConfig, getModerationSpec, moderationCommands, moderationTables } from './moderation/index.js';
2
+ export { WelcomeConfig, getWelcomeSpec, welcomeCanvasGenerators, welcomeCommands, welcomeEventHandlers } from './welcome/index.js';
3
+ export { LoggingConfig, getLoggingSpec, loggingCommands, loggingEventHandlers } from './logging/index.js';
4
+ export { TicketsConfig, getTicketsSpec, ticketControlComponents, ticketPanelComponents, ticketsCommands, ticketsEventHandlers, ticketsTables } from './tickets/index.js';
5
+ export { ReactionRolesConfig, getReactionRolesSpec, reactionRolesCommands, reactionRolesEventHandlers, reactionRolesTables } from './reaction-roles/index.js';
6
+ export { LevelingConfig, getLevelingSpec, levelingCanvasGenerators, levelingCommands, levelingEventHandlers, levelingTables } from './leveling/index.js';
7
+ export { MusicConfig, getMusicSpec, musicCommands, musicEventHandlers, musicTables } from './music/index.js';
8
+ export { StarboardConfig, getStarboardSpec, starboardCommands, starboardEventHandlers, starboardTables } from './starboard/index.js';
9
+ export { PollsConfig, getPollsSpec, pollsCommands, pollsEventHandlers, pollsTables } from './polls/index.js';
10
+ export { GiveawaysConfig, getGiveawaysSpec, giveawaysCommands, giveawaysEventHandlers, giveawaysTables } from './giveaways/index.js';
11
+ export { AutoResponderConfig, autoResponderCommands, autoResponderEventHandlers, autoResponderTables, getAutoResponderSpec } from './auto-responder/index.js';
12
+ export { AfkConfig, afkCommands, afkEventHandlers, afkTables, getAfkSpec } from './afk/index.js';
13
+ export { RemindersConfig, getRemindersSpec, remindersCommands, remindersEventHandlers, remindersTables } from './reminders/index.js';
14
+ export { UtilitiesConfig, getUtilitiesSpec, utilitiesCommands } from './utilities/index.js';
15
+ import '@furlow/schema';