@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 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/music/index.ts"],"sourcesContent":["/**\n * Music builtin module\n * Handles audio playback, queue management, and filters\n */\n\nimport type { FurlowSpec, CommandDefinition, EventHandler, TableDefinition } from '@furlow/schema';\n\nexport interface MusicConfig {\n /** Default volume (0-100) */\n defaultVolume?: number;\n /** Maximum queue size */\n maxQueueSize?: number;\n /** DJ role (required for some commands) */\n djRole?: string;\n /** Stay in channel when queue empty */\n stayInChannel?: boolean;\n /** Leave after idle (seconds) */\n leaveAfterIdle?: number;\n /** Allow seeking */\n allowSeeking?: boolean;\n /** Allow filters */\n allowFilters?: boolean;\n /** Show now playing messages */\n announceNowPlaying?: boolean;\n /** Announce channel */\n announceChannel?: string;\n}\n\nexport const musicTables: Record<string, TableDefinition> = {\n music_playlists: {\n columns: {\n id: { type: 'number', primary: true },\n guild_id: { type: 'string', index: true },\n user_id: { type: 'string', index: true },\n name: { type: 'string' },\n tracks: { type: 'json' },\n created_at: { type: 'timestamp' },\n },\n },\n};\n\nexport const musicCommands: CommandDefinition[] = [\n {\n name: 'play',\n description: 'Play a song or add to queue',\n options: [\n { name: 'query', description: 'Song URL or search query', type: 'string', required: true },\n ],\n actions: [\n // Check if user is in voice channel\n {\n action: 'flow_if',\n condition: '${!member.voice.channel}',\n then: [\n { action: 'reply', content: 'You must be in a voice channel!', ephemeral: true },\n { action: 'abort' },\n ],\n },\n // Join voice channel if not already\n {\n action: 'voice_join',\n channel: '${member.voice.channel.id}',\n },\n // Search/resolve track\n {\n action: 'voice_search',\n query: '${args.query}',\n as: 'track',\n },\n {\n action: 'flow_if',\n condition: '${!track}',\n then: [\n { action: 'reply', content: 'No results found for: ${args.query}', ephemeral: true },\n { action: 'abort' },\n ],\n },\n // Add to queue\n {\n action: 'queue_add',\n track: '${track}',\n requester: '${user.id}',\n },\n {\n action: 'reply',\n embed: {\n title: 'Added to Queue',\n description: '[${track.title}](${track.url})',\n thumbnail: '${track.thumbnail}',\n color: '#57f287',\n fields: [\n { name: 'Duration', value: '${formatDuration(track.duration)}', inline: true },\n { name: 'Requested by', value: '${user}', inline: true },\n ],\n },\n },\n ],\n },\n {\n name: 'skip',\n description: 'Skip the current song',\n actions: [\n {\n action: 'voice_skip',\n },\n {\n action: 'reply',\n content: 'Skipped the current song.',\n ephemeral: true,\n },\n ],\n },\n {\n name: 'stop',\n description: 'Stop playback and clear the queue',\n actions: [\n {\n action: 'voice_stop',\n },\n {\n action: 'queue_clear',\n },\n {\n action: 'reply',\n content: 'Stopped playback and cleared the queue.',\n ephemeral: true,\n },\n ],\n },\n {\n name: 'pause',\n description: 'Pause playback',\n actions: [\n {\n action: 'voice_pause',\n },\n {\n action: 'reply',\n content: 'Paused playback.',\n ephemeral: true,\n },\n ],\n },\n {\n name: 'resume',\n description: 'Resume playback',\n actions: [\n {\n action: 'voice_resume',\n },\n {\n action: 'reply',\n content: 'Resumed playback.',\n ephemeral: true,\n },\n ],\n },\n {\n name: 'queue',\n description: 'View the current queue',\n options: [\n { name: 'page', description: 'Page number', type: 'integer', required: false },\n ],\n actions: [\n {\n action: 'queue_get',\n as: 'queue',\n },\n {\n action: 'flow_if',\n condition: '${queue.tracks.length === 0}',\n then: [\n { action: 'reply', content: 'The queue is empty!', ephemeral: true },\n { action: 'abort' },\n ],\n },\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: 'set',\n key: 'start',\n value: '${(page - 1) * perPage}',\n },\n {\n action: 'set',\n key: 'queueList',\n value: '${queue.tracks.slice(start, start + perPage).map((t, i) => (start + i + 1) + \". [\" + truncate(t.title, 40) + \"](\" + t.url + \") - \" + formatDuration(t.duration)).join(\"\\\\n\")}',\n },\n {\n action: 'reply',\n embed: {\n title: 'Queue',\n description: '**Now Playing:**\\n[${queue.current.title}](${queue.current.url})\\n\\n**Up Next:**\\n${queueList}',\n color: '#5865f2',\n footer: {\n text: 'Page ${page} | ${queue.tracks.length} tracks | Total: ${formatDuration(queue.totalDuration)}',\n },\n },\n },\n ],\n },\n {\n name: 'nowplaying',\n description: 'Show the currently playing song',\n actions: [\n {\n action: 'queue_get',\n as: 'queue',\n },\n {\n action: 'flow_if',\n condition: '${!queue.current}',\n then: [\n { action: 'reply', content: 'Nothing is playing!', ephemeral: true },\n { action: 'abort' },\n ],\n },\n {\n action: 'set',\n key: 'progress',\n value: '${queue.position / queue.current.duration}',\n },\n {\n action: 'set',\n key: 'progressBar',\n value: '${repeat(\"▓\", floor(progress * 20)) + repeat(\"░\", 20 - floor(progress * 20))}',\n },\n {\n action: 'reply',\n embed: {\n title: 'Now Playing',\n description: '[${queue.current.title}](${queue.current.url})',\n thumbnail: '${queue.current.thumbnail}',\n color: '#5865f2',\n fields: [\n { name: 'Progress', value: '${progressBar}\\n${formatDuration(queue.position)} / ${formatDuration(queue.current.duration)}' },\n { name: 'Requested by', value: '<@${queue.current.requester}>', inline: true },\n { name: 'Volume', value: '${queue.volume}%', inline: true },\n ],\n },\n },\n ],\n },\n {\n name: 'volume',\n description: 'Set the volume',\n options: [\n { name: 'level', description: 'Volume level (0-100)', type: 'integer', required: true },\n ],\n actions: [\n {\n action: 'flow_if',\n condition: '${args.level < 0 || args.level > 100}',\n then: [\n { action: 'reply', content: 'Volume must be between 0 and 100!', ephemeral: true },\n { action: 'abort' },\n ],\n },\n {\n action: 'voice_volume',\n level: '${args.level}',\n },\n {\n action: 'reply',\n content: 'Volume set to ${args.level}%',\n ephemeral: true,\n },\n ],\n },\n {\n name: 'shuffle',\n description: 'Shuffle the queue',\n actions: [\n {\n action: 'queue_shuffle',\n },\n {\n action: 'reply',\n content: 'Shuffled the queue!',\n ephemeral: true,\n },\n ],\n },\n {\n name: 'loop',\n description: 'Set loop mode',\n options: [\n { name: 'mode', description: 'Loop mode', type: 'string', required: true, choices: [\n { name: 'Off', value: 'off' },\n { name: 'Track', value: 'track' },\n { name: 'Queue', value: 'queue' },\n ]},\n ],\n actions: [\n {\n action: 'queue_loop',\n mode: '${args.mode}',\n },\n {\n action: 'reply',\n content: 'Loop mode set to: ${args.mode}',\n ephemeral: true,\n },\n ],\n },\n {\n name: 'seek',\n description: 'Seek to a position in the song',\n options: [\n { name: 'position', description: 'Position (e.g., 1:30, 90)', type: 'string', required: true },\n ],\n actions: [\n {\n action: 'flow_if',\n condition: '${!config.music?.allowSeeking}',\n then: [\n { action: 'reply', content: 'Seeking is disabled!', ephemeral: true },\n { action: 'abort' },\n ],\n },\n {\n action: 'voice_seek',\n position: '${parseDuration(args.position)}',\n },\n {\n action: 'reply',\n content: 'Seeked to ${args.position}',\n ephemeral: true,\n },\n ],\n },\n {\n name: 'filter',\n description: 'Apply an audio filter',\n options: [\n { name: 'filter', description: 'Filter to apply', type: 'string', required: true, choices: [\n { name: 'None', value: 'none' },\n { name: 'Bass Boost', value: 'bassboost' },\n { name: 'Nightcore', value: 'nightcore' },\n { name: 'Vaporwave', value: 'vaporwave' },\n { name: '8D', value: '8d' },\n { name: 'Tremolo', value: 'tremolo' },\n { name: 'Vibrato', value: 'vibrato' },\n ]},\n ],\n actions: [\n {\n action: 'flow_if',\n condition: '${!config.music?.allowFilters}',\n then: [\n { action: 'reply', content: 'Filters are disabled!', ephemeral: true },\n { action: 'abort' },\n ],\n },\n {\n action: 'voice_set_filter',\n filter: '${args.filter}',\n },\n {\n action: 'reply',\n content: 'Applied filter: ${args.filter}',\n ephemeral: true,\n },\n ],\n },\n {\n name: 'leave',\n description: 'Leave the voice channel',\n actions: [\n {\n action: 'voice_leave',\n },\n {\n action: 'reply',\n content: 'Left the voice channel.',\n ephemeral: true,\n },\n ],\n },\n];\n\nexport const musicEventHandlers: EventHandler[] = [\n // Announce now playing\n {\n event: 'voice_track_start',\n condition: '${config.music?.announceNowPlaying}',\n actions: [\n {\n action: 'send_message',\n channel: '${config.music.announceChannel || channel.id}',\n embed: {\n title: 'Now Playing',\n description: '[${track.title}](${track.url})',\n thumbnail: '${track.thumbnail}',\n color: '#5865f2',\n fields: [\n { name: 'Duration', value: '${formatDuration(track.duration)}', inline: true },\n { name: 'Requested by', value: '<@${track.requester}>', inline: true },\n ],\n },\n },\n ],\n },\n // Auto-leave when alone\n {\n event: 'voice_leave',\n condition: '${voiceChannel.members.filter(m => !m.user.bot).size === 0 && !config.music?.stayInChannel}',\n actions: [\n { action: 'wait', duration: 30000 },\n {\n action: 'flow_if',\n condition: '${voiceChannel.members.filter(m => !m.user.bot).size === 0}',\n then: [\n { action: 'voice_leave' },\n ],\n },\n ],\n },\n];\n\nexport function getMusicSpec(config: MusicConfig = {}): Partial<FurlowSpec> {\n return {\n commands: musicCommands,\n events: musicEventHandlers,\n state: {\n tables: musicTables,\n },\n };\n}\n"],"mappings":";AA4BO,IAAM,cAA+C;AAAA,EAC1D,iBAAiB;AAAA,IACf,SAAS;AAAA,MACP,IAAI,EAAE,MAAM,UAAU,SAAS,KAAK;AAAA,MACpC,UAAU,EAAE,MAAM,UAAU,OAAO,KAAK;AAAA,MACxC,SAAS,EAAE,MAAM,UAAU,OAAO,KAAK;AAAA,MACvC,MAAM,EAAE,MAAM,SAAS;AAAA,MACvB,QAAQ,EAAE,MAAM,OAAO;AAAA,MACvB,YAAY,EAAE,MAAM,YAAY;AAAA,IAClC;AAAA,EACF;AACF;AAEO,IAAM,gBAAqC;AAAA,EAChD;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,SAAS;AAAA,MACP,EAAE,MAAM,SAAS,aAAa,4BAA4B,MAAM,UAAU,UAAU,KAAK;AAAA,IAC3F;AAAA,IACA,SAAS;AAAA;AAAA,MAEP;AAAA,QACE,QAAQ;AAAA,QACR,WAAW;AAAA,QACX,MAAM;AAAA,UACJ,EAAE,QAAQ,SAAS,SAAS,mCAAmC,WAAW,KAAK;AAAA,UAC/E,EAAE,QAAQ,QAAQ;AAAA,QACpB;AAAA,MACF;AAAA;AAAA,MAEA;AAAA,QACE,QAAQ;AAAA,QACR,SAAS;AAAA,MACX;AAAA;AAAA,MAEA;A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AAA,EAEA;AAAA,IACE,OAAO;AAAA,IACP,WAAW;AAAA,IACX,SAAS;AAAA,MACP,EAAE,QAAQ,QAAQ,UAAU,IAAM;AAAA,MAClC;AAAA,QACE,QAAQ;AAAA,QACR,WAAW;AAAA,QACX,MAAM;AAAA,UACJ,EAAE,QAAQ,cAAc;AAAA,QAC1B;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEO,SAAS,aAAa,SAAsB,CAAC,GAAwB;AAC1E,SAAO;AAAA,IACL,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,OAAO;AAAA,MACL,QAAQ;AAAA,IACV;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FurlowSpec, CommandDefinition, EventHandler, TableDefinition } from '@furlow/schema';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Polls builtin module
|
|
5
|
+
* Handles poll creation and voting
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
interface PollsConfig {
|
|
9
|
+
/** Maximum poll options */
|
|
10
|
+
maxOptions?: number;
|
|
11
|
+
/** Default poll duration */
|
|
12
|
+
defaultDuration?: string;
|
|
13
|
+
/** Allow anonymous polls */
|
|
14
|
+
allowAnonymous?: boolean;
|
|
15
|
+
}
|
|
16
|
+
declare const pollsTables: Record<string, TableDefinition>;
|
|
17
|
+
declare const pollsEventHandlers: EventHandler[];
|
|
18
|
+
declare const pollsCommands: CommandDefinition[];
|
|
19
|
+
declare function getPollsSpec(config?: PollsConfig): Partial<FurlowSpec>;
|
|
20
|
+
|
|
21
|
+
export { type PollsConfig, getPollsSpec, pollsCommands, pollsEventHandlers, pollsTables };
|
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
// src/polls/index.ts
|
|
2
|
+
var pollsTables = {
|
|
3
|
+
polls: {
|
|
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
|
+
creator_id: { type: "string" },
|
|
10
|
+
question: { type: "string" },
|
|
11
|
+
options: { type: "json" },
|
|
12
|
+
multiple_choice: { type: "boolean", default: false },
|
|
13
|
+
anonymous: { type: "boolean", default: false },
|
|
14
|
+
ends_at: { type: "timestamp" },
|
|
15
|
+
ended: { type: "boolean", default: false },
|
|
16
|
+
created_at: { type: "timestamp" }
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
poll_votes: {
|
|
20
|
+
columns: {
|
|
21
|
+
id: { type: "number", primary: true },
|
|
22
|
+
poll_id: { type: "number", index: true },
|
|
23
|
+
user_id: { type: "string" },
|
|
24
|
+
option_index: { type: "number" },
|
|
25
|
+
created_at: { type: "timestamp" }
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var pollsEventHandlers = [
|
|
30
|
+
// Handle vote button
|
|
31
|
+
{
|
|
32
|
+
event: "button_click",
|
|
33
|
+
condition: '${interaction.customId.startsWith("poll_vote_")}',
|
|
34
|
+
actions: [
|
|
35
|
+
{
|
|
36
|
+
action: "set",
|
|
37
|
+
key: "parts",
|
|
38
|
+
value: '${interaction.customId.split("_")}'
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
action: "set",
|
|
42
|
+
key: "pollId",
|
|
43
|
+
value: "${parts[2]}"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
action: "set",
|
|
47
|
+
key: "optionIndex",
|
|
48
|
+
value: "${parseInt(parts[3])}"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
action: "db_query",
|
|
52
|
+
table: "polls",
|
|
53
|
+
where: { id: "${pollId}" },
|
|
54
|
+
as: "poll"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
action: "flow_if",
|
|
58
|
+
condition: "${!poll[0] || poll[0].ended}",
|
|
59
|
+
then: [
|
|
60
|
+
{ action: "reply", content: "This poll has ended!", ephemeral: true },
|
|
61
|
+
{ action: "abort" }
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
// Check existing vote
|
|
65
|
+
{
|
|
66
|
+
action: "db_query",
|
|
67
|
+
table: "poll_votes",
|
|
68
|
+
where: { poll_id: "${pollId}", user_id: "${user.id}" },
|
|
69
|
+
as: "existingVotes"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
action: "flow_if",
|
|
73
|
+
condition: "${!poll[0].multiple_choice && existingVotes.length > 0}",
|
|
74
|
+
then: [
|
|
75
|
+
// Change vote
|
|
76
|
+
{
|
|
77
|
+
action: "db_update",
|
|
78
|
+
table: "poll_votes",
|
|
79
|
+
where: { poll_id: "${pollId}", user_id: "${user.id}" },
|
|
80
|
+
data: { option_index: "${optionIndex}" }
|
|
81
|
+
},
|
|
82
|
+
{ action: "reply", content: "Vote changed!", ephemeral: true }
|
|
83
|
+
],
|
|
84
|
+
else: [
|
|
85
|
+
// Add vote
|
|
86
|
+
{
|
|
87
|
+
action: "db_insert",
|
|
88
|
+
table: "poll_votes",
|
|
89
|
+
data: {
|
|
90
|
+
poll_id: "${pollId}",
|
|
91
|
+
user_id: "${user.id}",
|
|
92
|
+
option_index: "${optionIndex}",
|
|
93
|
+
created_at: "${now()}"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
{ action: "reply", content: "Vote recorded!", ephemeral: true }
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
// Update poll message
|
|
100
|
+
{
|
|
101
|
+
action: "db_query",
|
|
102
|
+
table: "poll_votes",
|
|
103
|
+
where: { poll_id: "${pollId}" },
|
|
104
|
+
as: "allVotes"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
action: "set",
|
|
108
|
+
key: "totalVotes",
|
|
109
|
+
value: "${allVotes.length}"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
action: "set",
|
|
113
|
+
key: "options",
|
|
114
|
+
value: "${poll[0].options}"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
action: "set",
|
|
118
|
+
key: "voteCounts",
|
|
119
|
+
value: "${options.map((_, i) => allVotes.filter(v => v.option_index === i).length)}"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
action: "set",
|
|
123
|
+
key: "optionText",
|
|
124
|
+
value: '${options.map((opt, i) => opt.emoji + " " + opt.text + " - **" + voteCounts[i] + "** (" + (totalVotes > 0 ? floor(voteCounts[i] / totalVotes * 100) : 0) + "%)").join("\\n")}'
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
action: "edit_message",
|
|
128
|
+
channel: "${poll[0].channel_id}",
|
|
129
|
+
message: "${poll[0].message_id}",
|
|
130
|
+
embed: {
|
|
131
|
+
title: "\u{1F4CA} ${poll[0].question}",
|
|
132
|
+
description: "${optionText}\n\n**Total votes:** ${totalVotes}",
|
|
133
|
+
color: "#5865f2",
|
|
134
|
+
footer: { text: '${poll[0].ends_at ? "Ends " + timestamp(poll[0].ends_at, "R") : "No end time"}' }
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
]
|
|
138
|
+
},
|
|
139
|
+
// Poll end scheduler
|
|
140
|
+
{
|
|
141
|
+
event: "scheduler_tick",
|
|
142
|
+
actions: [
|
|
143
|
+
{
|
|
144
|
+
action: "db_query",
|
|
145
|
+
table: "polls",
|
|
146
|
+
where: { ended: false },
|
|
147
|
+
as: "activePolls"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
action: "batch",
|
|
151
|
+
items: "${activePolls.filter(p => p.ends_at && new Date(p.ends_at) <= now())}",
|
|
152
|
+
each: { action: "emit", event: "poll_end", data: { pollId: "${item.id}" } }
|
|
153
|
+
}
|
|
154
|
+
]
|
|
155
|
+
},
|
|
156
|
+
// End poll
|
|
157
|
+
{
|
|
158
|
+
event: "poll_end",
|
|
159
|
+
actions: [
|
|
160
|
+
{
|
|
161
|
+
action: "db_query",
|
|
162
|
+
table: "polls",
|
|
163
|
+
where: { id: "${event.data.pollId}" },
|
|
164
|
+
as: "poll"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
action: "db_query",
|
|
168
|
+
table: "poll_votes",
|
|
169
|
+
where: { poll_id: "${event.data.pollId}" },
|
|
170
|
+
as: "allVotes"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
action: "db_update",
|
|
174
|
+
table: "polls",
|
|
175
|
+
where: { id: "${event.data.pollId}" },
|
|
176
|
+
data: { ended: true }
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
action: "set",
|
|
180
|
+
key: "options",
|
|
181
|
+
value: "${poll[0].options}"
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
action: "set",
|
|
185
|
+
key: "totalVotes",
|
|
186
|
+
value: "${allVotes.length}"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
action: "set",
|
|
190
|
+
key: "voteCounts",
|
|
191
|
+
value: "${options.map((_, i) => allVotes.filter(v => v.option_index === i).length)}"
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
action: "set",
|
|
195
|
+
key: "maxVotes",
|
|
196
|
+
value: "${Math.max(...voteCounts)}"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
action: "set",
|
|
200
|
+
key: "winners",
|
|
201
|
+
value: "${options.filter((_, i) => voteCounts[i] === maxVotes).map(o => o.text)}"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
action: "set",
|
|
205
|
+
key: "optionText",
|
|
206
|
+
value: '${options.map((opt, i) => (voteCounts[i] === maxVotes ? "\u{1F3C6} " : "") + opt.emoji + " " + opt.text + " - **" + voteCounts[i] + "** (" + (totalVotes > 0 ? floor(voteCounts[i] / totalVotes * 100) : 0) + "%)").join("\\n")}'
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
action: "edit_message",
|
|
210
|
+
channel: "${poll[0].channel_id}",
|
|
211
|
+
message: "${poll[0].message_id}",
|
|
212
|
+
embed: {
|
|
213
|
+
title: "\u{1F4CA} ${poll[0].question} (ENDED)",
|
|
214
|
+
description: "${optionText}\n\n**Total votes:** ${totalVotes}",
|
|
215
|
+
color: "#72767d",
|
|
216
|
+
footer: { text: "Poll ended" }
|
|
217
|
+
},
|
|
218
|
+
components: []
|
|
219
|
+
}
|
|
220
|
+
]
|
|
221
|
+
}
|
|
222
|
+
];
|
|
223
|
+
var pollsCommands = [
|
|
224
|
+
{
|
|
225
|
+
name: "poll",
|
|
226
|
+
description: "Create a poll",
|
|
227
|
+
options: [
|
|
228
|
+
{ name: "question", description: "Poll question", type: "string", required: true },
|
|
229
|
+
{ name: "options", description: "Options separated by |", type: "string", required: true },
|
|
230
|
+
{ name: "duration", description: "Poll duration (e.g., 1h, 1d)", type: "string", required: false },
|
|
231
|
+
{ name: "multiple", description: "Allow multiple choices", type: "boolean", required: false }
|
|
232
|
+
],
|
|
233
|
+
actions: [
|
|
234
|
+
{
|
|
235
|
+
action: "set",
|
|
236
|
+
key: "optionTexts",
|
|
237
|
+
value: '${args.options.split("|").map(o => o.trim()).filter(o => o)}'
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
action: "flow_if",
|
|
241
|
+
condition: "${optionTexts.length < 2}",
|
|
242
|
+
then: [
|
|
243
|
+
{ action: "reply", content: "You need at least 2 options!", ephemeral: true },
|
|
244
|
+
{ action: "abort" }
|
|
245
|
+
]
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
action: "flow_if",
|
|
249
|
+
condition: "${optionTexts.length > (config.polls?.maxOptions || 10)}",
|
|
250
|
+
then: [
|
|
251
|
+
{ action: "reply", content: "Maximum ${config.polls?.maxOptions || 10} options allowed!", ephemeral: true },
|
|
252
|
+
{ action: "abort" }
|
|
253
|
+
]
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
action: "set",
|
|
257
|
+
key: "emojis",
|
|
258
|
+
value: '["1\uFE0F\u20E3", "2\uFE0F\u20E3", "3\uFE0F\u20E3", "4\uFE0F\u20E3", "5\uFE0F\u20E3", "6\uFE0F\u20E3", "7\uFE0F\u20E3", "8\uFE0F\u20E3", "9\uFE0F\u20E3", "\u{1F51F}"]'
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
action: "set",
|
|
262
|
+
key: "options",
|
|
263
|
+
value: "${optionTexts.map((text, i) => ({ text, emoji: emojis[i] }))}"
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
action: "set",
|
|
267
|
+
key: "endsAt",
|
|
268
|
+
value: "${args.duration ? addDuration(now(), args.duration) : null}"
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
action: "set",
|
|
272
|
+
key: "optionDisplay",
|
|
273
|
+
value: '${options.map(o => o.emoji + " " + o.text + " - **0** (0%)").join("\\n")}'
|
|
274
|
+
},
|
|
275
|
+
// Create buttons
|
|
276
|
+
{
|
|
277
|
+
action: "set",
|
|
278
|
+
key: "buttons",
|
|
279
|
+
value: '${options.map((o, i) => ({ type: "button", style: "secondary", emoji: o.emoji, custom_id: "poll_vote_PLACEHOLDER_" + i }))}'
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
action: "set",
|
|
283
|
+
key: "rows",
|
|
284
|
+
value: '${chunk(buttons, 5).map(row => ({ type: "action_row", components: row }))}'
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
action: "send_message",
|
|
288
|
+
channel: "${channel.id}",
|
|
289
|
+
embed: {
|
|
290
|
+
title: "\u{1F4CA} ${args.question}",
|
|
291
|
+
description: "${optionDisplay}\n\n**Total votes:** 0",
|
|
292
|
+
color: "#5865f2",
|
|
293
|
+
footer: { text: '${endsAt ? "Ends " + timestamp(endsAt, "R") : "No end time"}' }
|
|
294
|
+
},
|
|
295
|
+
components: "${rows}",
|
|
296
|
+
as: "pollMessage"
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
action: "db_insert",
|
|
300
|
+
table: "polls",
|
|
301
|
+
data: {
|
|
302
|
+
guild_id: "${guild.id}",
|
|
303
|
+
channel_id: "${channel.id}",
|
|
304
|
+
message_id: "${pollMessage.id}",
|
|
305
|
+
creator_id: "${user.id}",
|
|
306
|
+
question: "${args.question}",
|
|
307
|
+
options: "${options}",
|
|
308
|
+
multiple_choice: "${args.multiple || false}",
|
|
309
|
+
ends_at: "${endsAt}",
|
|
310
|
+
created_at: "${now()}"
|
|
311
|
+
},
|
|
312
|
+
as: "poll"
|
|
313
|
+
},
|
|
314
|
+
// Update buttons with correct poll ID
|
|
315
|
+
{
|
|
316
|
+
action: "set",
|
|
317
|
+
key: "buttons",
|
|
318
|
+
value: '${options.map((o, i) => ({ type: "button", style: "secondary", emoji: o.emoji, custom_id: "poll_vote_" + poll.id + "_" + i }))}'
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
action: "set",
|
|
322
|
+
key: "rows",
|
|
323
|
+
value: '${chunk(buttons, 5).map(row => ({ type: "action_row", components: row }))}'
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
action: "edit_message",
|
|
327
|
+
channel: "${channel.id}",
|
|
328
|
+
message: "${pollMessage.id}",
|
|
329
|
+
components: "${rows}"
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
action: "reply",
|
|
333
|
+
content: "Poll created!",
|
|
334
|
+
ephemeral: true
|
|
335
|
+
}
|
|
336
|
+
]
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
name: "endpoll",
|
|
340
|
+
description: "End a poll early",
|
|
341
|
+
options: [
|
|
342
|
+
{ name: "message_id", description: "Poll message ID", type: "string", required: true }
|
|
343
|
+
],
|
|
344
|
+
actions: [
|
|
345
|
+
{
|
|
346
|
+
action: "db_query",
|
|
347
|
+
table: "polls",
|
|
348
|
+
where: { message_id: "${args.message_id}" },
|
|
349
|
+
as: "poll"
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
action: "flow_if",
|
|
353
|
+
condition: "${!poll[0]}",
|
|
354
|
+
then: [
|
|
355
|
+
{ action: "reply", content: "Poll not found!", ephemeral: true },
|
|
356
|
+
{ action: "abort" }
|
|
357
|
+
]
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
action: "flow_if",
|
|
361
|
+
condition: '${poll[0].creator_id !== user.id && !member.permissions.has("MANAGE_MESSAGES")}',
|
|
362
|
+
then: [
|
|
363
|
+
{ action: "reply", content: "You can only end your own polls!", ephemeral: true },
|
|
364
|
+
{ action: "abort" }
|
|
365
|
+
]
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
action: "emit",
|
|
369
|
+
event: "poll_end",
|
|
370
|
+
data: { pollId: "${poll[0].id}" }
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
action: "reply",
|
|
374
|
+
content: "Poll ended!",
|
|
375
|
+
ephemeral: true
|
|
376
|
+
}
|
|
377
|
+
]
|
|
378
|
+
}
|
|
379
|
+
];
|
|
380
|
+
function getPollsSpec(config = {}) {
|
|
381
|
+
return {
|
|
382
|
+
commands: pollsCommands,
|
|
383
|
+
events: pollsEventHandlers,
|
|
384
|
+
state: {
|
|
385
|
+
tables: pollsTables
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
export {
|
|
390
|
+
getPollsSpec,
|
|
391
|
+
pollsCommands,
|
|
392
|
+
pollsEventHandlers,
|
|
393
|
+
pollsTables
|
|
394
|
+
};
|
|
395
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/polls/index.ts"],"sourcesContent":["/**\n * Polls builtin module\n * Handles poll creation and voting\n */\n\nimport type { FurlowSpec, CommandDefinition, EventHandler, TableDefinition } from '@furlow/schema';\n\nexport interface PollsConfig {\n /** Maximum poll options */\n maxOptions?: number;\n /** Default poll duration */\n defaultDuration?: string;\n /** Allow anonymous polls */\n allowAnonymous?: boolean;\n}\n\nexport const pollsTables: Record<string, TableDefinition> = {\n polls: {\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 creator_id: { type: 'string' },\n question: { type: 'string' },\n options: { type: 'json' },\n multiple_choice: { type: 'boolean', default: false },\n anonymous: { type: 'boolean', default: false },\n ends_at: { type: 'timestamp' },\n ended: { type: 'boolean', default: false },\n created_at: { type: 'timestamp' },\n },\n },\n poll_votes: {\n columns: {\n id: { type: 'number', primary: true },\n poll_id: { type: 'number', index: true },\n user_id: { type: 'string' },\n option_index: { type: 'number' },\n created_at: { type: 'timestamp' },\n },\n },\n};\n\nexport const pollsEventHandlers: EventHandler[] = [\n // Handle vote button\n {\n event: 'button_click',\n condition: '${interaction.customId.startsWith(\"poll_vote_\")}',\n actions: [\n {\n action: 'set',\n key: 'parts',\n value: '${interaction.customId.split(\"_\")}',\n },\n {\n action: 'set',\n key: 'pollId',\n value: '${parts[2]}',\n },\n {\n action: 'set',\n key: 'optionIndex',\n value: '${parseInt(parts[3])}',\n },\n {\n action: 'db_query',\n table: 'polls',\n where: { id: '${pollId}' },\n as: 'poll',\n },\n {\n action: 'flow_if',\n condition: '${!poll[0] || poll[0].ended}',\n then: [\n { action: 'reply', content: 'This poll has ended!', ephemeral: true },\n { action: 'abort' },\n ],\n },\n // Check existing vote\n {\n action: 'db_query',\n table: 'poll_votes',\n where: { poll_id: '${pollId}', user_id: '${user.id}' },\n as: 'existingVotes',\n },\n {\n action: 'flow_if',\n condition: '${!poll[0].multiple_choice && existingVotes.length > 0}',\n then: [\n // Change vote\n {\n action: 'db_update',\n table: 'poll_votes',\n where: { poll_id: '${pollId}', user_id: '${user.id}' },\n data: { option_index: '${optionIndex}' },\n },\n { action: 'reply', content: 'Vote changed!', ephemeral: true },\n ],\n else: [\n // Add vote\n {\n action: 'db_insert',\n table: 'poll_votes',\n data: {\n poll_id: '${pollId}',\n user_id: '${user.id}',\n option_index: '${optionIndex}',\n created_at: '${now()}',\n },\n },\n { action: 'reply', content: 'Vote recorded!', ephemeral: true },\n ],\n },\n // Update poll message\n {\n action: 'db_query',\n table: 'poll_votes',\n where: { poll_id: '${pollId}' },\n as: 'allVotes',\n },\n {\n action: 'set',\n key: 'totalVotes',\n value: '${allVotes.length}',\n },\n {\n action: 'set',\n key: 'options',\n value: '${poll[0].options}',\n },\n {\n action: 'set',\n key: 'voteCounts',\n value: '${options.map((_, i) => allVotes.filter(v => v.option_index === i).length)}',\n },\n {\n action: 'set',\n key: 'optionText',\n value: '${options.map((opt, i) => opt.emoji + \" \" + opt.text + \" - **\" + voteCounts[i] + \"** (\" + (totalVotes > 0 ? floor(voteCounts[i] / totalVotes * 100) : 0) + \"%)\").join(\"\\\\n\")}',\n },\n {\n action: 'edit_message',\n channel: '${poll[0].channel_id}',\n message: '${poll[0].message_id}',\n embed: {\n title: '📊 ${poll[0].question}',\n description: '${optionText}\\n\\n**Total votes:** ${totalVotes}',\n color: '#5865f2',\n footer: { text: '${poll[0].ends_at ? \"Ends \" + timestamp(poll[0].ends_at, \"R\") : \"No end time\"}' },\n },\n },\n ],\n },\n // Poll end scheduler\n {\n event: 'scheduler_tick',\n actions: [\n {\n action: 'db_query',\n table: 'polls',\n where: { ended: false },\n as: 'activePolls',\n },\n {\n action: 'batch',\n items: '${activePolls.filter(p => p.ends_at && new Date(p.ends_at) <= now())}',\n each: { action: 'emit', event: 'poll_end', data: { pollId: '${item.id}' } },\n },\n ],\n },\n // End poll\n {\n event: 'poll_end',\n actions: [\n {\n action: 'db_query',\n table: 'polls',\n where: { id: '${event.data.pollId}' },\n as: 'poll',\n },\n {\n action: 'db_query',\n table: 'poll_votes',\n where: { poll_id: '${event.data.pollId}' },\n as: 'allVotes',\n },\n {\n action: 'db_update',\n table: 'polls',\n where: { id: '${event.data.pollId}' },\n data: { ended: true },\n },\n {\n action: 'set',\n key: 'options',\n value: '${poll[0].options}',\n },\n {\n action: 'set',\n key: 'totalVotes',\n value: '${allVotes.length}',\n },\n {\n action: 'set',\n key: 'voteCounts',\n value: '${options.map((_, i) => allVotes.filter(v => v.option_index === i).length)}',\n },\n {\n action: 'set',\n key: 'maxVotes',\n value: '${Math.max(...voteCounts)}',\n },\n {\n action: 'set',\n key: 'winners',\n value: '${options.filter((_, i) => voteCounts[i] === maxVotes).map(o => o.text)}',\n },\n {\n action: 'set',\n key: 'optionText',\n value: '${options.map((opt, i) => (voteCounts[i] === maxVotes ? \"🏆 \" : \"\") + opt.emoji + \" \" + opt.text + \" - **\" + voteCounts[i] + \"** (\" + (totalVotes > 0 ? floor(voteCounts[i] / totalVotes * 100) : 0) + \"%)\").join(\"\\\\n\")}',\n },\n {\n action: 'edit_message',\n channel: '${poll[0].channel_id}',\n message: '${poll[0].message_id}',\n embed: {\n title: '📊 ${poll[0].question} (ENDED)',\n description: '${optionText}\\n\\n**Total votes:** ${totalVotes}',\n color: '#72767d',\n footer: { text: 'Poll ended' },\n },\n components: [],\n },\n ],\n },\n];\n\nexport const pollsCommands: CommandDefinition[] = [\n {\n name: 'poll',\n description: 'Create a poll',\n options: [\n { name: 'question', description: 'Poll question', type: 'string', required: true },\n { name: 'options', description: 'Options separated by |', type: 'string', required: true },\n { name: 'duration', description: 'Poll duration (e.g., 1h, 1d)', type: 'string', required: false },\n { name: 'multiple', description: 'Allow multiple choices', type: 'boolean', required: false },\n ],\n actions: [\n {\n action: 'set',\n key: 'optionTexts',\n value: '${args.options.split(\"|\").map(o => o.trim()).filter(o => o)}',\n },\n {\n action: 'flow_if',\n condition: '${optionTexts.length < 2}',\n then: [\n { action: 'reply', content: 'You need at least 2 options!', ephemeral: true },\n { action: 'abort' },\n ],\n },\n {\n action: 'flow_if',\n condition: '${optionTexts.length > (config.polls?.maxOptions || 10)}',\n then: [\n { action: 'reply', content: 'Maximum ${config.polls?.maxOptions || 10} options allowed!', ephemeral: true },\n { action: 'abort' },\n ],\n },\n {\n action: 'set',\n key: 'emojis',\n value: '[\"1️⃣\", \"2️⃣\", \"3️⃣\", \"4️⃣\", \"5️⃣\", \"6️⃣\", \"7️⃣\", \"8️⃣\", \"9️⃣\", \"🔟\"]',\n },\n {\n action: 'set',\n key: 'options',\n value: '${optionTexts.map((text, i) => ({ text, emoji: emojis[i] }))}',\n },\n {\n action: 'set',\n key: 'endsAt',\n value: '${args.duration ? addDuration(now(), args.duration) : null}',\n },\n {\n action: 'set',\n key: 'optionDisplay',\n value: '${options.map(o => o.emoji + \" \" + o.text + \" - **0** (0%)\").join(\"\\\\n\")}',\n },\n // Create buttons\n {\n action: 'set',\n key: 'buttons',\n value: '${options.map((o, i) => ({ type: \"button\", style: \"secondary\", emoji: o.emoji, custom_id: \"poll_vote_PLACEHOLDER_\" + i }))}',\n },\n {\n action: 'set',\n key: 'rows',\n value: '${chunk(buttons, 5).map(row => ({ type: \"action_row\", components: row }))}',\n },\n {\n action: 'send_message',\n channel: '${channel.id}',\n embed: {\n title: '📊 ${args.question}',\n description: '${optionDisplay}\\n\\n**Total votes:** 0',\n color: '#5865f2',\n footer: { text: '${endsAt ? \"Ends \" + timestamp(endsAt, \"R\") : \"No end time\"}' },\n },\n components: '${rows}',\n as: 'pollMessage',\n },\n {\n action: 'db_insert',\n table: 'polls',\n data: {\n guild_id: '${guild.id}',\n channel_id: '${channel.id}',\n message_id: '${pollMessage.id}',\n creator_id: '${user.id}',\n question: '${args.question}',\n options: '${options}',\n multiple_choice: '${args.multiple || false}',\n ends_at: '${endsAt}',\n created_at: '${now()}',\n },\n as: 'poll',\n },\n // Update buttons with correct poll ID\n {\n action: 'set',\n key: 'buttons',\n value: '${options.map((o, i) => ({ type: \"button\", style: \"secondary\", emoji: o.emoji, custom_id: \"poll_vote_\" + poll.id + \"_\" + i }))}',\n },\n {\n action: 'set',\n key: 'rows',\n value: '${chunk(buttons, 5).map(row => ({ type: \"action_row\", components: row }))}',\n },\n {\n action: 'edit_message',\n channel: '${channel.id}',\n message: '${pollMessage.id}',\n components: '${rows}',\n },\n {\n action: 'reply',\n content: 'Poll created!',\n ephemeral: true,\n },\n ],\n },\n {\n name: 'endpoll',\n description: 'End a poll early',\n options: [\n { name: 'message_id', description: 'Poll message ID', type: 'string', required: true },\n ],\n actions: [\n {\n action: 'db_query',\n table: 'polls',\n where: { message_id: '${args.message_id}' },\n as: 'poll',\n },\n {\n action: 'flow_if',\n condition: '${!poll[0]}',\n then: [\n { action: 'reply', content: 'Poll not found!', ephemeral: true },\n { action: 'abort' },\n ],\n },\n {\n action: 'flow_if',\n condition: '${poll[0].creator_id !== user.id && !member.permissions.has(\"MANAGE_MESSAGES\")}',\n then: [\n { action: 'reply', content: 'You can only end your own polls!', ephemeral: true },\n { action: 'abort' },\n ],\n },\n {\n action: 'emit',\n event: 'poll_end',\n data: { pollId: '${poll[0].id}' },\n },\n {\n action: 'reply',\n content: 'Poll ended!',\n ephemeral: true,\n },\n ],\n },\n];\n\nexport function getPollsSpec(config: PollsConfig = {}): Partial<FurlowSpec> {\n return {\n commands: pollsCommands,\n events: pollsEventHandlers,\n state: {\n tables: pollsTables,\n },\n };\n}\n"],"mappings":";AAgBO,IAAM,cAA+C;AAAA,EAC1D,OAAO;AAAA,IACL,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,YAAY,EAAE,MAAM,SAAS;AAAA,MAC7B,UAAU,EAAE,MAAM,SAAS;AAAA,MAC3B,SAAS,EAAE,MAAM,OAAO;AAAA,MACxB,iBAAiB,EAAE,MAAM,WAAW,SAAS,MAAM;AAAA,MACnD,WAAW,EAAE,MAAM,WAAW,SAAS,MAAM;AAAA,MAC7C,SAAS,EAAE,MAAM,YAAY;AAAA,MAC7B,OAAO,EAAE,MAAM,WAAW,SAAS,MAAM;AAAA,MACzC,YAAY,EAAE,MAAM,YAAY;AAAA,IAClC;AAAA,EACF;AAAA,EACA,YAAY;AAAA,IACV,SAAS;AAAA,MACP,IAAI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,UAChF,EAAE,QAAQ,QAAQ;AAAA,QACpB;AAAA,MACF;AAAA,MACA;AAAA,QACE,QAAQ;AAAA,QACR,OAAO;AAAA,QACP,MAAM,EAAE,QAAQ,gBAAgB;AAAA,MAClC;AAAA,MACA;AAAA,QACE,QAAQ;AAAA,QACR,SAAS;AAAA,QACT,WAAW;AAAA,MACb;AAAA,IACF;AAAA,EACF;AACF;AAEO,SAAS,aAAa,SAAsB,CAAC,GAAwB;AAC1E,SAAO;AAAA,IACL,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,OAAO;AAAA,MACL,QAAQ;AAAA,IACV;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FurlowSpec, CommandDefinition, EventHandler, TableDefinition } from '@furlow/schema';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Reaction Roles builtin module
|
|
5
|
+
* Handles button roles, reaction roles, and select menu roles
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
interface ReactionRolesConfig {
|
|
9
|
+
/** Maximum roles a user can have from a single panel */
|
|
10
|
+
maxRolesPerPanel?: number;
|
|
11
|
+
/** Log channel for role assignments */
|
|
12
|
+
logChannel?: string;
|
|
13
|
+
}
|
|
14
|
+
declare const reactionRolesTables: Record<string, TableDefinition>;
|
|
15
|
+
declare const reactionRolesEventHandlers: EventHandler[];
|
|
16
|
+
declare const reactionRolesCommands: CommandDefinition[];
|
|
17
|
+
declare function getReactionRolesSpec(config?: ReactionRolesConfig): Partial<FurlowSpec>;
|
|
18
|
+
|
|
19
|
+
export { type ReactionRolesConfig, getReactionRolesSpec, reactionRolesCommands, reactionRolesEventHandlers, reactionRolesTables };
|