Skip to content

Commit

Permalink
fix(bot): fix configs w/o influx
Browse files Browse the repository at this point in the history
  • Loading branch information
Snazzah committed Oct 25, 2023
1 parent bed3d8d commit f9d31f4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion apps/bot/src/influx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export let autorecordingsStarted = 0;
export let pointQueue: Point[] = [];

export function onCommandRun(userID: string, commandName: string, guildID?: string) {
if (!influxOpts || !influxOpts.url || !client) return;
const commandCount = commandCounts.get(commandName) || { users: [], used: 0 };

if (!commandCount.users.includes(userID)) commandCount.users.push(userID);
Expand All @@ -37,6 +38,7 @@ export function onCommandRun(userID: string, commandName: string, guildID?: stri
}

export function onRecordingStart(userID: string, guildID: string, auto = false) {
if (!influxOpts || !influxOpts.url || !client) return;
recordingsStarted++;
if (!activeUsers.includes(userID)) activeUsers.push(userID);
if (!activeGuilds.includes(guildID)) activeGuilds.push(guildID);
Expand All @@ -52,6 +54,7 @@ export async function onRecordingEnd(
webapp = false,
errored = false
) {
if (!influxOpts || !influxOpts.url || !client) return;
if (!activeUsers.includes(userID)) activeUsers.push(userID);
if (!activeGuilds.includes(guildID)) activeGuilds.push(guildID);

Expand Down Expand Up @@ -87,7 +90,7 @@ export async function onRecordingEnd(
}

async function collect() {
if (!influxOpts || !influxOpts.url) return;
if (!influxOpts || !influxOpts.url || !client) return;
const timestamp = cron.lastDate();

const writeApi = client!.getWriteApi(influxOpts.org, influxOpts.bucket, 's');
Expand Down

0 comments on commit f9d31f4

Please sign in to comment.