Skip to content

Instantly share code, notes, and snippets.

@cetteup
Last active August 18, 2020 22:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cetteup/67950c78f6267f1193c763e3fca783cc to your computer and use it in GitHub Desktop.
Save cetteup/67950c78f6267f1193c763e3fca783cc to your computer and use it in GitHub Desktop.
A collection of bflist Twitch chat commands examples
// Usage: Download file, replace __GAME__ with the game you want to use (bf2, bf3, bf4),
// replace __NAME__ with your in-game-name and copy the command to your Twitch chat bot of choice
// ******************
// **** Nightbot ****
// ******************
// Score (BF2, BF3, BF4)
$(eval const response = `$(urlfetch https://bflist.io/api/__GAME__/v1/players/__NAME__/score)`; !response.includes(`Remote Server`) ? `$(channel) currently has ${response} points` : `Sorry, could not fetch $(channel)'s current score`)
// Kills (BF2, BF3, BF4)
$(eval const response = `$(urlfetch https://bflist.io/api/__GAME__/v1/players/__NAME__/kills)`; !response.includes(`Remote Server`) ? `$(channel) currently has ${response} kills` : `Sorry, could not fetch $(channel)'s current kill count`)
// Deaths (BF2, BF3, BF4)
$(eval const response = `$(urlfetch https://bflist.io/api/__GAME__/v1/players/__NAME__/deaths)`; !response.includes(`Remote Server`) ? `$(channel) currently died ${response} times` : `Sorry, could not fetch $(channel)'s current death count`)
// Ping (BF2, BF3, BF4)
$(eval const response = `$(urlfetch https://bflist.io/api/__GAME__/v1/players/__NAME__/ping)`; !response.includes(`Remote Server`) ? `$(channel) is currently playing with ${response}ms ping` : `Sorry, could not fetch $(channel)'s current ping`)
// Rank (BF3, BF4)
$(eval const response = $(urlfetch json https://bflist.io/api/__GAME__/v1/players/__NAME__); !response.includes(`Remote Server`) ? `$(channel) currently is a ${response.rankLabel} (${response.rank})` : `Sorry, could not fetch $(channel)'s current k/d`)
// K/D (BF2, BF3, BF4)
$(eval const response = `$(urlfetch json https://bflist.io/api/__GAME__/v1/players/__NAME__)`; try { const player = JSON.parse(response); `$(channel) is ${player.kills}/${player.deaths } right now`} catch (e) { `Sorry, could not fetch $(channel)'s current k/d` })
// Summary (BF2, BF3, BF4)
$(eval const response = `$(urlfetch json https://bflist.io/api/__GAME__/v1/players/__NAME__)`; try { const player = JSON.parse(response); `$(channel) currently has ${player.score} points, ${player.kills} kills, died ${player.deaths} times and is playing with ${player.ping}ms ping` } catch (e) { `Sorry, could not fetch $(channel)'s current summary` })
// Map name (BF2)
$(eval const response = `$(urlfetch https://bflist.io/api/bf2/v1/players/__NAME__/server/mapName)`; !response.includes(`Remote Server`) ? `$(channel) is currently playing on ${response}` : `Sorry, could not fetch $(channel)'s current ping`)
// Map name (BF3, BF4)
$(eval const response = `$(urlfetch https://bflist.io/api/__GAME__/v1/players/__NAME__/server/mapLabel)`; !response.includes(`Remote Server`) ? `$(channel) is currently playing on ${response}` : `Sorry, could not fetch $(channel)'s current ping`)
// Server name (BF2, BF3, BF4)
$(eval const response = `$(urlfetch https://bflist.io/api/__GAME__/v1/players/__NAME__/server/mapLabel)`; !response.includes(`Remote Server`) ? `$(channel) is currently playing on ${response}` : `Sorry, could not fetch $(channel)'s current ping`)
// Server link (BF2)
$(eval const response = `$(urlfetch json https://bflist.io/api/bf2/v1/players/__NAME__/server)`; try { const server = JSON.parse(response); `Find details about $(channel)'s current server here: https://www.bf2hub.com/server/${server.ip}:${server.gamePort}/` } catch (e) { `Sorry, could not fetch $(channel)'s current server` })
// Server link (BF3, BF4)
$(eval const response = `$(urlfetch json https://bflist.io/api/__GAME__/v1/players/__NAME__/server)`; try { const server = JSON.parse(response); `Find details about $(channel)'s current server here: https://battlelog.battlefield.com/__GAME__/servers/show/pc/${response.guid}/` } catch (e) { `Sorry, could not fetch $(channel)'s current server` })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment