off-loaded common functions

This commit is contained in:
DeSqBlocki
2025-02-08 17:07:13 +01:00
parent 5397e076ca
commit f978dbdf2e
7 changed files with 22 additions and 13 deletions
+7 -2
View File
@@ -1,3 +1,6 @@
const { default: axios } = require("axios");
const { mClient } = require(".");
// Delay function for pauses
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
@@ -11,7 +14,7 @@ async function saveToken(access_token, refresh_token, expiresIn, scope) {
refresh_token,
scope,
expiresIn,
obtainedAt: Date.now(),
obtainedAt: Date(),
};
await credentialCollection.updateOne(
@@ -155,4 +158,6 @@ async function updateChatMode(broadcaster_id, setTo) {
// Get channel information
async function getChannelInformation(broadcaster_id) {
return await makeHelixRequest('GET', 'channels', { broadcaster_id });
}
}
module.exports = { getChannelInformation, updateChatMode, getIDByName, makeHelixRequest, delay, refreshAccessToken }