Compare commits

...

3 Commits

Author SHA1 Message Date
6a024f8cb6 Change GPT 4 to GPT 4O in chat module 2024-12-26 20:31:04 +01:00
591eb227b3 Fix bug 2024-04-25 01:08:18 +02:00
17ba5e2048 Flush on channel leave 2024-04-25 01:08:11 +02:00
2 changed files with 8 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
const printf=require('printf');
const AudioQueue=require('../../AudioQueue.js')
const printf = require('printf');
const AudioQueue = require('../../AudioQueue.js')
module.exports = function (bot, api) {
bot.on('voiceStateUpdate', async (oldState, newState) => {
@@ -8,14 +8,16 @@ module.exports = function (bot, api) {
const channel = oldState.channel || newState.channel;
if (!channel) return;
if (channel.members.size < 2) {
return await api.leaveChannel(channel);
api.AudioQueue.flush();
await api.leaveChannel(channel);
}
await api.joinChannel(channel);
let joined = false;
if (!oldState.channel) {
joined = true;
let conn=api.getConnectionForVoiceChannel(channel);
if (!api.queue) api.queue=new AudioQueue(conn, api);
let conn = api.getConnectionForVoiceChannel(channel);
if (!api.queue) api.queue = new AudioQueue(conn, api);
}
let username = newState.member.displayName;

View File

@@ -14,7 +14,7 @@ async function getChatGPTResponse(prompt) {
const api = new ChatGPTAPI({
apiKey: process.env.OPENAI_API_KEY,
completionParams: {
model: 'gpt-4'
model: 'gpt-4o'
}
})