Skip to content

Commit

Permalink
rename function
Browse files Browse the repository at this point in the history
  • Loading branch information
Geczy committed Jan 3, 2024
1 parent c083622 commit 566e9e5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions packages/dota/src/dota/events/gsi-events/newdata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { t } from 'i18next'

import { DBSettings, getValueOrDefault } from '../../../settings.js'
import { steamSocket } from '../../../steam/ws.js'
import { GetLiveMatch } from '../../../stratz/livematch.js'
import { getWinProbability2MinAgo } from '../../../stratz/livematch.js'
import { DelayedGames, Packet, SocketClient, validEventTypes } from '../../../types.js'
import { logger } from '../../../utils/logger.js'
import { events } from '../../globalEventEmitter.js'
Expand Down Expand Up @@ -146,7 +146,9 @@ eventHandler.registerEvent(`newdata`, {
dotaClient.client.gsi?.map?.clock_time &&
dotaClient.client.gsi?.map?.clock_time % (updateInterval * 60) === 0
) {
const matchDetails = await GetLiveMatch(parseInt(dotaClient.client.gsi?.map?.matchid, 10))
const matchDetails = await getWinProbability2MinAgo(
parseInt(dotaClient.client.gsi?.map?.matchid, 10),
)
const lastWinRate = matchDetails?.data.live.match?.liveWinRateValues.slice(-1).pop()
if (lastWinRate) {
server.io.to(dotaClient.client.token).emit('update-radiant-win-chance', {
Expand Down
2 changes: 1 addition & 1 deletion packages/dota/src/stratz/livematch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type StratzLiveMatchResponse = {
}
}

export const GetLiveMatch = async (
export const getWinProbability2MinAgo = async (
matchId: number,
): Promise<StratzLiveMatchResponse | undefined> => {
if (!process.env.STRATZ_TOKEN) {
Expand Down
4 changes: 2 additions & 2 deletions packages/dota/src/twitch/commands/winprobability.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { t } from 'i18next'

import { DBSettings } from '../../settings.js'
import { GetLiveMatch } from '../../stratz/livematch.js'
import { getWinProbability2MinAgo } from '../../stratz/livematch.js'
import { logger } from '../../utils/logger.js'
import { chatClient } from '../chatClient.js'
import commandHandler from '../lib/CommandHandler.js'
Expand Down Expand Up @@ -36,7 +36,7 @@ commandHandler.registerCommand('winprobability', {
if (!apiCooldown[channel] || Date.now() - apiCooldown[channel] >= API_COOLDOWN_SEC * 1000) {
try {
apiCooldown[channel] = Date.now()
const matchDetails = await GetLiveMatch(parseInt(matchId, 10))
const matchDetails = await getWinProbability2MinAgo(parseInt(matchId, 10))
const lastWinRate = matchDetails?.data.live.match?.liveWinRateValues.slice(-1).pop()
if (
lastWinRate &&
Expand Down

0 comments on commit 566e9e5

Please sign in to comment.