Skip to content

Commit

Permalink
fix splitting
Browse files Browse the repository at this point in the history
  • Loading branch information
sglkc committed Oct 13, 2024
1 parent cc94c0f commit 69f0f19
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node

const cookies = process.env.COOKIE.split('\n')
const games = process.env.GAMES.split('\n')
const cookies = process.env.COOKIE.split('\n').map(s => s.trim())
const games = process.env.GAMES.split('\n').map(s => s.trim())
const discordWebhook = process.env.DISCORD_WEBHOOK
const discordUser = process.env.DISCORD_USER
const msgDelimiter = ':'
Expand All @@ -15,11 +15,15 @@ const endpoints = {
}

let hasErrors = false
let latestGames

async function run(cookie, games=latestGames) {
latestGames = games
games = games.split(' ')
let latestGames = []

async function run(cookie, games) {
if (!games) {
games = latestGames
} else {
games = games.split(' ')
latestGames = games
}

for (let game of games) {
game = game.toLowerCase()
Expand Down

0 comments on commit 69f0f19

Please sign in to comment.