Modifications to fix some bugs with inputting ID
This commit is contained in:
parent
acaedb434c
commit
abf8f10668
12
breadbot.js
12
breadbot.js
@ -103,7 +103,17 @@ client.on(Events.VoiceStateUpdate, async (oldState, newState) => {
|
|||||||
// This should always have something to do, as all callIDs should be unique
|
// This should always have something to do, as all callIDs should be unique
|
||||||
fs.mkdirSync("." + path.sep + "media" + path.sep + "voice_audio" + path.sep + newCallID, {recursive: true})
|
fs.mkdirSync("." + path.sep + "media" + path.sep + "voice_audio" + path.sep + newCallID, {recursive: true})
|
||||||
|
|
||||||
connection = newState.channel.join().then(conn => {
|
const voiceChannel = newState.guild.channels.cache
|
||||||
|
.filter(c => c.type == "voice" || c.type == "stage")
|
||||||
|
.find(c => c.id == newState.channelId)
|
||||||
|
|
||||||
|
if(!voiceChannel) {
|
||||||
|
console.log("VOICE CHANNEL LOOKUP FAILED")
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
connection = voiceChannel.join().then(conn => {
|
||||||
const receiver = conn.receiver
|
const receiver = conn.receiver
|
||||||
|
|
||||||
conn.on("speaking", (user, speaking) => {
|
conn.on("speaking", (user, speaking) => {
|
||||||
|
@ -162,7 +162,7 @@ async function inCall(server_snowflake, channel_snowflake) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function registerNewCall(server_snowflake, channel_snowflake, call_start_time) {
|
async function registerNewCall(server_snowflake, channel_snowflake, call_start_time) {
|
||||||
return connection_pool.query("INSERT INTO call_states VALUES (?, ?, ?)", [server_snowflake, channel_snowflake, call_start_time]).then(async ([rows, fields]) => {
|
return connection_pool.query("INSERT INTO call_states VALUES (?, ?, ?, NULL, 0, 0, 0)", [server_snowflake, channel_snowflake, call_start_time]).then(async ([rows, fields]) => {
|
||||||
if (rows.length == 0) {
|
if (rows.length == 0) {
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user