Added activity when listening to system
This commit is contained in:
@@ -12,7 +12,7 @@ import {
|
||||
|
||||
import { GatewayIntentBits } from 'discord-api-types/v10';
|
||||
|
||||
import { Client, Events } from 'discord.js';
|
||||
import { Client, Events, ActivityType } from 'discord.js';
|
||||
|
||||
import prism_media from 'prism-media';
|
||||
const { FFmpeg } = prism_media;
|
||||
@@ -97,7 +97,7 @@ export async function checkIfConnectedToVC(guildId) {
|
||||
return connection
|
||||
}
|
||||
|
||||
export async function initDiscordBotClient(token, readyCallback){
|
||||
export async function initDiscordBotClient(token, systemName, readyCallback) {
|
||||
const client = new Client({
|
||||
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildVoiceStates, GatewayIntentBits.MessageContent],
|
||||
});
|
||||
@@ -105,6 +105,9 @@ export async function initDiscordBotClient(token, readyCallback){
|
||||
client.on(Events.ClientReady, () => {
|
||||
console.log('discord.js client is ready!');
|
||||
attachRecorder();
|
||||
client.user.setPresence({
|
||||
activities: [{ name: `${systemName}`, type: ActivityType.Listening }],
|
||||
});
|
||||
readyCallback(client);
|
||||
});
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ export const initSocketConnection = async (localNodeConfig) => {
|
||||
// TODO - Implement logic to control OP25 for the requested channel/system
|
||||
|
||||
// Join the requested channel with the requested ID
|
||||
initDiscordBotClient(joinData.clientID, client => {
|
||||
initDiscordBotClient(joinData.clientID, joinData.system, client => {
|
||||
getVoiceChannelFromID(client, joinData.channelID).then(vc => {
|
||||
const connection = connectToChannel(vc);
|
||||
console.log("Bot Connected to VC");
|
||||
|
||||
Reference in New Issue
Block a user