VibeSync is a Node.js library to update the status of a Discord voice channel. It simplifies setting and resetting custom status messages for voice channels using the Discord API.
Install VibeSync with:
npm install vibesyncImport the VibeSync class and initialize it with your Discord bot client:
const{ Client, GatewayIntentBits }=require('discord.js');const{ VibeSync }=require('vibesync');constclient=newClient({intents: [GatewayIntentBits.Guilds,GatewayIntentBits.GuildVoiceStates,GatewayIntentBits.GuildMessages,GatewayIntentBits.MessageContent]});constvibeSync=newVibeSync(client);Use setVoiceStatus to set a custom status for a voice channel:
constchannelId='CHANNEL_ID_HERE';conststatus='CUSTOM_STATUS_HERE';vibeSync.setVoiceStatus(channelId,status).then(()=>console.log('Voice channel status updated successfully')).catch(err=>console.error('Failed to update voice channel status:',err));Use resetVoiceStatus to reset the status of a voice channel:
constchannelId='CHANNEL_ID_HERE';vibeSync.resetVoiceStatus(channelId).then(()=>console.log('Voice channel status reset successfully')).catch(err=>console.error('Failed to reset voice channel status:',err));A complete example using VibeSync:
const{ Client, GatewayIntentBits }=require('discord.js');const{ VibeSync }=require('vibesync');constclient=newClient({intents: [GatewayIntentBits.Guilds,GatewayIntentBits.GuildVoiceStates,GatewayIntentBits.GuildMessages,GatewayIntentBits.MessageContent]});constvibeSync=newVibeSync(client);client.once('ready',()=>{console.log(`Logged in as ${client.user.tag}`);});client.on('messageCreate',asyncmessage=>{if(message.author.bot)return;constCHANNEL_ID='CHANNEL_ID_HERE';constchannel=client.channels.cache.get(CHANNEL_ID);if(!channel){awaitmessage.reply('❌ Voice channel not found.');return;}if(message.content.startsWith('!vcstatus')){constargs=message.content.split(' ').slice(1);conststatus=args.join(' ');if(!status){awaitmessage.reply('⚠️ Please provide a status message.');return;}try{awaitvibeSync.setVoiceStatus(CHANNEL_ID,status);awaitmessage.reply('✅ Voice channel status updated.');}catch(err){console.error('Failed to update voice channel status:',err);awaitmessage.reply('❌ Failed to update status. Check console for errors.');}}if(message.content.startsWith('!progressbar')){try{awaitvibeSync.setVoiceStatus(CHANNEL_ID,'▱▱▱▱▱▱');}catch(err){console.error('Failed to update voice channel status:',err);}setTimeout(()=>{vibeSync.setVoiceStatus(CHANNEL_ID,'▰▱▱▱▱▱');},1000);setTimeout(()=>{vibeSync.setVoiceStatus(CHANNEL_ID,'▰▰▱▱▱▱');},2000);setTimeout(()=>{vibeSync.setVoiceStatus(CHANNEL_ID,'▰▰▰▱▱▱');},3000);setTimeout(()=>{vibeSync.setVoiceStatus(CHANNEL_ID,'▰▰▰▰▱▱');},4000);setTimeout(()=>{vibeSync.setVoiceStatus(CHANNEL_ID,'▰▰▰▰▰▱');},5000);setTimeout(()=>{vibeSync.setVoiceStatus(CHANNEL_ID,'▰▰▰▰▰▰');},6000);setTimeout(()=>{vibeSync.resetVoiceStatus(CHANNEL_ID);},7000);}if(message.content==='!vcreset'){try{awaitvibeSync.resetVoiceStatus(CHANNEL_ID);awaitmessage.reply('✅ Voice status reset.');}catch(err){console.error('❌ Voice status couldn\'t be reset:',err);awaitmessage.reply('❌ Voice status couldn\'t be reset.');}}});client.login('TOKEN_HERE');The setVoiceStatus method distinguishes between:
- API errors: Errors returned by the Discord API.
- No response: Cases where no response is received from the API.
- Request setup errors: Issues with creating the request. Errors are logged to the console.
Feel free to contribute to VibeSync by submitting issues or pull requests. Your contributions are welcome!
Feel free to adjust the examples and instructions according to your specific requirements. Let me know if you need any changes or additional details! Adjust the examples and instructions as needed for your requirements!