Attempting to protect against call echo AND fix new call registry which wasn't working correctly it seems...
This commit is contained in:
parent
934fa4d37f
commit
6012351b3e
@ -135,6 +135,7 @@ client.on(Events.VoiceStateUpdate, async (oldState, newState) => {
|
||||
await entersState(connection, VoiceConnectionStatus.Ready, 20e3)
|
||||
const receiver = connection.receiver
|
||||
|
||||
if (receiver.speaking.listenerCount("start") == 0) {
|
||||
receiver.speaking.on("start", (user_id) => {
|
||||
receiver.subscribe(user_id, {
|
||||
end: {
|
||||
@ -158,6 +159,9 @@ client.on(Events.VoiceStateUpdate, async (oldState, newState) => {
|
||||
receiver.speaking.on("end", (user_id) => {
|
||||
logger.info(`User ${user_id} stopped speaking`)
|
||||
})
|
||||
} else {
|
||||
logger.info("Attempted to create a new start and end listener for users who are speaking for some reason, receiver armor if statement protected against this")
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error(error)
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ async function inCall(server_snowflake, channel_snowflake) {
|
||||
|
||||
async function registerNewCall(server_snowflake, channel_snowflake, call_start_time) {
|
||||
return connection_pool.query("INSERT INTO call_states (server_snowflake, channel_snowflake, call_start_time, call_end_time, call_consolidated, call_transcribed, call_data_cleaned_up) VALUES (?, ?, ?, NULL, 0, 0, 0)", [server_snowflake, channel_snowflake, call_start_time]).then(async ([rows, fields]) => {
|
||||
if (rows.length == 0) {
|
||||
if (typeof rows.insertId === 'undefined') {
|
||||
return -1;
|
||||
} else {
|
||||
return rows.insertId
|
||||
|
Loading…
Reference in New Issue
Block a user