mirror of
https://github.com/AsgardEternal/squad-js-map-vote.git
synced 2025-01-23 23:03:51 -06:00
fix: updatelayerlist
This commit is contained in:
parent
c283ca7796
commit
2efaf0df90
11
mapvote.js
11
mapvote.js
@ -447,7 +447,7 @@ export default class MapVote extends DiscordBasePlugin {
|
||||
case "help": //displays available commands
|
||||
let msg = "";
|
||||
msg += (`!vote\n > choices\n > results\n`);
|
||||
if (isAdmin) msg += (`\n Admin only:\n > start\n > restart\n > cancel\n > broadcast`);
|
||||
if (isAdmin) msg += (`\n Admin only:\n > start\n > restart\n > cancel\n > broadcast\n > endmatch`);
|
||||
|
||||
await this.warn(steamID, msg + `\nMapVote SquadJS plugin built by JetDave`);
|
||||
return;
|
||||
@ -1035,13 +1035,16 @@ export default class MapVote extends DiscordBasePlugin {
|
||||
if (!Layers.layers.find((e) => e.layerid == layer.rawName)) Layers.layers.push(new Layer(layer));
|
||||
}
|
||||
|
||||
const sheetCsv = (await axios.get('https://docs.google.com/spreadsheets/d/1OYO1IvNI0wrUZWKz_pz6Ka1xFAvBjBupddYn2E4fNFg/gviz/tq?tqx=out:csv&sheet=Map%20Layers')).data?.replace(/\"/g, '').split('\n')//.map((l) => l.split(','))
|
||||
const sheetCsv = (await axios.get('https://docs.google.com/spreadsheets/d/1OYO1IvNI0wrUZWKz_pz6Ka1xFAvBjBupddYn2E4fNFg/gviz/tq?tqx=out:csv&sheet=Map%20Layers')).data?.replace(/\"/g, '')?.split('\n')//.map((l) => l.split(','))
|
||||
sheetCsv.shift();
|
||||
// this.verbose(1, 'Sheet', Layers.layers.length, sheetCsv.length, sheetCsv.find(l => l[ 2 ] == "Manicouagan_RAAS_v1"))
|
||||
// this.verbose(1, 'Sheet', sheetCsv)
|
||||
|
||||
const rconLayers = (await this.server.rcon.execute('ListLayers')).split('\n');
|
||||
rconLayers.shift();
|
||||
Layers.layers = Layers.layers.filter((l) => rconLayers.includes(l.layerid))
|
||||
// this.verbose(1, 'RCON Layers', this.mapLayer(rconLayers[ 0 ]))
|
||||
if (sheetCsv.length > 0) {
|
||||
for (const layer of rconLayers) {
|
||||
if (!Layers.layers.find((e) => e.layerid == layer)) {
|
||||
let newLayer = this.mapLayer(layer);
|
||||
@ -1065,9 +1068,7 @@ export default class MapVote extends DiscordBasePlugin {
|
||||
Layers.layers.push(newLayer);
|
||||
}
|
||||
}
|
||||
|
||||
sheetCsv.shift();
|
||||
|
||||
}
|
||||
|
||||
this.verbose(1, 'Layer list updated', Layers.layers.length, 'total layers');
|
||||
// this.verbose(1, 'Layers', Layers.layers);
|
||||
|
Loading…
x
Reference in New Issue
Block a user