main.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671
  1. import { writeFileSync } from 'fs';
  2. import 'dotenv/config';
  3. import { pinnacleRequest, getPsteryRelations, updateBaseEvents, notifyException } from "./libs/pinnacleClient.js";
  4. import { Logs } from "./libs/logs.js";
  5. const cacheFilePath = 'data/gamesCache.json';
  6. const GLOBAL_DATA = {
  7. filtedLeagues: [],
  8. filtedGames: [],
  9. gamesMap: {},
  10. straightFixturesVersion: 0,
  11. straightFixturesCount: 0,
  12. specialFixturesVersion: 0,
  13. specialFixturesCount: 0,
  14. straightOddsVersion: 0,
  15. specialsOddsVersion: 0,
  16. requestErrorCount: 0,
  17. loopActive: false,
  18. loopResultTime: Date.now(),
  19. };
  20. /**
  21. * 获取指定时区当前日期或时间
  22. * @param {number} offsetHours - 时区相对 UTC 的偏移(例如:-4 表示 GMT-4)
  23. * @param {boolean} [withTime=false] - 是否返回完整时间(默认只返回日期)
  24. * @returns {string} 格式化的日期或时间字符串
  25. */
  26. const getDateInTimezone = (offsetHours, withTime = false) => {
  27. const nowUTC = new Date();
  28. const targetTime = new Date(nowUTC.getTime() + offsetHours * 60 * 60 * 1000);
  29. const year = targetTime.getUTCFullYear();
  30. const month = String(targetTime.getUTCMonth() + 1).padStart(2, '0');
  31. const day = String(targetTime.getUTCDate()).padStart(2, '0');
  32. if (!withTime) {
  33. return `${year}-${month}-${day}`;
  34. }
  35. const hours = String(targetTime.getUTCHours()).padStart(2, '0');
  36. const minutes = String(targetTime.getUTCMinutes()).padStart(2, '0');
  37. const seconds = String(targetTime.getUTCSeconds()).padStart(2, '0');
  38. return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  39. }
  40. const pinnacleGet = async (endpoint, params) => {
  41. return pinnacleRequest({
  42. endpoint,
  43. params,
  44. username: process.env.PINNACLE_USERNAME,
  45. password: process.env.PINNACLE_PASSWORD,
  46. proxy: process.env.NODE_HTTP_PROXY,
  47. })
  48. .catch(err => {
  49. const source = { endpoint, params };
  50. if (err?.response?.data) {
  51. const data = err.response.data;
  52. Object.assign(source, { data });
  53. }
  54. err.source = source;
  55. return Promise.reject(err);
  56. });
  57. };
  58. // const pinnaclePost = async(endpoint, data) => {
  59. // return pinnacleRequest({
  60. // endpoint,
  61. // data,
  62. // method: 'POST',
  63. // username: process.env.PINNACLE_USERNAME,
  64. // password: process.env.PINNACLE_PASSWORD,
  65. // proxy: process.env.NODE_HTTP_PROXY,
  66. // });
  67. // };
  68. const updateFiltedGames = async () => {
  69. return getPsteryRelations()
  70. .then(res => {
  71. if (res.statusCode !== 200) {
  72. throw new Error(`Failed to update filted leagues: ${res.message}`);
  73. }
  74. Logs.outDev('update filted games', res.data);
  75. const games = res.data.map(game => {
  76. const { eventId, leagueId } = game?.rel?.ps ?? {};
  77. return {
  78. eventId,
  79. leagueId,
  80. };
  81. });
  82. GLOBAL_DATA.filtedLeagues = [...new Set(games.map(game => game.leagueId).filter(leagueId => leagueId))];
  83. GLOBAL_DATA.filtedGames = games.map(game => game.eventId).filter(eventId => eventId);
  84. })
  85. .catch(err => {
  86. Logs.err(err.message);
  87. })
  88. .finally(() => {
  89. setTimeout(updateFiltedGames, 1000 * 30);
  90. });
  91. }
  92. const getStraightFixtures = async () => {
  93. const leagueIds = GLOBAL_DATA.filtedLeagues.join(',');
  94. let since = GLOBAL_DATA.straightFixturesVersion;
  95. if (GLOBAL_DATA.straightFixturesCount > 12) {
  96. since = 0;
  97. GLOBAL_DATA.straightFixturesCount = 0;
  98. }
  99. return pinnacleGet('/v3/fixtures', { sportId: 29, leagueIds, since })
  100. .then(data => {
  101. const { league, last } = data;
  102. if (!last) {
  103. return {};
  104. }
  105. GLOBAL_DATA.straightFixturesVersion = last;
  106. const games = league?.map(league => {
  107. const { id: leagueId, events } = league;
  108. return events?.map(event => {
  109. const { starts } = event;
  110. const timestamp = new Date(starts).getTime();
  111. return { leagueId, ...event, timestamp };
  112. });
  113. })
  114. .flat() ?? [];
  115. const update = since == 0 ? 'full' : 'increment';
  116. return { games, update };
  117. });
  118. }
  119. const updateStraightFixtures = async () => {
  120. return getStraightFixtures()
  121. .then(data => {
  122. const { games, update } = data;
  123. const { gamesMap } = GLOBAL_DATA;
  124. if (games?.length) {
  125. games.forEach(game => {
  126. const { id } = game;
  127. if (!gamesMap[id]) {
  128. gamesMap[id] = game;
  129. }
  130. else {
  131. Object.assign(gamesMap[id], game);
  132. }
  133. });
  134. }
  135. if (update && update == 'full') {
  136. Logs.outDev('full update straight fixtures');
  137. const gamesSet = new Set(games.map(game => game.id));
  138. Object.keys(gamesMap).forEach(key => {
  139. if (!gamesSet.has(+key)) {
  140. delete gamesMap[key];
  141. }
  142. });
  143. }
  144. });
  145. }
  146. const getStraightOdds = async () => {
  147. const leagueIds = GLOBAL_DATA.filtedLeagues.join(',');
  148. const since = GLOBAL_DATA.straightOddsVersion;
  149. return pinnacleGet('/v3/odds', { sportId: 29, oddsFormat: 'Decimal', leagueIds, since })
  150. .then(data => {
  151. const { leagues, last } = data;
  152. if (!last) {
  153. return [];
  154. }
  155. GLOBAL_DATA.straightOddsVersion = last;
  156. const games = leagues?.flatMap(league => league.events);
  157. return games?.map(item => {
  158. const { periods, ...rest } = item;
  159. const period = periods?.find(period => period.number == 0) ?? {};
  160. return { ...rest, period };
  161. }) ?? [];
  162. });
  163. }
  164. const updateStraightOdds = async () => {
  165. return getStraightOdds()
  166. .then(games => {
  167. if (games.length) {
  168. const { gamesMap } = GLOBAL_DATA;
  169. games.forEach(game => {
  170. const { id, ...rest } = game;
  171. const localGame = gamesMap[id];
  172. if (localGame) {
  173. Object.assign(localGame, rest);
  174. }
  175. });
  176. }
  177. });
  178. }
  179. const getSpecialFixtures = async () => {
  180. const leagueIds = GLOBAL_DATA.filtedLeagues.join(',');
  181. let since = GLOBAL_DATA.specialFixturesVersion;
  182. if (GLOBAL_DATA.specialFixturesCount > 18) {
  183. since = 0;
  184. GLOBAL_DATA.specialFixturesCount = 6;
  185. }
  186. return pinnacleGet('/v2/fixtures/special', { sportId: 29, leagueIds, since })
  187. .then(data => {
  188. const { leagues, last } = data;
  189. if (!last) {
  190. return [];
  191. }
  192. GLOBAL_DATA.specialFixturesVersion = last;
  193. const specials = leagues?.map(league => {
  194. const { specials } = league;
  195. return specials?.filter(special => special.event)
  196. .map(special => {
  197. const { event: { id: eventId }, ...rest } = special ?? { event: {} };
  198. return { eventId, ...rest };
  199. }) ?? [];
  200. })
  201. .flat()
  202. .filter(special => {
  203. if (special.name != 'Winning Margin' && special.name != 'Exact Total Goals') {
  204. return false;
  205. }
  206. return true;
  207. }) ?? [];
  208. const update = since == 0 ? 'full' : 'increment';
  209. return { specials, update };
  210. });
  211. }
  212. const mergeContestants = (localContestants=[], remoteContestants=[]) => {
  213. const localContestantsMap = new Map(localContestants.map(contestant => [contestant.id, contestant]));
  214. remoteContestants.forEach(contestant => {
  215. const localContestant = localContestantsMap.get(contestant.id);
  216. if (localContestant) {
  217. Object.assign(localContestant, contestant);
  218. }
  219. else {
  220. localContestants.push(contestant);
  221. }
  222. });
  223. const remoteContestantsMap = new Map(remoteContestants.map(contestant => [contestant.id, contestant]));
  224. for (let i = localContestants.length - 1; i >= 0; i--) {
  225. if (!remoteContestantsMap.has(localContestants[i].id)) {
  226. localContestants.splice(i, 1);
  227. }
  228. }
  229. return localContestants;
  230. }
  231. const updateSpecialFixtures = async () => {
  232. return getSpecialFixtures()
  233. .then(data => {
  234. const { specials, update } = data;
  235. if (specials?.length) {
  236. const { gamesMap } = GLOBAL_DATA;
  237. const gamesSpecialsMap = {};
  238. specials.forEach(special => {
  239. const { eventId } = special;
  240. if (!gamesSpecialsMap[eventId]) {
  241. gamesSpecialsMap[eventId] = {};
  242. }
  243. if (special.name == 'Winning Margin') {
  244. gamesSpecialsMap[eventId].winningMargin = special;
  245. }
  246. else if (special.name == 'Exact Total Goals') {
  247. gamesSpecialsMap[eventId].exactTotalGoals = special;
  248. }
  249. });
  250. Object.keys(gamesSpecialsMap).forEach(eventId => {
  251. if (!gamesMap[eventId]) {
  252. return;
  253. }
  254. if (!gamesMap[eventId].specials) {
  255. gamesMap[eventId].specials = {};
  256. }
  257. const localSpecials = gamesMap[eventId].specials;
  258. const remoteSpecials = gamesSpecialsMap[eventId];
  259. if (localSpecials.winningMargin && remoteSpecials.winningMargin) {
  260. const { contestants: winningMarginContestants, ...winningMarginRest } = remoteSpecials.winningMargin;
  261. Object.assign(localSpecials.winningMargin, winningMarginRest);
  262. mergeContestants(localSpecials.winningMargin.contestants, winningMarginContestants);
  263. }
  264. else if (localSpecials.winningMargin && !remoteSpecials.winningMargin) {
  265. Logs.outDev('delete winningMargin', localSpecials.winningMargin);
  266. delete localSpecials.winningMargin;
  267. }
  268. else if (remoteSpecials.winningMargin) {
  269. localSpecials.winningMargin = remoteSpecials.winningMargin;
  270. }
  271. if (localSpecials.exactTotalGoals && remoteSpecials.exactTotalGoals) {
  272. const { contestants: exactTotalGoalsContestants, ...exactTotalGoalsRest } = remoteSpecials.exactTotalGoals;
  273. Object.assign(localSpecials.exactTotalGoals, exactTotalGoalsRest);
  274. mergeContestants(localSpecials.exactTotalGoals.contestants, exactTotalGoalsContestants);
  275. }
  276. else if (localSpecials.exactTotalGoals && !remoteSpecials.exactTotalGoals) {
  277. Logs.outDev('delete exactTotalGoals', localSpecials.exactTotalGoals);
  278. delete localSpecials.exactTotalGoals;
  279. }
  280. else if (remoteSpecials.exactTotalGoals) {
  281. localSpecials.exactTotalGoals = remoteSpecials.exactTotalGoals;
  282. }
  283. });
  284. }
  285. if (update && update == 'full') {
  286. Logs.outDev('full update special fixtures');
  287. }
  288. });
  289. }
  290. const getSpecialsOdds = async () => {
  291. const leagueIds = GLOBAL_DATA.filtedLeagues.join(',');
  292. const since = GLOBAL_DATA.specialsOddsVersion;
  293. return pinnacleGet('/v2/odds/special', { sportId: 29, oddsFormat: 'Decimal', leagueIds, since })
  294. .then(data => {
  295. const { leagues, last } = data;
  296. if (!last) {
  297. return [];
  298. }
  299. GLOBAL_DATA.specialsOddsVersion = last;
  300. return leagues?.flatMap(league => league.specials);
  301. });
  302. }
  303. const updateSpecialsOdds = async () => {
  304. return getSpecialsOdds()
  305. .then(specials => {
  306. if (specials.length) {
  307. const { gamesMap } = GLOBAL_DATA;
  308. const contestants = Object.values(gamesMap)
  309. .filter(game => game.specials)
  310. .map(game => {
  311. const { specials } = game;
  312. const contestants = Object.values(specials).map(special => {
  313. const { contestants } = special;
  314. return contestants.map(contestant => [contestant.id, contestant]);
  315. });
  316. return contestants;
  317. }).flat(2);
  318. const contestantsMap = new Map(contestants);
  319. const lines = specials.flatMap(special => special.contestantLines);
  320. lines.forEach(line => {
  321. const { id, handicap, lineId, max, price } = line;
  322. const contestant = contestantsMap.get(id);
  323. if (!contestant) {
  324. return;
  325. }
  326. contestant.handicap = handicap;
  327. contestant.lineId = lineId;
  328. contestant.max = max;
  329. contestant.price = price;
  330. });
  331. }
  332. });
  333. }
  334. const getInRunning = async () => {
  335. return pinnacleGet('/v2/inrunning')
  336. .then(data => {
  337. const sportId = 29;
  338. const leagues = data.sports?.find(sport => sport.id == sportId)?.leagues ?? [];
  339. return leagues.filter(league => {
  340. const { id } = league;
  341. const filtedLeaguesSet = new Set(GLOBAL_DATA.filtedLeagues);
  342. return filtedLeaguesSet.has(id);
  343. }).flatMap(league => league.events);
  344. });
  345. }
  346. const updateInRunning = async () => {
  347. return getInRunning()
  348. .then(games => {
  349. if (!games.length) {
  350. return;
  351. }
  352. const { gamesMap } = GLOBAL_DATA;
  353. games.forEach(game => {
  354. const { id, state, elapsed } = game;
  355. const localGame = gamesMap[id];
  356. if (localGame) {
  357. Object.assign(localGame, { state, elapsed });
  358. }
  359. });
  360. });
  361. }
  362. const ratioAccept = (ratio) => {
  363. if (ratio > 0) {
  364. return 'a'
  365. }
  366. return ''
  367. }
  368. const ratioString = (ratio) => {
  369. ratio = Math.abs(ratio);
  370. ratio = ratio.toString();
  371. ratio = ratio.replace(/\./, '');
  372. return ratio;
  373. }
  374. const parseSpreads = (spreads, wm) => {
  375. // 让分盘
  376. if (!spreads?.length) {
  377. return null;
  378. }
  379. const events = {};
  380. spreads.forEach(spread => {
  381. const { hdp, home, away } = spread;
  382. if (!(hdp % 1) || !!(hdp % 0.5)) {
  383. // 整数或不能被0.5整除的让分盘不处理
  384. return;
  385. }
  386. const ratio_ro = hdp;
  387. const ratio_r = ratio_ro - wm;
  388. events[`ior_r${ratioAccept(ratio_r)}h_${ratioString(ratio_r)}`] = {
  389. v: home,
  390. r: wm != 0 ? `ior_r${ratioAccept(ratio_ro)}h_${ratioString(ratio_ro)}` : undefined
  391. };
  392. events[`ior_r${ratioAccept(-ratio_r)}c_${ratioString(ratio_r)}`] = {
  393. v: away,
  394. r: wm != 0 ? `ior_r${ratioAccept(-ratio_ro)}c_${ratioString(ratio_ro)}` : undefined
  395. };
  396. });
  397. return events;
  398. }
  399. const parseMoneyline = (moneyline) => {
  400. // 胜平负
  401. if (!moneyline) {
  402. return null;
  403. }
  404. const { home, away, draw } = moneyline;
  405. return {
  406. 'ior_mh': { v: home },
  407. 'ior_mc': { v: away },
  408. 'ior_mn': { v: draw },
  409. }
  410. }
  411. const parsePeriod = (period, wm) => {
  412. const { cutoff='', status=0, spreads=[], moneyline={} } = period;
  413. const cutoffTime = new Date(cutoff).getTime();
  414. const nowTime = Date.now();
  415. if (status != 1 || cutoffTime < nowTime) {
  416. return null;
  417. }
  418. const events = {};
  419. Object.assign(events, parseSpreads(spreads, wm));
  420. Object.assign(events, parseMoneyline(moneyline));
  421. return events;
  422. }
  423. const parseWinningMargin = (winningMargin, home, away) => {
  424. const { cutoff='', status='', contestants=[] } = winningMargin;
  425. const cutoffTime = new Date(cutoff).getTime();
  426. const nowTime = Date.now();
  427. if (status != 'O' || cutoffTime < nowTime || !contestants?.length) {
  428. return null;
  429. }
  430. const events = {};
  431. contestants.forEach(contestant => {
  432. const { name, price } = contestant;
  433. const nr = name.match(/\d+$/)?.[0];
  434. if (!nr) {
  435. return;
  436. }
  437. let side;
  438. if (name.startsWith(home)) {
  439. side = 'h';
  440. }
  441. else if (name.startsWith(away)) {
  442. side = 'c';
  443. }
  444. else {
  445. return;
  446. }
  447. events[`ior_wm${side}_${nr}`] = { v: price };
  448. });
  449. return events;
  450. }
  451. const parseExactTotalGoals = (exactTotalGoals) => {
  452. const { cutoff='', status='', contestants=[] } = exactTotalGoals;
  453. const cutoffTime = new Date(cutoff).getTime();
  454. const nowTime = Date.now();
  455. if (status != 'O' || cutoffTime < nowTime || !contestants?.length) {
  456. return null;
  457. }
  458. const events = {};
  459. contestants.forEach(contestant => {
  460. const { name, price } = contestant;
  461. if (+name >= 1 && +name <= 7) {
  462. events[`ior_ot_${name}`] = { v: price };
  463. }
  464. });
  465. return events;
  466. }
  467. const parseRbState = (state) => {
  468. let stage = null;
  469. if (state == 1) {
  470. stage = '1H';
  471. }
  472. else if (state == 2) {
  473. stage = 'HT';
  474. }
  475. else if (state == 3) {
  476. stage = '2H';
  477. }
  478. return stage;
  479. }
  480. const parseGame = (game) => {
  481. const { eventId=0, originId=0, period={}, specials={}, home, away, marketType, state, elapsed, homeScore=0, awayScore=0 } = game;
  482. const { winningMargin={}, exactTotalGoals={} } = specials;
  483. const wm = homeScore - awayScore;
  484. const score = `${homeScore}-${awayScore}`;
  485. const events = parsePeriod(period, wm) ?? {};
  486. const stage = parseRbState(state);
  487. const retime = elapsed ? `${elapsed}'` : '';
  488. const evtime = Date.now();
  489. Object.assign(events, parseWinningMargin(winningMargin, home, away));
  490. Object.assign(events, parseExactTotalGoals(exactTotalGoals));
  491. return { eventId, originId, events, evtime, stage, retime, score, wm, marketType };
  492. }
  493. const getGames = () => {
  494. const { filtedGames, gamesMap } = GLOBAL_DATA;
  495. const filtedGamesSet = new Set(filtedGames);
  496. const nowTime = Date.now();
  497. const gamesData = {};
  498. Object.values(gamesMap).forEach(game => {
  499. const { id, liveStatus, parentId, resultingUnit, timestamp } = game;
  500. if (resultingUnit !== 'Regular') {
  501. return false; // 非常规赛事不处理
  502. }
  503. const gmtMinus4Date = getDateInTimezone(-4);
  504. const todayEndTime = new Date(`${gmtMinus4Date} 23:59:59 GMT-4`).getTime();
  505. const tomorrowEndTime = todayEndTime + 24 * 60 * 60 * 1000;
  506. if (liveStatus == 1 && timestamp < nowTime) {
  507. game.marketType = 2; // 滚球赛事
  508. }
  509. else if (liveStatus != 1 && timestamp > nowTime && timestamp <= todayEndTime) {
  510. game.marketType = 1; // 今日赛事
  511. }
  512. else if (liveStatus != 1 && timestamp > todayEndTime && timestamp <= tomorrowEndTime) {
  513. game.marketType = 0; // 明日早盘赛事
  514. }
  515. else {
  516. game.marketType = -1; // 非近期赛事
  517. }
  518. if (game.marketType < 0) {
  519. return false; // 非近期赛事不处理
  520. }
  521. let actived = false;
  522. if (liveStatus != 1 && filtedGamesSet.has(id)) {
  523. actived = true; // 在赛前列表中
  524. game.eventId = id;
  525. game.originId = 0;
  526. }
  527. else if (liveStatus == 1 && filtedGamesSet.has(parentId)) {
  528. actived = true; // 在滚球列表中
  529. game.eventId = parentId;
  530. game.originId = id;
  531. }
  532. if (actived) {
  533. const gameInfo = parseGame(game);
  534. const { marketType, ...rest } = gameInfo;
  535. if (!gamesData[marketType]) {
  536. gamesData[marketType] = [];
  537. }
  538. gamesData[marketType].push(rest);
  539. }
  540. });
  541. return gamesData;
  542. }
  543. const pinnacleDataLoop = () => {
  544. updateStraightFixtures()
  545. .then(() => {
  546. return Promise.all([
  547. updateStraightOdds(),
  548. updateSpecialFixtures(),
  549. updateInRunning(),
  550. ]);
  551. })
  552. .then(() => {
  553. return updateSpecialsOdds();
  554. })
  555. .then(() => {
  556. const nowTime = Date.now();
  557. const loopDuration = nowTime - GLOBAL_DATA.loopResultTime;
  558. Logs.outDev('loop duration', loopDuration);
  559. GLOBAL_DATA.loopResultTime = nowTime;
  560. GLOBAL_DATA.straightFixturesCount++;
  561. GLOBAL_DATA.specialFixturesCount++;
  562. GLOBAL_DATA.requestErrorCount = 0;
  563. const { straightFixturesVersion: sfv, specialFixturesVersion: pfv, straightOddsVersion: sov, specialsOddsVersion: pov } = GLOBAL_DATA;
  564. const timestamp = Math.max(sfv, pfv, sov, pov);
  565. const games = getGames();
  566. const data = { games, timestamp };
  567. updateBaseEvents(data);
  568. Logs.outDev('games data', data);
  569. writeFileSync(cacheFilePath, JSON.stringify(GLOBAL_DATA.gamesMap, null, 2));
  570. })
  571. .catch(err => {
  572. GLOBAL_DATA.requestErrorCount++;
  573. if (GLOBAL_DATA.requestErrorCount > 10) {
  574. GLOBAL_DATA.loopActive = false;
  575. notifyException('Pinnacle API request errors have reached the limit.');
  576. }
  577. Logs.err(err.message, err.source);
  578. })
  579. .finally(() => {
  580. if (!GLOBAL_DATA.loopActive) {
  581. return;
  582. }
  583. setTimeout(pinnacleDataLoop, 1000 * 5);
  584. });
  585. }
  586. (() => {
  587. if (!process.env.PINNACLE_USERNAME || !process.env.PINNACLE_PASSWORD) {
  588. Logs.err('USERNAME or PASSWORD is not set');
  589. return;
  590. }
  591. GLOBAL_DATA.loopActive = true;
  592. updateFiltedGames().then(pinnacleDataLoop);
  593. })();