Google Sheets is now used to fetch accurate leaderboard
smjs is going to be ditching his api soon
This commit is contained in:
parent
9401c2f820
commit
76bc74c58c
8 changed files with 36 additions and 24 deletions
|
@ -1,15 +1,23 @@
|
|||
const request = require('request')
|
||||
const {GoogleSpreadsheet} = require('google-spreadsheet');
|
||||
const sheet = new GoogleSpreadsheet('1ADIJvAkL0XHGBDhO7PP9aQOuK3mPIKB2cVPbshuBBHc'); // accurate leaderboard spreadsheet
|
||||
|
||||
module.exports = async (app, req, res) => {
|
||||
|
||||
if (app.endpoint != "http://boomlings.com/database/") return res.send([])
|
||||
if (!app.sheetsKey || app.endpoint != "http://boomlings.com/database/") return res.send([])
|
||||
|
||||
let type = req.query.type ? req.query.type.toLowerCase() : ''
|
||||
if (type == "usercoins") type = "coins"
|
||||
if (type != "demons" && type != "coins") type = ''
|
||||
|
||||
let cell = type == "demons" ? 2 : type == "coins" ? 1 : 0
|
||||
|
||||
sheet.useApiKey(app.sheetsKey)
|
||||
sheet.loadInfo().then(async () => {
|
||||
let tab = sheet.sheetsById[1555821000]
|
||||
await tab.loadCells('A2:C2')
|
||||
let topPlayers = tab.getCell(1, cell).value
|
||||
|
||||
request.get(`https://gdleaderboards.com/incl/lbxml.php${type ? `?${type}=1` : ''}`, function (err, resp, topPlayers) {
|
||||
if (err || !topPlayers) topPlayers = ""
|
||||
let idArray = topPlayers.split(",")
|
||||
|
||||
let leaderboard = []
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
const request = require('request')
|
||||
|
||||
module.exports = async (app, req, res) => {
|
||||
|
|
BIN
assets/ulButton.png
Normal file
BIN
assets/ulButton.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
|
@ -80,7 +80,7 @@ let top250Text =
|
|||
`The <g>Top 250<> leaderboard contains the <g>top 250 players<>, sorted by <y>star<> value. However, due to <o>hackers<> flooding the leaderboard, this leaderboard has been <b>frozen<> for well over 2 years and displays <o>very outdated information<>.`
|
||||
|
||||
let accurateText =
|
||||
`The <g>Accurate Leaderboard<> is a highly accurate, hacker-proof leaderboard with <y>proper stats and positioning<> (unlike the regular one). It is managed by <b>SMJSGaming, XShadowWizardX, Pepper360, Octeract<>, and many many other helpers. You can check out their interactive <a target="_blank" href="https://docs.google.com/spreadsheets/d/10lbPnDYJXhbtlA0ls0cGjjX_osFSG559IDrTbhgPHvc"><span style="color:aqua; text-decoration: underline">leaderboard spreadsheet here<></a>.`
|
||||
`The <g>Accurate Leaderboard<> is a highly accurate, hacker-proof leaderboard with <y>proper stats and positioning<> (unlike the regular one). It is managed by <b>XShadowWizardX, Pepper360, Octeract<>, and many many other helpers. You can check out their interactive <a target="_blank" href="https://docs.google.com/spreadsheets/d/10lbPnDYJXhbtlA0ls0cGjjX_osFSG559IDrTbhgPHvc"><span style="color:aqua; text-decoration: underline">leaderboard spreadsheet here<></a>.`
|
||||
|
||||
let creatorText =
|
||||
`The <g>Creators Leaderboard<> is sorted by <g>creator points<>, rather than stars. A player's <g>creator points<> (CP) is calculated by counting their number of <y>star rated<> levels, plus an extra point for every level that has been <b>featured<>, plus an additional point for <o>epic rated<> levels.`
|
||||
|
|
2
index.js
2
index.js
|
@ -34,7 +34,9 @@ try {
|
|||
const secrets = require("./misc/secretStuff.json")
|
||||
app.id = secrets.id
|
||||
app.gjp = secrets.gjp
|
||||
app.sheetsKey = secrets.sheetsKey
|
||||
if (app.id == "account id goes here" || app.gjp == "account gjp goes here") console.warn("Warning: No account ID and/or GJP has been provided in secretStuff.json! These are required for level leaderboards to work.")
|
||||
if (app.sheetsKey.startsWith("google sheets api key")) app.sheetsKey = undefined
|
||||
}
|
||||
|
||||
catch(e) {
|
||||
|
|
|
@ -27,6 +27,23 @@
|
|||
|
||||
{
|
||||
"header": "Accurate Leaderboard",
|
||||
"name": "XShadowWizardX",
|
||||
"youtube": ["https://www.youtube.com/channel/UCaf3-yyZDsAwh1IlYte5VtA", "youtube"],
|
||||
"twitter": ["https://twitter.com/XShadowWizardX", "twitter"],
|
||||
"github": ["https://docs.google.com/spreadsheets/d/10lbPnDYJXhbtlA0ls0cGjjX_osFSG559IDrTbhgPHvc", "ulButton"]
|
||||
},
|
||||
|
||||
{
|
||||
"header": "Demon List",
|
||||
"name": "stadust1971",
|
||||
"ign": "stardust1971",
|
||||
"youtube": ["https://youtube.com/user/stardust19710", "youtube"],
|
||||
"twitter": ["https://twitter.com/stadust1971", "twitter"],
|
||||
"github": ["https://pointercrate.com", "demonButton"]
|
||||
},
|
||||
|
||||
{
|
||||
"header": "API Help",
|
||||
"name": "SMJSGaming",
|
||||
"youtube": ["https://youtube.com/channel/UCwEsWDs9kGN2vvoiNTJKdaQ", "youtube"],
|
||||
"twitter": ["https://instagram.com/smjs_gaming", "instagram"],
|
||||
|
@ -41,22 +58,6 @@
|
|||
"github": ["https://github.com/Alex1304", "github"]
|
||||
},
|
||||
|
||||
{
|
||||
"header": "Web Design Help",
|
||||
"name": "Ucrash",
|
||||
"youtube": ["https://youtube.com/channel/UCfPgDZBhCodHIFo6OOVcH2A", "youtube"],
|
||||
"twitter": ["https://twitter.com/GDUcrash", "twitter"],
|
||||
"github": ["https://github.com/GDUcrash", "github"]
|
||||
},
|
||||
|
||||
{
|
||||
"header": "Demon List API",
|
||||
"name": "stadust1971",
|
||||
"ign": "stardust1971",
|
||||
"youtube": ["https://youtube.com/user/stardust19710", "youtube"],
|
||||
"twitter": ["https://twitter.com/stadust1971", "twitter"],
|
||||
"github": ["https://pointercrate.com", "demonButton"]
|
||||
},
|
||||
|
||||
{
|
||||
"header": "Everything Else",
|
||||
|
@ -72,7 +73,7 @@
|
|||
"AlFas",
|
||||
"ViPriN",
|
||||
"Cvolton",
|
||||
"cos8o",
|
||||
"Ucrash",
|
||||
"zmxmx"
|
||||
]
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"id": "account id goes here",
|
||||
"gjp": "account gjp goes here"
|
||||
}
|
||||
"gjp": "account gjp goes here",
|
||||
"sheetsKey": "google sheets api key (for accurate leaderboard - delete this line if you don't need it)"
|
||||
}
|
|
@ -9,6 +9,7 @@
|
|||
"compression": "^1.7.4",
|
||||
"connect-timeout": "^1.9.0",
|
||||
"express": "^4.17.1",
|
||||
"google-spreadsheet": "^3.0.11",
|
||||
"jimp": "^0.8.5",
|
||||
"plist": "^3.0.1",
|
||||
"request": "^2.88.2"
|
||||
|
|
Loading…
Reference in a new issue