@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,46 @@
1
+ import { FurlowSpec, CanvasGenerator, CommandDefinition, EventHandler, TableDefinition } from '@furlow/schema';
2
+
3
+ /**
4
+ * Leveling builtin module
5
+ * Handles XP, levels, rewards, leaderboards, and rank cards
6
+ */
7
+
8
+ interface LevelingConfig {
9
+ /** XP per message range [min, max] */
10
+ xpPerMessage?: [number, number];
11
+ /** Cooldown between XP gains (seconds) */
12
+ xpCooldown?: number;
13
+ /** XP multiplier for roles */
14
+ roleMultipliers?: Record<string, number>;
15
+ /** Channels where XP is disabled */
16
+ ignoredChannels?: string[];
17
+ /** Roles that don't earn XP */
18
+ ignoredRoles?: string[];
19
+ /** Channel for level up announcements */
20
+ announceChannel?: string;
21
+ /** Level up message */
22
+ levelUpMessage?: string;
23
+ /** Use embed for level up */
24
+ levelUpEmbed?: boolean;
25
+ /** Level rewards (level -> role IDs) */
26
+ rewards?: Record<number, string[]>;
27
+ /** Stack rewards or remove previous */
28
+ stackRewards?: boolean;
29
+ /** Use rank card images */
30
+ useRankCard?: boolean;
31
+ /** Rank card generator name */
32
+ rankCardGenerator?: string;
33
+ /** XP curve formula */
34
+ xpCurve?: 'linear' | 'exponential' | 'custom';
35
+ /** Base XP for level 1 */
36
+ baseXP?: number;
37
+ /** XP multiplier per level */
38
+ xpMultiplier?: number;
39
+ }
40
+ declare const levelingTables: Record<string, TableDefinition>;
41
+ declare const levelingEventHandlers: EventHandler[];
42
+ declare const levelingCommands: CommandDefinition[];
43
+ declare const levelingCanvasGenerators: Record<string, CanvasGenerator>;
44
+ declare function getLevelingSpec(config?: LevelingConfig): Partial<FurlowSpec>;
45
+
46
+ export { type LevelingConfig, getLevelingSpec, levelingCanvasGenerators, levelingCommands, levelingEventHandlers, levelingTables };
@@ -0,0 +1,521 @@
1
+ // src/leveling/index.ts
2
+ var levelingTables = {
3
+ levels: {
4
+ columns: {
5
+ id: { type: "number", primary: true },
6
+ user_id: { type: "string", index: true },
7
+ guild_id: { type: "string", index: true },
8
+ xp: { type: "number", default: 0 },
9
+ level: { type: "number", default: 0 },
10
+ total_messages: { type: "number", default: 0 },
11
+ last_xp_at: { type: "timestamp" }
12
+ }
13
+ }
14
+ };
15
+ var levelingEventHandlers = [
16
+ {
17
+ event: "message",
18
+ condition: "${!message.author.bot && !config.leveling.ignoredChannels?.includes(channel.id)}",
19
+ actions: [
20
+ // Check cooldown
21
+ {
22
+ action: "db_query",
23
+ table: "levels",
24
+ where: {
25
+ user_id: "${user.id}",
26
+ guild_id: "${guild.id}"
27
+ },
28
+ as: "userData"
29
+ },
30
+ // Initialize if new user
31
+ {
32
+ action: "flow_if",
33
+ condition: "${!userData || userData.length === 0}",
34
+ then: [
35
+ {
36
+ action: "db_insert",
37
+ table: "levels",
38
+ data: {
39
+ user_id: "${user.id}",
40
+ guild_id: "${guild.id}",
41
+ xp: 0,
42
+ level: 0,
43
+ total_messages: 0,
44
+ last_xp_at: "${now()}"
45
+ }
46
+ },
47
+ {
48
+ action: "set",
49
+ key: "userData",
50
+ value: [{ xp: 0, level: 0, total_messages: 0, last_xp_at: null }]
51
+ }
52
+ ]
53
+ },
54
+ // Check cooldown
55
+ {
56
+ action: "set",
57
+ key: "cooldownPassed",
58
+ value: "${!userData[0].last_xp_at || (now() - userData[0].last_xp_at) > (config.leveling.xpCooldown || 60) * 1000}"
59
+ },
60
+ {
61
+ action: "flow_if",
62
+ condition: "${cooldownPassed}",
63
+ then: [
64
+ // Calculate XP gain
65
+ {
66
+ action: "set",
67
+ key: "xpRange",
68
+ value: "${config.leveling.xpPerMessage || [15, 25]}"
69
+ },
70
+ {
71
+ action: "set",
72
+ key: "baseXpGain",
73
+ value: "${random(xpRange[0], xpRange[1])}"
74
+ },
75
+ // Apply role multiplier
76
+ {
77
+ action: "set",
78
+ key: "multiplier",
79
+ value: "${config.leveling.roleMultipliers ? (member.roles | map(r => config.leveling.roleMultipliers[r.id] || 1) | max) : 1}"
80
+ },
81
+ {
82
+ action: "set",
83
+ key: "xpGain",
84
+ value: "${floor(baseXpGain * multiplier)}"
85
+ },
86
+ // Calculate new XP and level
87
+ {
88
+ action: "set",
89
+ key: "newXP",
90
+ value: "${userData[0].xp + xpGain}"
91
+ },
92
+ {
93
+ action: "set",
94
+ key: "currentLevel",
95
+ value: "${userData[0].level}"
96
+ },
97
+ // Calculate XP needed for next level
98
+ {
99
+ action: "set",
100
+ key: "xpForNextLevel",
101
+ value: '${config.leveling.xpCurve === "exponential" ? floor((config.leveling.baseXP || 100) * pow(config.leveling.xpMultiplier || 1.5, currentLevel)) : (config.leveling.baseXP || 100) * (currentLevel + 1)}'
102
+ },
103
+ // Check for level up
104
+ {
105
+ action: "set",
106
+ key: "newLevel",
107
+ value: "${newXP >= xpForNextLevel ? currentLevel + 1 : currentLevel}"
108
+ },
109
+ {
110
+ action: "set",
111
+ key: "leveledUp",
112
+ value: "${newLevel > currentLevel}"
113
+ },
114
+ // Update database
115
+ {
116
+ action: "db_update",
117
+ table: "levels",
118
+ where: {
119
+ user_id: "${user.id}",
120
+ guild_id: "${guild.id}"
121
+ },
122
+ data: {
123
+ xp: "${leveledUp ? newXP - xpForNextLevel : newXP}",
124
+ level: "${newLevel}",
125
+ total_messages: "${userData[0].total_messages + 1}",
126
+ last_xp_at: "${now()}"
127
+ }
128
+ },
129
+ // Handle level up
130
+ {
131
+ action: "flow_if",
132
+ condition: "${leveledUp}",
133
+ then: [
134
+ // Announce level up
135
+ {
136
+ action: "flow_if",
137
+ condition: "${config.leveling.announceChannel}",
138
+ then: [
139
+ {
140
+ action: "flow_if",
141
+ condition: "${config.leveling.levelUpEmbed}",
142
+ then: [
143
+ {
144
+ action: "send_message",
145
+ channel: "${config.leveling.announceChannel}",
146
+ embed: {
147
+ title: "Level Up!",
148
+ description: '${config.leveling.levelUpMessage || member.displayName + " has reached level " + newLevel + "!"}',
149
+ color: "#ffd700",
150
+ thumbnail: "${member.avatarURL}"
151
+ }
152
+ }
153
+ ],
154
+ else: [
155
+ {
156
+ action: "send_message",
157
+ channel: "${config.leveling.announceChannel}",
158
+ content: '${config.leveling.levelUpMessage || "Congratulations " + member.displayName + "! You reached level " + newLevel + "!"}'
159
+ }
160
+ ]
161
+ }
162
+ ]
163
+ },
164
+ // Award role rewards
165
+ {
166
+ action: "flow_if",
167
+ condition: "${config.leveling.rewards && config.leveling.rewards[newLevel]}",
168
+ then: [
169
+ // Remove previous rewards if not stacking
170
+ {
171
+ action: "flow_if",
172
+ condition: "${!config.leveling.stackRewards && currentLevel > 0 && config.leveling.rewards[currentLevel]}",
173
+ then: [
174
+ {
175
+ action: "remove_role",
176
+ user: "${member.id}",
177
+ role: "${config.leveling.rewards[currentLevel]}"
178
+ }
179
+ ]
180
+ },
181
+ {
182
+ action: "assign_role",
183
+ user: "${member.id}",
184
+ role: "${config.leveling.rewards[newLevel]}"
185
+ }
186
+ ]
187
+ }
188
+ ]
189
+ }
190
+ ]
191
+ }
192
+ ]
193
+ }
194
+ ];
195
+ var levelingCommands = [
196
+ {
197
+ name: "rank",
198
+ description: "View your rank or another user's rank",
199
+ options: [
200
+ { name: "user", description: "User to check", type: "user", required: false }
201
+ ],
202
+ actions: [
203
+ {
204
+ action: "set",
205
+ key: "targetUser",
206
+ value: "${args.user || user}"
207
+ },
208
+ {
209
+ action: "db_query",
210
+ table: "levels",
211
+ where: {
212
+ user_id: "${targetUser.id}",
213
+ guild_id: "${guild.id}"
214
+ },
215
+ as: "userData"
216
+ },
217
+ {
218
+ action: "flow_if",
219
+ condition: "${!userData || userData.length === 0}",
220
+ then: [
221
+ {
222
+ action: "reply",
223
+ content: "${targetUser.username} has no XP yet!",
224
+ ephemeral: true
225
+ }
226
+ ],
227
+ else: [
228
+ // Get leaderboard position
229
+ {
230
+ action: "db_query",
231
+ table: "levels",
232
+ where: {
233
+ guild_id: "${guild.id}"
234
+ },
235
+ order_by: "level DESC, xp DESC",
236
+ as: "leaderboard"
237
+ },
238
+ {
239
+ action: "set",
240
+ key: "rank",
241
+ value: "${(leaderboard | findIndex(u => u.user_id === targetUser.id)) + 1}"
242
+ },
243
+ {
244
+ action: "set",
245
+ key: "xpForNextLevel",
246
+ value: '${config.leveling.xpCurve === "exponential" ? floor((config.leveling.baseXP || 100) * pow(config.leveling.xpMultiplier || 1.5, userData[0].level)) : (config.leveling.baseXP || 100) * (userData[0].level + 1)}'
247
+ },
248
+ // Render rank card or embed
249
+ {
250
+ action: "flow_if",
251
+ condition: "${config.leveling.useRankCard}",
252
+ then: [
253
+ {
254
+ action: "canvas_render",
255
+ generator: '${config.leveling.rankCardGenerator || "rank_card"}',
256
+ context: {
257
+ user: "${targetUser}",
258
+ member: "${guild.members.cache.get(targetUser.id)}",
259
+ level: "${userData[0].level}",
260
+ xp: "${userData[0].xp}",
261
+ xpNeeded: "${xpForNextLevel}",
262
+ rank: "${rank}",
263
+ totalMessages: "${userData[0].total_messages}"
264
+ },
265
+ as: "rankCard"
266
+ },
267
+ {
268
+ action: "reply",
269
+ files: [
270
+ {
271
+ attachment: "${rankCard}",
272
+ name: "rank.png"
273
+ }
274
+ ]
275
+ }
276
+ ],
277
+ else: [
278
+ {
279
+ action: "reply",
280
+ embed: {
281
+ title: "${targetUser.username}'s Rank",
282
+ color: "#5865f2",
283
+ thumbnail: "${targetUser.avatarURL}",
284
+ fields: [
285
+ { name: "Rank", value: "#${rank}", inline: true },
286
+ { name: "Level", value: "${userData[0].level}", inline: true },
287
+ { name: "XP", value: "${userData[0].xp}/${xpForNextLevel}", inline: true },
288
+ { name: "Messages", value: "${userData[0].total_messages}", inline: true }
289
+ ]
290
+ }
291
+ }
292
+ ]
293
+ }
294
+ ]
295
+ }
296
+ ]
297
+ },
298
+ {
299
+ name: "leaderboard",
300
+ description: "View the server leaderboard",
301
+ options: [
302
+ { name: "page", description: "Page number", type: "integer", required: false }
303
+ ],
304
+ actions: [
305
+ {
306
+ action: "set",
307
+ key: "page",
308
+ value: "${args.page || 1}"
309
+ },
310
+ {
311
+ action: "set",
312
+ key: "perPage",
313
+ value: 10
314
+ },
315
+ {
316
+ action: "db_query",
317
+ table: "levels",
318
+ where: {
319
+ guild_id: "${guild.id}"
320
+ },
321
+ order_by: "level DESC, xp DESC",
322
+ limit: "${perPage}",
323
+ offset: "${(page - 1) * perPage}",
324
+ as: "leaderboard"
325
+ },
326
+ {
327
+ action: "set",
328
+ key: "leaderboardText",
329
+ value: '${leaderboard | mapIndex((entry, i) => "#" + ((page - 1) * perPage + i + 1) + " <@" + entry.user_id + "> - Level " + entry.level + " (" + entry.xp + " XP)") | join("\\n")}'
330
+ },
331
+ {
332
+ action: "reply",
333
+ embed: {
334
+ title: "${guild.name} Leaderboard",
335
+ description: '${leaderboardText || "No entries yet!"}',
336
+ color: "#ffd700",
337
+ footer: {
338
+ text: "Page ${page}"
339
+ }
340
+ }
341
+ }
342
+ ]
343
+ },
344
+ {
345
+ name: "setxp",
346
+ description: "Set a user's XP (admin)",
347
+ options: [
348
+ { name: "user", description: "User to modify", type: "user", required: true },
349
+ { name: "xp", description: "XP amount", type: "integer", required: true }
350
+ ],
351
+ actions: [
352
+ {
353
+ action: "db_update",
354
+ table: "levels",
355
+ where: {
356
+ user_id: "${args.user.id}",
357
+ guild_id: "${guild.id}"
358
+ },
359
+ data: {
360
+ xp: "${args.xp}"
361
+ },
362
+ upsert: true
363
+ },
364
+ {
365
+ action: "reply",
366
+ content: "Set ${args.user.username}'s XP to ${args.xp}",
367
+ ephemeral: true
368
+ }
369
+ ]
370
+ },
371
+ {
372
+ name: "setlevel",
373
+ description: "Set a user's level (admin)",
374
+ options: [
375
+ { name: "user", description: "User to modify", type: "user", required: true },
376
+ { name: "level", description: "Level", type: "integer", required: true }
377
+ ],
378
+ actions: [
379
+ {
380
+ action: "db_update",
381
+ table: "levels",
382
+ where: {
383
+ user_id: "${args.user.id}",
384
+ guild_id: "${guild.id}"
385
+ },
386
+ data: {
387
+ level: "${args.level}",
388
+ xp: 0
389
+ },
390
+ upsert: true
391
+ },
392
+ {
393
+ action: "reply",
394
+ content: "Set ${args.user.username}'s level to ${args.level}",
395
+ ephemeral: true
396
+ }
397
+ ]
398
+ }
399
+ ];
400
+ var levelingCanvasGenerators = {
401
+ rank_card: {
402
+ width: 934,
403
+ height: 282,
404
+ background: "#23272a",
405
+ layers: [
406
+ // Background gradient
407
+ {
408
+ type: "rect",
409
+ x: 0,
410
+ y: 0,
411
+ width: 934,
412
+ height: 282,
413
+ color: "linear-gradient(135deg, #1a1c20 0%, #2c2f33 100%)",
414
+ radius: 20
415
+ },
416
+ // User avatar
417
+ {
418
+ type: "circle_image",
419
+ url: "${user.avatarURL || user.defaultAvatarURL}",
420
+ x: 120,
421
+ y: 141,
422
+ radius: 80,
423
+ border: {
424
+ width: 5,
425
+ color: "#5865f2"
426
+ }
427
+ },
428
+ // Username
429
+ {
430
+ type: "text",
431
+ text: "${user.username}",
432
+ x: 260,
433
+ y: 120,
434
+ font: 'bold 36px "Poppins", sans-serif',
435
+ color: "#ffffff",
436
+ align: "left"
437
+ },
438
+ // Rank badge
439
+ {
440
+ type: "text",
441
+ text: "RANK #${rank}",
442
+ x: 850,
443
+ y: 60,
444
+ font: 'bold 24px "Poppins", sans-serif',
445
+ color: "#7289da",
446
+ align: "right"
447
+ },
448
+ // Level badge
449
+ {
450
+ type: "text",
451
+ text: "LEVEL ${level}",
452
+ x: 850,
453
+ y: 90,
454
+ font: 'bold 32px "Poppins", sans-serif',
455
+ color: "#ffffff",
456
+ align: "right"
457
+ },
458
+ // XP Progress bar background
459
+ {
460
+ type: "rect",
461
+ x: 260,
462
+ y: 180,
463
+ width: 600,
464
+ height: 30,
465
+ color: "#484b4e",
466
+ radius: 15
467
+ },
468
+ // XP Progress bar fill
469
+ {
470
+ type: "progress_bar",
471
+ x: 260,
472
+ y: 180,
473
+ width: 600,
474
+ height: 30,
475
+ progress: "${xp / xpNeeded}",
476
+ color: "linear-gradient(90deg, #5865f2 0%, #7289da 100%)",
477
+ radius: 15
478
+ },
479
+ // XP Text
480
+ {
481
+ type: "text",
482
+ text: "${xp} / ${xpNeeded} XP",
483
+ x: 560,
484
+ y: 160,
485
+ font: '18px "Poppins", sans-serif',
486
+ color: "#99aab5",
487
+ align: "center"
488
+ },
489
+ // Messages count
490
+ {
491
+ type: "text",
492
+ text: "${totalMessages} messages",
493
+ x: 260,
494
+ y: 240,
495
+ font: '16px "Poppins", sans-serif',
496
+ color: "#72767d",
497
+ align: "left"
498
+ }
499
+ ]
500
+ }
501
+ };
502
+ function getLevelingSpec(config = {}) {
503
+ return {
504
+ events: levelingEventHandlers,
505
+ commands: levelingCommands,
506
+ state: {
507
+ tables: levelingTables
508
+ },
509
+ canvas: {
510
+ generators: levelingCanvasGenerators
511
+ }
512
+ };
513
+ }
514
+ export {
515
+ getLevelingSpec,
516
+ levelingCanvasGenerators,
517
+ levelingCommands,
518
+ levelingEventHandlers,
519
+ levelingTables
520
+ };
521
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/leveling/index.ts"],"sourcesContent":["/**\n * Leveling builtin module\n * Handles XP, levels, rewards, leaderboards, and rank cards\n */\n\nimport type { FurlowSpec, CommandDefinition, EventHandler, CanvasGenerator, TableDefinition } from '@furlow/schema';\n\nexport interface LevelingConfig {\n /** XP per message range [min, max] */\n xpPerMessage?: [number, number];\n /** Cooldown between XP gains (seconds) */\n xpCooldown?: number;\n /** XP multiplier for roles */\n roleMultipliers?: Record<string, number>;\n /** Channels where XP is disabled */\n ignoredChannels?: string[];\n /** Roles that don't earn XP */\n ignoredRoles?: string[];\n /** Channel for level up announcements */\n announceChannel?: string;\n /** Level up message */\n levelUpMessage?: string;\n /** Use embed for level up */\n levelUpEmbed?: boolean;\n /** Level rewards (level -> role IDs) */\n rewards?: Record<number, string[]>;\n /** Stack rewards or remove previous */\n stackRewards?: boolean;\n /** Use rank card images */\n useRankCard?: boolean;\n /** Rank card generator name */\n rankCardGenerator?: string;\n /** XP curve formula */\n xpCurve?: 'linear' | 'exponential' | 'custom';\n /** Base XP for level 1 */\n baseXP?: number;\n /** XP multiplier per level */\n xpMultiplier?: number;\n}\n\nexport const levelingTables: Record<string, TableDefinition> = {\n levels: {\n columns: {\n id: { type: 'number', primary: true },\n user_id: { type: 'string', index: true },\n guild_id: { type: 'string', index: true },\n xp: { type: 'number', default: 0 },\n level: { type: 'number', default: 0 },\n total_messages: { type: 'number', default: 0 },\n last_xp_at: { type: 'timestamp' },\n },\n },\n};\n\nexport const levelingEventHandlers: EventHandler[] = [\n {\n event: 'message',\n condition: '${!message.author.bot && !config.leveling.ignoredChannels?.includes(channel.id)}',\n actions: [\n // Check cooldown\n {\n action: 'db_query',\n table: 'levels',\n where: {\n user_id: '${user.id}',\n guild_id: '${guild.id}',\n },\n as: 'userData',\n },\n // Initialize if new user\n {\n action: 'flow_if',\n condition: '${!userData || userData.length === 0}',\n then: [\n {\n action: 'db_insert',\n table: 'levels',\n data: {\n user_id: '${user.id}',\n guild_id: '${guild.id}',\n xp: 0,\n level: 0,\n total_messages: 0,\n last_xp_at: '${now()}',\n },\n },\n {\n action: 'set',\n key: 'userData',\n value: [{ xp: 0, level: 0, total_messages: 0, last_xp_at: null }],\n },\n ],\n },\n // Check cooldown\n {\n action: 'set',\n key: 'cooldownPassed',\n value: '${!userData[0].last_xp_at || (now() - userData[0].last_xp_at) > (config.leveling.xpCooldown || 60) * 1000}',\n },\n {\n action: 'flow_if',\n condition: '${cooldownPassed}',\n then: [\n // Calculate XP gain\n {\n action: 'set',\n key: 'xpRange',\n value: '${config.leveling.xpPerMessage || [15, 25]}',\n },\n {\n action: 'set',\n key: 'baseXpGain',\n value: '${random(xpRange[0], xpRange[1])}',\n },\n // Apply role multiplier\n {\n action: 'set',\n key: 'multiplier',\n value: '${config.leveling.roleMultipliers ? (member.roles | map(r => config.leveling.roleMultipliers[r.id] || 1) | max) : 1}',\n },\n {\n action: 'set',\n key: 'xpGain',\n value: '${floor(baseXpGain * multiplier)}',\n },\n // Calculate new XP and level\n {\n action: 'set',\n key: 'newXP',\n value: '${userData[0].xp + xpGain}',\n },\n {\n action: 'set',\n key: 'currentLevel',\n value: '${userData[0].level}',\n },\n // Calculate XP needed for next level\n {\n action: 'set',\n key: 'xpForNextLevel',\n value: '${config.leveling.xpCurve === \"exponential\" ? floor((config.leveling.baseXP || 100) * pow(config.leveling.xpMultiplier || 1.5, currentLevel)) : (config.leveling.baseXP || 100) * (currentLevel + 1)}',\n },\n // Check for level up\n {\n action: 'set',\n key: 'newLevel',\n value: '${newXP >= xpForNextLevel ? currentLevel + 1 : currentLevel}',\n },\n {\n action: 'set',\n key: 'leveledUp',\n value: '${newLevel > currentLevel}',\n },\n // Update database\n {\n action: 'db_update',\n table: 'levels',\n where: {\n user_id: '${user.id}',\n guild_id: '${guild.id}',\n },\n data: {\n xp: '${leveledUp ? newXP - xpForNextLevel : newXP}',\n level: '${newLevel}',\n total_messages: '${userData[0].total_messages + 1}',\n last_xp_at: '${now()}',\n },\n },\n // Handle level up\n {\n action: 'flow_if',\n condition: '${leveledUp}',\n then: [\n // Announce level up\n {\n action: 'flow_if',\n condition: '${config.leveling.announceChannel}',\n then: [\n {\n action: 'flow_if',\n condition: '${config.leveling.levelUpEmbed}',\n then: [\n {\n action: 'send_message',\n channel: '${config.leveling.announceChannel}',\n embed: {\n title: 'Level Up!',\n description: '${config.leveling.levelUpMessage || member.displayName + \" has reached level \" + newLevel + \"!\"}',\n color: '#ffd700',\n thumbnail: '${member.avatarURL}',\n },\n },\n ],\n else: [\n {\n action: 'send_message',\n channel: '${config.leveling.announceChannel}',\n content: '${config.leveling.levelUpMessage || \"Congratulations \" + member.displayName + \"! You reached level \" + newLevel + \"!\"}',\n },\n ],\n },\n ],\n },\n // Award role rewards\n {\n action: 'flow_if',\n condition: '${config.leveling.rewards && config.leveling.rewards[newLevel]}',\n then: [\n // Remove previous rewards if not stacking\n {\n action: 'flow_if',\n condition: '${!config.leveling.stackRewards && currentLevel > 0 && config.leveling.rewards[currentLevel]}',\n then: [\n {\n action: 'remove_role',\n user: '${member.id}',\n role: '${config.leveling.rewards[currentLevel]}',\n },\n ],\n },\n {\n action: 'assign_role',\n user: '${member.id}',\n role: '${config.leveling.rewards[newLevel]}',\n },\n ],\n },\n ],\n },\n ],\n },\n ],\n },\n];\n\nexport const levelingCommands: CommandDefinition[] = [\n {\n name: 'rank',\n description: 'View your rank or another user\\'s rank',\n options: [\n { name: 'user', description: 'User to check', type: 'user', required: false },\n ],\n actions: [\n {\n action: 'set',\n key: 'targetUser',\n value: '${args.user || user}',\n },\n {\n action: 'db_query',\n table: 'levels',\n where: {\n user_id: '${targetUser.id}',\n guild_id: '${guild.id}',\n },\n as: 'userData',\n },\n {\n action: 'flow_if',\n condition: '${!userData || userData.length === 0}',\n then: [\n {\n action: 'reply',\n content: '${targetUser.username} has no XP yet!',\n ephemeral: true,\n },\n ],\n else: [\n // Get leaderboard position\n {\n action: 'db_query',\n table: 'levels',\n where: {\n guild_id: '${guild.id}',\n },\n order_by: 'level DESC, xp DESC',\n as: 'leaderboard',\n },\n {\n action: 'set',\n key: 'rank',\n value: '${(leaderboard | findIndex(u => u.user_id === targetUser.id)) + 1}',\n },\n {\n action: 'set',\n key: 'xpForNextLevel',\n value: '${config.leveling.xpCurve === \"exponential\" ? floor((config.leveling.baseXP || 100) * pow(config.leveling.xpMultiplier || 1.5, userData[0].level)) : (config.leveling.baseXP || 100) * (userData[0].level + 1)}',\n },\n // Render rank card or embed\n {\n action: 'flow_if',\n condition: '${config.leveling.useRankCard}',\n then: [\n {\n action: 'canvas_render',\n generator: '${config.leveling.rankCardGenerator || \"rank_card\"}',\n context: {\n user: '${targetUser}',\n member: '${guild.members.cache.get(targetUser.id)}',\n level: '${userData[0].level}',\n xp: '${userData[0].xp}',\n xpNeeded: '${xpForNextLevel}',\n rank: '${rank}',\n totalMessages: '${userData[0].total_messages}',\n },\n as: 'rankCard',\n },\n {\n action: 'reply',\n files: [\n {\n attachment: '${rankCard}',\n name: 'rank.png',\n },\n ],\n },\n ],\n else: [\n {\n action: 'reply',\n embed: {\n title: '${targetUser.username}\\'s Rank',\n color: '#5865f2',\n thumbnail: '${targetUser.avatarURL}',\n fields: [\n { name: 'Rank', value: '#${rank}', inline: true },\n { name: 'Level', value: '${userData[0].level}', inline: true },\n { name: 'XP', value: '${userData[0].xp}/${xpForNextLevel}', inline: true },\n { name: 'Messages', value: '${userData[0].total_messages}', inline: true },\n ],\n },\n },\n ],\n },\n ],\n },\n ],\n },\n {\n name: 'leaderboard',\n description: 'View the server leaderboard',\n options: [\n { name: 'page', description: 'Page number', type: 'integer', required: false },\n ],\n actions: [\n {\n action: 'set',\n key: 'page',\n value: '${args.page || 1}',\n },\n {\n action: 'set',\n key: 'perPage',\n value: 10,\n },\n {\n action: 'db_query',\n table: 'levels',\n where: {\n guild_id: '${guild.id}',\n },\n order_by: 'level DESC, xp DESC',\n limit: '${perPage}',\n offset: '${(page - 1) * perPage}',\n as: 'leaderboard',\n },\n {\n action: 'set',\n key: 'leaderboardText',\n value: '${leaderboard | mapIndex((entry, i) => \"#\" + ((page - 1) * perPage + i + 1) + \" <@\" + entry.user_id + \"> - Level \" + entry.level + \" (\" + entry.xp + \" XP)\") | join(\"\\\\n\")}',\n },\n {\n action: 'reply',\n embed: {\n title: '${guild.name} Leaderboard',\n description: '${leaderboardText || \"No entries yet!\"}',\n color: '#ffd700',\n footer: {\n text: 'Page ${page}',\n },\n },\n },\n ],\n },\n {\n name: 'setxp',\n description: 'Set a user\\'s XP (admin)',\n options: [\n { name: 'user', description: 'User to modify', type: 'user', required: true },\n { name: 'xp', description: 'XP amount', type: 'integer', required: true },\n ],\n actions: [\n {\n action: 'db_update',\n table: 'levels',\n where: {\n user_id: '${args.user.id}',\n guild_id: '${guild.id}',\n },\n data: {\n xp: '${args.xp}',\n },\n upsert: true,\n },\n {\n action: 'reply',\n content: 'Set ${args.user.username}\\'s XP to ${args.xp}',\n ephemeral: true,\n },\n ],\n },\n {\n name: 'setlevel',\n description: 'Set a user\\'s level (admin)',\n options: [\n { name: 'user', description: 'User to modify', type: 'user', required: true },\n { name: 'level', description: 'Level', type: 'integer', required: true },\n ],\n actions: [\n {\n action: 'db_update',\n table: 'levels',\n where: {\n user_id: '${args.user.id}',\n guild_id: '${guild.id}',\n },\n data: {\n level: '${args.level}',\n xp: 0,\n },\n upsert: true,\n },\n {\n action: 'reply',\n content: 'Set ${args.user.username}\\'s level to ${args.level}',\n ephemeral: true,\n },\n ],\n },\n];\n\nexport const levelingCanvasGenerators: Record<string, CanvasGenerator> = {\n rank_card: {\n width: 934,\n height: 282,\n background: '#23272a',\n layers: [\n // Background gradient\n {\n type: 'rect',\n x: 0,\n y: 0,\n width: 934,\n height: 282,\n color: 'linear-gradient(135deg, #1a1c20 0%, #2c2f33 100%)',\n radius: 20,\n },\n // User avatar\n {\n type: 'circle_image',\n url: '${user.avatarURL || user.defaultAvatarURL}',\n x: 120,\n y: 141,\n radius: 80,\n border: {\n width: 5,\n color: '#5865f2',\n },\n },\n // Username\n {\n type: 'text',\n text: '${user.username}',\n x: 260,\n y: 120,\n font: 'bold 36px \"Poppins\", sans-serif',\n color: '#ffffff',\n align: 'left',\n },\n // Rank badge\n {\n type: 'text',\n text: 'RANK #${rank}',\n x: 850,\n y: 60,\n font: 'bold 24px \"Poppins\", sans-serif',\n color: '#7289da',\n align: 'right',\n },\n // Level badge\n {\n type: 'text',\n text: 'LEVEL ${level}',\n x: 850,\n y: 90,\n font: 'bold 32px \"Poppins\", sans-serif',\n color: '#ffffff',\n align: 'right',\n },\n // XP Progress bar background\n {\n type: 'rect',\n x: 260,\n y: 180,\n width: 600,\n height: 30,\n color: '#484b4e',\n radius: 15,\n },\n // XP Progress bar fill\n {\n type: 'progress_bar',\n x: 260,\n y: 180,\n width: 600,\n height: 30,\n progress: '${xp / xpNeeded}',\n color: 'linear-gradient(90deg, #5865f2 0%, #7289da 100%)',\n radius: 15,\n },\n // XP Text\n {\n type: 'text',\n text: '${xp} / ${xpNeeded} XP',\n x: 560,\n y: 160,\n font: '18px \"Poppins\", sans-serif',\n color: '#99aab5',\n align: 'center',\n },\n // Messages count\n {\n type: 'text',\n text: '${totalMessages} messages',\n x: 260,\n y: 240,\n font: '16px \"Poppins\", sans-serif',\n color: '#72767d',\n align: 'left',\n },\n ],\n },\n};\n\nexport function getLevelingSpec(config: LevelingConfig = {}): Partial<FurlowSpec> {\n return {\n events: levelingEventHandlers,\n commands: levelingCommands,\n state: {\n tables: levelingTables,\n },\n canvas: {\n generators: levelingCanvasGenerators,\n },\n };\n}\n"],"mappings":";AAwCO,IAAM,iBAAkD;AAAA,EAC7D,QAAQ;AAAA,IACN,SAAS;AAAA,MACP,IAAI,EAAE,MAAM,UAAU,SAAS,KAAK;AAAA,MACpC,SAAS,EAAE,MAAM,UAAU,OAAO,KAAK;AAAA,MACvC,UAAU,EAAE,MAAM,UAAU,OAAO,KAAK;AAAA,MACxC,IAAI,EAAE,MAAM,UAAU,SAAS,EAAE;AAAA,MACjC,OAAO,EAAE,MAAM,UAAU,SAAS,EAAE;AAAA,MACpC,gBAAgB,EAAE,MAAM,UAAU,SAAS,EAAE;AAAA,MAC7C,YAAY,EAAE,MAAM,YAAY;AAAA,IAClC;AAAA,EACF;AACF;AAEO,IAAM,wBAAwC;AAAA,EACnD;AAAA,IACE,OAAO;AAAA,IACP,WAAW;AAAA,IACX,SAAS;AAAA;AAAA,MAEP;AAAA,QACE,QAAQ;AAAA,QACR,OAAO;AAAA,QACP,OAAO;AAAA,UACL,SAAS;AAAA,UACT,UAAU;AAAA,QACZ;AAAA,QACA,IAAI;AAAA,MACN;AAAA;AAAA,MAEA;AAAA,QACE,QAAQ;AAAA,QACR,WAAW;AAAA,QACX,MAAM;AAAA,UACJ;AAAA,YACE,QAAQ;AAAA,YACR,OAAO;AAAA,YACP,MAAM;AAAA,cACJ,SAAS;AAAA,cACT,UAAU;AAAA,cACV,IAAI;AAAA,cACJ,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ACR,UAAU;AAAA,IACV,OAAO;AAAA,MACL,QAAQ;AAAA,IACV;AAAA,IACA,QAAQ;AAAA,MACN,YAAY;AAAA,IACd;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,52 @@
1
+ import { FurlowSpec, CommandDefinition, EventHandler } from '@furlow/schema';
2
+
3
+ /**
4
+ * Logging builtin module
5
+ * Handles comprehensive server logging for messages, members, voice, and moderation
6
+ */
7
+
8
+ interface LoggingConfig {
9
+ /** Default log channel */
10
+ channel?: string;
11
+ /** Separate channels per category */
12
+ channels?: {
13
+ messages?: string;
14
+ members?: string;
15
+ voice?: string;
16
+ server?: string;
17
+ moderation?: string;
18
+ };
19
+ /** Ignored channels */
20
+ ignoredChannels?: string[];
21
+ /** Ignored roles (users with these roles won't be logged) */
22
+ ignoredRoles?: string[];
23
+ /** Events to log */
24
+ events?: {
25
+ messageDelete?: boolean;
26
+ messageEdit?: boolean;
27
+ messageBulkDelete?: boolean;
28
+ memberJoin?: boolean;
29
+ memberLeave?: boolean;
30
+ memberUpdate?: boolean;
31
+ memberBan?: boolean;
32
+ memberUnban?: boolean;
33
+ voiceJoin?: boolean;
34
+ voiceLeave?: boolean;
35
+ voiceMove?: boolean;
36
+ channelCreate?: boolean;
37
+ channelDelete?: boolean;
38
+ channelUpdate?: boolean;
39
+ roleCreate?: boolean;
40
+ roleDelete?: boolean;
41
+ roleUpdate?: boolean;
42
+ inviteCreate?: boolean;
43
+ inviteDelete?: boolean;
44
+ };
45
+ /** Include images in logs */
46
+ includeImages?: boolean;
47
+ }
48
+ declare const loggingEventHandlers: EventHandler[];
49
+ declare const loggingCommands: CommandDefinition[];
50
+ declare function getLoggingSpec(config?: LoggingConfig): Partial<FurlowSpec>;
51
+
52
+ export { type LoggingConfig, getLoggingSpec, loggingCommands, loggingEventHandlers };