Functional joining and leaving

- Needs to be tested on multiple servers
- Needs to be tested with multiple nodes
#1 #9
This commit is contained in:
Logan Cusano
2024-02-18 20:05:10 -05:00
parent 6bc09df824
commit 42784f1852
7 changed files with 210 additions and 42 deletions

View File

@@ -97,6 +97,10 @@ export async function checkIfConnectedToVC(guildId) {
return connection
}
export const getVoiceConnectionFromGuild = async (guildId) => {
return getVoiceConnection(guildId);
}
export async function initDiscordBotClient(token, systemName, readyCallback) {
const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildVoiceStates, GatewayIntentBits.MessageContent],
@@ -104,10 +108,16 @@ export async function initDiscordBotClient(token, systemName, readyCallback) {
client.on(Events.ClientReady, () => {
console.log('discord.js client is ready!');
// Attach the recorder to the VC connection
attachRecorder();
// Set the activity of the bot user
client.user.setPresence({
activities: [{ name: `${systemName}`, type: ActivityType.Listening }],
});
//
readyCallback(client);
});