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;
|
||||
@@ -74,7 +74,7 @@ player.on('stateChange', (oldState, newState) => {
|
||||
export async function connectToChannel(channel) {
|
||||
const connection = joinVoiceChannel({
|
||||
channelId: channel.id,
|
||||
guildId: channel.guild.id,
|
||||
guildId: channel.guild.id,
|
||||
adapterCreator: channel.guild.voiceAdapterCreator,
|
||||
});
|
||||
try {
|
||||
@@ -88,7 +88,7 @@ export async function connectToChannel(channel) {
|
||||
}
|
||||
|
||||
export async function getVoiceChannelFromID(client, channelID) {
|
||||
return client.channels.cache.get(channelID)
|
||||
return client.channels.cache.get(channelID)
|
||||
}
|
||||
|
||||
export async function checkIfConnectedToVC(guildId) {
|
||||
@@ -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,9 +105,12 @@ 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);
|
||||
});
|
||||
|
||||
|
||||
/* on event create
|
||||
// TODO - Implement methods for discord users to interact directly with the bots for realtime info (last talked ID/TG, etc.)
|
||||
client.on(Events.MessageCreate, async (message) => {
|
||||
@@ -129,6 +132,6 @@ export async function initDiscordBotClient(token, readyCallback){
|
||||
}
|
||||
});
|
||||
*/
|
||||
|
||||
|
||||
client.login(token);
|
||||
}
|
||||
Reference in New Issue
Block a user