Add emoji prefixes to remaining categories
📢 Welcome & Info 💬 Community Hub 🔊 Voice Channels 📞 Support Chronicler: #71
This commit is contained in:
73
services/arbiter-3.0/scripts/add-category-emojis.js
Normal file
73
services/arbiter-3.0/scripts/add-category-emojis.js
Normal file
@@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Add Emoji Prefixes to Categories
|
||||
* Adds consistent emoji prefixes to non-server categories
|
||||
*
|
||||
* Created: April 8, 2026
|
||||
* Chronicler: #71
|
||||
*/
|
||||
|
||||
require('dotenv').config({ path: '/opt/arbiter-3.0/.env' });
|
||||
const { Client, GatewayIntentBits, ChannelType } = require('discord.js');
|
||||
|
||||
const RENAMES = [
|
||||
{ from: 'Welcome & Info', to: '📢 Welcome & Info' },
|
||||
{ from: 'Community Hub', to: '💬 Community Hub' },
|
||||
{ from: 'Voice Channels', to: '🔊 Voice Channels' },
|
||||
{ from: 'Support', to: '📞 Support' }
|
||||
];
|
||||
|
||||
function sleep(ms) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
async function main() {
|
||||
console.log('🏷️ Add Emoji Prefixes to Categories');
|
||||
console.log('=====================================');
|
||||
|
||||
const client = new Client({
|
||||
intents: [GatewayIntentBits.Guilds]
|
||||
});
|
||||
|
||||
try {
|
||||
await client.login(process.env.DISCORD_BOT_TOKEN);
|
||||
await new Promise(resolve => {
|
||||
if (client.isReady()) resolve();
|
||||
else client.once('ready', resolve);
|
||||
});
|
||||
console.log(`✅ Logged in as ${client.user.tag}`);
|
||||
|
||||
const guild = client.guilds.cache.get(process.env.GUILD_ID);
|
||||
await guild.channels.fetch();
|
||||
console.log(`✅ Found guild: ${guild.name}`);
|
||||
console.log('');
|
||||
|
||||
let renamed = 0;
|
||||
|
||||
for (const rename of RENAMES) {
|
||||
const category = guild.channels.cache.find(
|
||||
ch => ch.type === ChannelType.GuildCategory && ch.name === rename.from
|
||||
);
|
||||
|
||||
if (!category) {
|
||||
console.log(`⚠️ Not found: ${rename.from}`);
|
||||
continue;
|
||||
}
|
||||
|
||||
await category.setName(rename.to, 'Adding emoji prefix - Chronicler #71');
|
||||
console.log(`✅ ${rename.from} → ${rename.to}`);
|
||||
renamed++;
|
||||
await sleep(500);
|
||||
}
|
||||
|
||||
console.log('');
|
||||
console.log(`✅ Renamed ${renamed} categories`);
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ ERROR:', error.message);
|
||||
} finally {
|
||||
client.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
||||
Reference in New Issue
Block a user