Update SFX list and improve display functionality

- Update sfx/README.md to include all 275 sound files with proper categorization
- Organize missing sounds into appropriate categories (SILICON VALLEY, KING OF THE HILL, etc.)
- Fix SFX list display to use local README.md instead of external URL
- Add fallback to auto-generated list if README is missing
- Improve chunking to prevent Discord character limit errors

🤖 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 14:54:40 -07:00
parent 80b21e5073
commit 437206851b
6 changed files with 82 additions and 11 deletions

View File

@@ -28,20 +28,32 @@ module.exports = {
// If no SFX specified, show the list
if (!sfxName) {
try {
const response = await axios.get('https://rentry.co/ghbotsfx/raw');
const fs = require('fs');
const path = require('path');
const sfxReadmePath = path.join(__dirname, '..', '..', '..', 'sfx', 'README.md');
// Break into chunks if message is too long
let chunks = [response.data];
if (response.data.length > 2000) {
chunks = chunkSubstr(response.data, Math.ceil(response.data.length / 2));
}
for (const chunk of chunks) {
await message.channel.send(chunk);
if (fs.existsSync(sfxReadmePath)) {
const sfxListContent = fs.readFileSync(sfxReadmePath, 'utf-8');
// Break into chunks if too long (Discord limit is 2000 characters)
if (sfxListContent.length <= 2000) {
await message.channel.send(sfxListContent);
} else {
const chunks = chunkSubstr(sfxListContent, 1900); // Leave some buffer
for (const chunk of chunks) {
await message.channel.send(chunk);
}
}
} else {
// Fallback to generated list if README doesn't exist
const sfxNames = sfxManager.getSFXNames();
const sfxList = `**Available Sound Effects (${sfxNames.length}):**\n\`\`\`\n${sfxNames.join(', ')}\n\`\`\``;
await message.channel.send(sfxList);
}
} catch (error) {
console.error('Error fetching SFX list:', error);
await message.reply('Could not fetch the SFX list.');
console.error('Error reading SFX list:', error);
await message.reply('Could not load the SFX list.');
}
return;
}