diff --git a/docker-compose.yml b/docker-compose.yml index 817d6d0..129b760 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,7 +18,7 @@ services: ENABLE_BETS: ${ENABLE_BETS} FORCE_RECAPS: ${FORCE_RECAPS} HTTP_PORT: ${HTTP_PORT} - + restart: always depends_on: - postgresql networks: diff --git a/src/commands/manageSummoners.ts b/src/commands/manageSummoners.ts index 0d82915..380342b 100644 --- a/src/commands/manageSummoners.ts +++ b/src/commands/manageSummoners.ts @@ -33,7 +33,7 @@ export class ManageSummoner { const riotSummoner = await getSummonerByName(name, tag || "EUW"); await addSummoner(riotSummoner, interaction.channelId); - interaction.reply("Added summoner " + name + "#" + tag || "EUW"); + interaction.reply("Added summoner " + name + "#" + (tag || "EUW")); } catch (e) { console.log(e); interaction.reply("Summoner not found"); diff --git a/src/features/lol/elo.ts b/src/features/lol/elo.ts index 03d1da7..b609f03 100644 --- a/src/features/lol/elo.ts +++ b/src/features/lol/elo.ts @@ -34,8 +34,8 @@ export const checkElo = async () => { export const checkSummonerElo = async (summ: SummonerWithChannels) => { const summonerData = await getSummonerData(summ.puuid); - if (summonerData.name !== summ.currentName) { - await db.update(summoner).set({ currentName: summonerData.name }).where(eq(summoner.puuid, summ.puuid)); + if (summonerData.fullname !== summ.currentName) { + await db.update(summoner).set({ currentName: summonerData.fullname }).where(eq(summoner.puuid, summ.puuid)); } const elo = await getSoloQElo(summ.id); @@ -58,7 +58,7 @@ export const checkSummonerElo = async (summ: SummonerWithChannels) => { await db .update(summoner) - .set({ icon: summonerData.profileIconId, currentName: summonerData.name, checkedAt: new Date() }) + .set({ icon: summonerData.profileIconId, currentName: summonerData.fullname, checkedAt: new Date() }) .where(eq(summoner.puuid, summ.puuid)); if (lastRank && areRanksEqual(lastRank, newRank)) return; diff --git a/src/features/lol/summoner.ts b/src/features/lol/summoner.ts index 0a2a4dd..efe1ad5 100644 --- a/src/features/lol/summoner.ts +++ b/src/features/lol/summoner.ts @@ -2,8 +2,9 @@ import { addRequest, galeforce } from "../summoner"; export const getSummonerData = async (puuid: string) => { const summonerData = await galeforce.lol.summoner().region(galeforce.region.lol.EUROPE_WEST).puuid(puuid).exec(); + const account = await galeforce.riot.account.account().region(galeforce.region.riot.EUROPE).puuid(puuid).exec(); await addRequest(); - return summonerData; + return { ...summonerData, fullname: `${account.gameName}#${account.tagLine}` }; }; export const getElos = async (id: string) => { diff --git a/src/features/summoner.ts b/src/features/summoner.ts index 8584c1f..7b3892a 100644 --- a/src/features/summoner.ts +++ b/src/features/summoner.ts @@ -27,7 +27,7 @@ export const getSummonerByName = async (name: string, tag: string) => { .region(galeforce.region.lol.EUROPE_WEST) .puuid(account.puuid) .exec(); - return summoner; + return { ...summoner, fullname: `${account.gameName}#${account.tagLine}` }; }; export const getQueueRank = async (tier: Galeforce.Tier) => { @@ -42,7 +42,10 @@ export const getQueueRank = async (tier: Galeforce.Tier) => { return queue; }; -export const addSummoner = async (riotSummoner: Galeforce.dto.SummonerDTO, channelId: string) => { +export const addSummoner = async ( + riotSummoner: Galeforce.dto.SummonerDTO & { fullname: string }, + channelId: string +) => { try { const identifier = { puuid: summoner.puuid, channelId }; @@ -56,7 +59,7 @@ export const addSummoner = async (riotSummoner: Galeforce.dto.SummonerDTO, chann if (existing) { await db .update(summoner) - .set({ isActive: true, currentName: riotSummoner.name }) + .set({ isActive: true, currentName: riotSummoner.fullname }) .where(eq(summoner.puuid, riotSummoner.puuid)); return identifier; @@ -67,7 +70,7 @@ export const addSummoner = async (riotSummoner: Galeforce.dto.SummonerDTO, chann id: riotSummoner.id, channelId, icon: riotSummoner.profileIconId, - currentName: riotSummoner.name, + currentName: riotSummoner.fullname, }); return identifier;