Improve SFX list formatting and add smart markdown chunking

- Add smart chunking logic that respects markdown block boundaries
- Prevent code blocks from being split across Discord messages
- Update SFX list display to use improved README.md formatting
- Ensure proper markdown rendering in Discord chat

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Chris Ham
2025-08-16 15:13:43 -07:00
parent f8147ffb14
commit c3adb66de8
2 changed files with 38 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
**GENERAL**
```
2+2, ahhh, alert, aspen, auw, aww, bonk, bustin, chafe, chipotle, chomp, choochoo, correct, date, dong, duck, enjoy, ez, fakehands, fbrage, fine, flippers, funnyhow, gatekeepah, gcn, groovy, gyst, help, herewego, heyheyhey, heymf, highscore, hop, how, hype, idgaf, imawot, interesting, jacked, knob, lab, laugh, lisa, long, mad, massage, mayo, meme, mmmm, mouthfeel, mybody, neat, nevergiveup, obaeb, ohno, okusa, onejoint, onfire, ow, poopy, popup, porkchop, pour, ppump, qty, raffle, rawr, rentfree, respect, robotears, rpgfarm, sdgtw, sendit, sofast, sogood, stick, store, suh, swag, tasty, tea, thatthing, theline, tmm, tojesus, tootski, trash, triple, urf, wahwah, wanker, waow, wdied, wow, yahoo, yippee, yoshi, youguys
2+2, ahhh, alert, aspen, auw, aww, bonk, bustin, chafe, chipotle, chomp, choochoo, cooler, correct, date, dong, duck, enjoy, ez, fakehands, fbrage, fine, flippers, funnyhow, gatekeepah, gcn, groovy, gyst, help, herewego, heyheyhey, heymf, highscore, hop, how, hype, idgaf, imawot, interesting, jacked, knob, lab, laugh, lisa, long, mad, massage, mayo, meme, mmmm, mouthfeel, mybody, neat, nevergiveup, obaeb, ohno, okusa, onejoint, onfire, ow, poopy, popup, porkchop, pour, ppump, qty, raffle, rawr, rentfree, respect, robotears, rpgfarm, sdgtw, sendit, sofast, sogood, stick, store, suh, swag, tasty, tea, thatthing, theline, tmm, tojesus, tootski, trash, triple, urf, wahwah, wanker, waow, wdied, wow, yahoo, yippee, yoshi, youguys
```
**NERDS**
@@ -112,8 +112,8 @@ algore, crush, cumin, dd, goldcaps
bill
```
**MISC**
**UTILITY**
```
cd, cooler, slowmo-in, slowmo-out
cd, slowmo-in, slowmo-out
```

View File

@@ -6,6 +6,39 @@ const voiceService = require('../../services/voiceService');
module.exports = {
name: 'sfx',
description: 'Play a sound effect',
/**
* Smart chunking that respects markdown block boundaries
* @param {string} content
* @param {number} maxLength
* @returns {Array<string>}
*/
smartChunkMarkdown(content, maxLength) {
const chunks = [];
const sections = content.split(/(\*\*[^*]+\*\*)/); // Split on headers while keeping them
let currentChunk = '';
for (const section of sections) {
// If adding this section would exceed the limit
if (currentChunk.length + section.length > maxLength) {
// Save current chunk if it has content
if (currentChunk.trim()) {
chunks.push(currentChunk.trim());
}
currentChunk = section;
} else {
currentChunk += section;
}
}
// Add the final chunk
if (currentChunk.trim()) {
chunks.push(currentChunk.trim());
}
return chunks;
},
async execute(message, args, guildConfig) {
// Check if SFX is allowed in this channel
@@ -39,7 +72,8 @@ module.exports = {
if (sfxListContent.length <= 2000) {
await message.channel.send(sfxListContent);
} else {
const chunks = chunkSubstr(sfxListContent, 1900); // Leave some buffer
// Smart chunking that respects markdown block boundaries
const chunks = this.smartChunkMarkdown(sfxListContent, 1900);
for (const chunk of chunks) {
await message.channel.send(chunk);