mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-01 11:28:13 +03:00
Create a getTachiIdByDiscordId stub
This commit is contained in:
+2
-1
@@ -10,5 +10,6 @@ export enum LoggerLayers {
|
||||
tachiFetch = "tachiFetch",
|
||||
profile = "profile",
|
||||
selectInteractionHandler = "selectInteractionHandler",
|
||||
buildProfileEmbed = "buildProfileEmbed"
|
||||
buildProfileEmbed = "buildProfileEmbed",
|
||||
tachiLinker = "tachiLinker"
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { CommandInteraction } from "discord.js";
|
||||
import { IDStrings } from "tachi-common";
|
||||
import { LoggerLayers } from "../config";
|
||||
import { BotConfig } from "../setup";
|
||||
import { getTachiIdByDiscordId } from "../utils/discord-to-tachi";
|
||||
import { createLayeredLogger } from "../utils/logger";
|
||||
import { stringToSimpleGameType } from "../utils/utils";
|
||||
import { buildProfileIntractable } from "./buildProfileEmbed";
|
||||
@@ -11,7 +12,7 @@ const logger = createLayeredLogger(LoggerLayers.profile);
|
||||
export const getProfileByName = async (interaction: CommandInteraction): Promise<void> => {
|
||||
try {
|
||||
/** @TODO this can be an @User, userId or userName!!! Handle this at some point */
|
||||
const userId = interaction.options.getString("user", false) || "TODO FALLBACK TO SELF";
|
||||
const userId = interaction.options.getString("user", false) || getTachiIdByDiscordId(interaction.user.id);
|
||||
logger.info(`Fetching user ${userId}`);
|
||||
|
||||
const optionalGameOption = <IDStrings | undefined>interaction.options.getString("game", false);
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import { LoggerLayers } from "../config";
|
||||
import { createLayeredLogger } from "./logger";
|
||||
const logger = createLayeredLogger(LoggerLayers.tachiLinker);
|
||||
|
||||
/** @TODO Stub */
|
||||
export const getTachiIdByDiscordId = (discordId: string): string => {
|
||||
/** @TODO Hit an internal database to grab user id */
|
||||
logger.info(`Fetching linked ID for ${discordId}`);
|
||||
return "0";
|
||||
};
|
||||
@@ -29,7 +29,6 @@ export const getPfpUrl = (userId: number): string => {
|
||||
return PrependTachiUrl(`/users/${userId}/pfp`);
|
||||
};
|
||||
|
||||
/** @TODO @zkldi is there somewhere this exists already? */
|
||||
export const gameIdentifierStrings = [
|
||||
"iidx:SP",
|
||||
"iidx:DP",
|
||||
@@ -57,7 +56,6 @@ export const formatGameScoreRating = <I extends IDStrings = IDStrings>(
|
||||
value: number
|
||||
): string => {
|
||||
const gptConfig = GetGamePTConfig(gpt.game, gpt.playtype);
|
||||
/** @TODO UGSRatingsLookup should be able to cast to ScoreCalculatedDataLookup straight up */
|
||||
const val = gptConfig.profileRatingAlgFormatters[ratingName];
|
||||
if (val) {
|
||||
return val(value);
|
||||
|
||||
Reference in New Issue
Block a user