mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-01 19:38:13 +03:00
Update everything to latest.
This commit is contained in:
@@ -4,3 +4,4 @@ node_modules
|
||||
yarn-error.log
|
||||
.env
|
||||
conf.json5
|
||||
js
|
||||
+38
-39
@@ -1,41 +1,40 @@
|
||||
{
|
||||
"name": "tachi-bot",
|
||||
"version": "1.0.0",
|
||||
"main": "src/index.ts",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"start": "ts-node -r dotenv/config src/index.ts",
|
||||
"setup": "./scripts/createEnv.sh"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/express": "^4.17.13",
|
||||
"@types/express-serve-static-core": "^4.17.24",
|
||||
"@types/jest": "^27.0.1",
|
||||
"@types/json5": "^2.2.0",
|
||||
"@types/lodash": "^4.14.172",
|
||||
"@types/node": "^16.7.10",
|
||||
"@typescript-eslint/eslint-plugin": "^4.29.1",
|
||||
"@typescript-eslint/parser": "^4.29.1",
|
||||
"discord-api-types": "^0.22.0",
|
||||
"eslint": "^7.32.0",
|
||||
"jest": "^27.0.6",
|
||||
"prettier": "^2.3.2",
|
||||
"typescript": "^4.3.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@discordjs/builders": "^0.5.0",
|
||||
"@discordjs/rest": "^0.1.0-canary.0",
|
||||
"axios": "^0.21.4",
|
||||
"deezer-api-ts": "^1.2.1",
|
||||
"discord.js": "^13.1.0",
|
||||
"dotenv": "^10.0.0",
|
||||
"express": "^4.17.1",
|
||||
"json5": "^2.2.0",
|
||||
"lodash": "^4.17.21",
|
||||
"prudence": "^0.9.6",
|
||||
"songlink-api": "^1.0.0",
|
||||
"tachi-common": "^0.2.1",
|
||||
"ts-node": "^10.2.0",
|
||||
"winston": "^3.3.3"
|
||||
}
|
||||
"name": "tachi-bot",
|
||||
"version": "1.0.0",
|
||||
"main": "src/index.ts",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"start": "ts-node -r dotenv/config src/index.ts",
|
||||
"setup": "./scripts/createEnv.sh"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/express": "^4.17.13",
|
||||
"@types/express-serve-static-core": "^4.17.24",
|
||||
"@types/jest": "^27.0.1",
|
||||
"@types/json5": "^2.2.0",
|
||||
"@types/lodash": "^4.14.172",
|
||||
"@types/node": "^16.7.10",
|
||||
"@typescript-eslint/eslint-plugin": "^4.29.1",
|
||||
"@typescript-eslint/parser": "^4.29.1",
|
||||
"discord-api-types": "^0.22.0",
|
||||
"eslint": "^7.32.0",
|
||||
"jest": "^27.0.6",
|
||||
"prettier": "^2.3.2",
|
||||
"typescript": "^4.3.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@discordjs/builders": "^0.5.0",
|
||||
"@discordjs/rest": "^0.1.0-canary.0",
|
||||
"axios": "^0.21.4",
|
||||
"discord.js": "^13.1.0",
|
||||
"dotenv": "^10.0.0",
|
||||
"express": "^4.17.1",
|
||||
"json5": "^2.2.0",
|
||||
"lodash": "^4.17.21",
|
||||
"node-fetch": "^3.2.0",
|
||||
"prudence": "^0.9.6",
|
||||
"tachi-common": "^0.6.11",
|
||||
"ts-node": "^10.2.0",
|
||||
"winston": "^3.3.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ export interface PBResponse {
|
||||
pbs: PBScoreDocument[];
|
||||
}
|
||||
|
||||
export const buildSongSelect = <T extends Game>(songs: SongSearchResult[], playtype: Playtypes[T], game: Game) => {
|
||||
export const buildSongSelect = <T extends Game>(songs: SongSearchResult[], playtype: Playtypes[T], game: Game): MessageActionRow => {
|
||||
return new MessageActionRow().addComponents(
|
||||
new MessageSelectMenu()
|
||||
.setCustomId(validSelectCustomIdPrefaces.selectSongForSearch)
|
||||
@@ -80,7 +80,10 @@ export const buildChartEmbed = async <T extends Game, I extends IDStrings = IDSt
|
||||
} else if (songId) {
|
||||
const details = await getDetailedSongData(songId, playtype, game);
|
||||
embed.addField(details.song.title || "Song", details.song.artist || "Artist");
|
||||
embed.setThumbnail(getGameImage(details.song.firstVersion || "0", game));
|
||||
|
||||
if ("firstVersion" in details.song.data) {
|
||||
embed.setThumbnail(getGameImage(details.song.data?.firstVersion, game));
|
||||
}
|
||||
|
||||
const filteredCharts = details.charts.filter((chart) => {
|
||||
if (IIDExtra) {
|
||||
@@ -93,6 +96,7 @@ export const buildChartEmbed = async <T extends Game, I extends IDStrings = IDSt
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
const sortedCharts = filteredCharts.sort((a, b) => a.levelNum - b.levelNum);
|
||||
|
||||
for (const chart of sortedCharts) {
|
||||
|
||||
@@ -20,7 +20,7 @@ export interface SearchResult {
|
||||
}
|
||||
|
||||
export interface DetailedSongResponse {
|
||||
song: Partial<SongDocument>;
|
||||
song: SongDocument;
|
||||
charts: ChartDocument[];
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ export const getSongMeta = async (songName: string): Promise<SongSearchResult[]>
|
||||
try {
|
||||
logger.info(`Searching for ${songName}`);
|
||||
const songResponse = (
|
||||
await TachiServerV1Get<SearchResult>("/search", {
|
||||
await TachiServerV1Get<SearchResult>("/search", "TEMP_MUST_REFACTOR_THIS", {
|
||||
search: songName
|
||||
})
|
||||
).body?.songs;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import { Snowflake } from "discord.js/typings/index.js";
|
||||
// import monk from "monk";
|
||||
import { integer } from "tachi-common";
|
||||
// import { ProcessEnv } from "../setup";
|
||||
|
||||
// const monkDB = monk(ProcessEnv.MONGO_URL);
|
||||
|
||||
export interface DiscordUserMapDocument {
|
||||
userID: integer;
|
||||
discordID: Snowflake;
|
||||
tachiApiToken: string;
|
||||
}
|
||||
|
||||
const db = {
|
||||
discordUserMap: (() => { console.error("DATABASE HAS BEEN STUBBED OUT TEMPORARILY. SIGTERMING."); process.exit(1); } ) as any // monkDB.get<DiscordUserMapDocument>("discordUserMap")
|
||||
};
|
||||
|
||||
export default db;
|
||||
@@ -1,18 +0,0 @@
|
||||
import { Snowflake } from "discord.js/typings/index.js";
|
||||
import monk from "monk";
|
||||
import { integer } from "tachi-common";
|
||||
import { ProcessEnv } from "../setup";
|
||||
|
||||
const monkDB = monk(ProcessEnv.MONGO_URL);
|
||||
|
||||
export interface DiscordUserMapDocument {
|
||||
userID: integer;
|
||||
discordID: Snowflake;
|
||||
tachiApiToken: string;
|
||||
}
|
||||
|
||||
const db = {
|
||||
discordUserMap: monkDB.get<DiscordUserMapDocument>("discordUserMap")
|
||||
};
|
||||
|
||||
export default db;
|
||||
@@ -18,7 +18,7 @@ const logger = createLayeredLogger(LoggerLayers.buildProfileEmbed);
|
||||
|
||||
const pullRatings = <I extends IDStrings = IDStrings>(
|
||||
gpt: SimpleGameType<Game>,
|
||||
ratings: Partial<Record<UGSRatingsLookup[I], number>>
|
||||
ratings: Partial<Record<UGSRatingsLookup[I], number | null>>
|
||||
): string[] => {
|
||||
const allRatings: string[] = [];
|
||||
const RatingKeys = <UGSRatingsLookup[I][]>Object.keys(ratings);
|
||||
@@ -53,7 +53,7 @@ export const buildProfileEmbed = async (data: UserGameStats[], game?: SimpleGame
|
||||
|
||||
const userId = data[0].userID;
|
||||
const userDetails = await fetchUserDetails(userId);
|
||||
const pfp = userDetails.customPfp
|
||||
const pfp = userDetails.customPfpLocation
|
||||
? getPfpUrl(userId)
|
||||
: "https://cdn.mos.cms.futurecdn.net/mrArzwHcNuQbRwbEmuiwdJ.jpg";
|
||||
embed.setTitle(`${userDetails.username}'s Profile`);
|
||||
|
||||
@@ -5,7 +5,7 @@ import { ValidateWebhookRequest } from "./middleware";
|
||||
import { WebhookEvents, APITokenDocument, PublicUserDocument } from "tachi-common";
|
||||
import { BotConfig, ProcessEnv } from "../setup";
|
||||
import { RequestTypes, TachiServerV1Get, TachiServerV1Request } from "../utils/fetch-tachi";
|
||||
import db from "../mongo/mongo";
|
||||
import db from "../database/mongo";
|
||||
|
||||
const app: Express = express();
|
||||
|
||||
|
||||
+20
-10
@@ -1,11 +1,21 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"noImplicitAny": true,
|
||||
"strict": true,
|
||||
"types": ["node", "jest"],
|
||||
"esModuleInterop": true, // lets us use module.exports stuff as if they were ES6 modules.
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "**/*.spec.ts"]
|
||||
}
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"noImplicitAny": true,
|
||||
"strict": true,
|
||||
"target": "ES2020",
|
||||
"types": [
|
||||
"node",
|
||||
"jest"
|
||||
],
|
||||
"outDir": "js/",
|
||||
"esModuleInterop": true, // lets us use module.exports stuff as if they were ES6 modules.
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"**/*.spec.ts"
|
||||
]
|
||||
}
|
||||
+96
-1598
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user