Skip to content

Commit

Permalink
Merge pull request #16 from BarryCarlyon/deps
Browse files Browse the repository at this point in the history
Deps
  • Loading branch information
BarryCarlyon authored Jan 8, 2025
2 parents 6bef51d + 2cce26a commit 3e6d73b
Show file tree
Hide file tree
Showing 8 changed files with 711 additions and 434 deletions.
2 changes: 0 additions & 2 deletions modules/discord.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args))

module.exports = function(lib) {
let { mysql_pool } = lib;

Expand Down
1 change: 0 additions & 1 deletion modules/eventsub.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args))
const crypto = require('crypto');

module.exports = function(lib) {
Expand Down
10 changes: 6 additions & 4 deletions modules/twitch.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args))

module.exports = function(lib) {
let { redis_client } = lib;

Expand All @@ -17,8 +15,8 @@ module.exports = function(lib) {
)
.then(loaded_token => {
// no token create one
if (!loaded_token) {
throw new Error('No Token Generate');
if (!loaded_token || loaded_token == '') {
throw new Error('No Token on file');
return;
}

Expand Down Expand Up @@ -85,6 +83,10 @@ module.exports = function(lib) {
)
.then(resp => resp.json().then(data => ({ status: resp.status, body: data })))
.then(resp => {
if (resp.status != 200) {
// die
throw new Error('Failed to generate token', resp.body);
}
resp.body.client_id = process.env.TWITCH_CLIENT_ID;

return redis_client.HSET(
Expand Down
Loading

0 comments on commit 3e6d73b

Please sign in to comment.