Large swathes of re-engineering
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { Guild, VoiceBasedChannel } from "discord.js";
|
||||
import { SQLCommon } from "../storage/interfaces";
|
||||
|
||||
export async function breadbotInCall(db: SQLCommon, channel: VoiceBasedChannel) : Promise<boolean> {
|
||||
const queryResult: Object[] = await db.getAllParameterized(
|
||||
"SELECT * FROM calls WHERE channel_snowflake = ? AND call_end_time IS NULL",
|
||||
[channel.id]
|
||||
)
|
||||
|
||||
return queryResult.length != 0
|
||||
}
|
||||
|
||||
export async function getExistingCallID(db: SQLCommon, channel: VoiceBasedChannel) : Promise<Number> {
|
||||
const queryResult: any[] = await db.getAllParameterized(
|
||||
"SELECT * FROM calls WHERE channel_snowflake = ? AND call_end_time IS NULL",
|
||||
[channel.id]
|
||||
)
|
||||
|
||||
return queryResult.length != 0 ? queryResult[0].call_id : -1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user