Compare commits

..
19 Commits
Author SHA1 Message Date
TrèsAbhi 90e012319a Merge pull request #30 from tresabhi/1.12.7 2023-09-08 21:35:46 -05:00
TresAbhi 18de9cbaab feat: upgraded dependencies 2023-09-09 02:35:14 +00:00
TresAbhi 42a76cbd38 feat: changelogs 2023-09-09 02:19:20 +00:00
TresAbhi eb95634801 fix: escaped markdown for clan event title 2023-09-09 02:11:32 +00:00
TresAbhi de8bfff47f feat: clearer statement about timezones 2023-09-09 02:10:54 +00:00
TresAbhi 07c18911df feat: clearer statement about public data 2023-09-09 02:06:09 +00:00
TresAbhi cc769cc330 fix: react is now defined 2023-09-09 02:04:36 +00:00
TrèsAbhi 9794f58936 Update cd-host.yml 2023-09-08 11:50:31 -05:00
TrèsAbhi a44fcff3b1 Update cd-host.yml 2023-09-08 11:48:41 -05:00
TrèsAbhi 7e4a3e88b9 Update cd-host.yml 2023-09-08 11:47:39 -05:00
TrèsAbhi 8fd45e2205 Merge pull request #29 from tresabhi/1.12.5 2023-09-08 11:45:15 -05:00
TresAbhi 7d235057e8 feat: changelogs 2023-09-08 16:41:06 +00:00
TresAbhi 63a8a67771 fix: better approximation message and players with 0 wins are omitted 2023-09-08 16:38:08 +00:00
TresAbhi bac39ca176 fix: only use players who have played within the last day 2023-09-08 16:30:44 +00:00
TrèsAbhi 626b1e8601 Merge branch '1.13.0' into main 2023-09-07 15:23:10 -05:00
TresAbhi ee44b1b1d8 feat: next js 2023-09-07 01:13:03 +00:00
TresAbhi d0f91df95b feat: split bot and server builds 2023-09-04 16:49:38 +00:00
TrèsAbhi dc1c49da6a Merge pull request #27 from tresabhi/main 2023-09-03 13:24:34 -05:00
TresAbhi eb4cb1fbfe feat: removed inDevelopment 2023-08-24 00:08:08 +00:00
37 changed files with 576 additions and 696 deletions

No files matched your search

+4 -4
View File
@@ -22,11 +22,11 @@ jobs:
- name: Download release assets - name: Download release assets
run: | run: |
DOWNLOAD_URL=$(curl -s https://api.github.com/repos/tresabhi/blitzkrieg/releases/latest \ DOWNLOAD_URL=$(curl -s https://api.github.com/repos/tresabhi/blitzkrieg/releases/latest \
| grep "browser_download_url.*dist.zip" \ | grep "browser_download_url.*bot.zip" \
| cut -d : -f 2,3 \ | cut -d : -f 2,3 \
| tr -d \") | tr -d \")
curl -L -o dist.zip $DOWNLOAD_URL curl -L -o bot.zip $DOWNLOAD_URL
unzip dist.zip unzip bot.zip
- name: Run bot - name: Run bot
run: NODE_ENV=production GH_TOKEN=${{ secrets.GH_TOKEN }} DISCORD_TOKEN=${{ secrets.DISCORD_TOKEN }} WARGAMING_APPLICATION_ID=${{ secrets.WARGAMING_APPLICATION_ID }} node --enable-source-maps --trace-warnings bot.cjs run: NODE_ENV=production GH_TOKEN=${{ secrets.GH_TOKEN }} DISCORD_TOKEN=${{ secrets.DISCORD_TOKEN }} WARGAMING_APPLICATION_ID=${{ secrets.WARGAMING_APPLICATION_ID }} node --enable-source-maps --trace-warnings bot/index.cjs
+3 -1
View File
@@ -9,6 +9,8 @@ dist.*
yarn-error.log yarn-error.log
commands.txt commands.txt
/test.* /test.*
test.*
/docs/.vitepress/dist /docs/.vitepress/dist
/docs/.vitepress/cache /docs/.vitepress/cache
servers.csv servers.csv
.next/
+2 -2
View File
@@ -1,4 +1,4 @@
# Blitzkrieg 1.12.4 # Blitzkrieg 1.12.5
Some patch up work Some patch up work
@@ -6,7 +6,7 @@ Some patch up work
- `/clan-event` now is more legible and comes with an approximation warning - `/clan-event` now is more legible and comes with an approximation warning
## Fixed ## Fixes
- `/clan-event` now uses a more optimized way of fetching large data - `/clan-event` now uses a more optimized way of fetching large data
- This should fix the issue where too many people using the command broke it - This should fix the issue where too many people using the command broke it
+12
View File
@@ -0,0 +1,12 @@
# Blitzkrieg 1.12.6
Stops making the bot lie!
## Changes
- The approximation warning for `/clan-event` has been made more concise
- Players with `0` wins are now omitted
## Fixes
- Players who haven't player within the current day are now omitted
+13
View File
@@ -0,0 +1,13 @@
# Blitzkrieg 1.12.7
A few fixes and clarifications
## Changes
- `/clan-event`
- Made statement about the limited publicly available data
- Added a statement about reset times
## Fixes
- Commands with images now once again work
+5
View File
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
+7
View File
@@ -0,0 +1,7 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
/* config options here */
distDir: 'dist/website',
};
export default nextConfig;
+20 -14
View File
@@ -1,24 +1,28 @@
{ {
"name": "blitzkrieg", "name": "blitzkrieg",
"version": "1.12.1", "version": "1.12.7",
"description": "🎉 All-in-one Discord bot for everything World of Tanks Blitz", "description": "🎉 All-in-one Discord bot for everything World of Tanks Blitz",
"main": "src/server.ts", "main": "src/server.ts",
"type": "module", "type": "module",
"scripts": { "scripts": {
"build": "node scripts/build && yarn build:website",
"build:bot": "node scripts/build --build=bot", "build:bot": "node scripts/build --build=bot",
"build:server": "node scripts/build --build=server", "build:server": "node scripts/build --build=server",
"build:website": "next build",
"build:docs": "vitepress build docs", "build:docs": "vitepress build docs",
"build:ratingsleaderboard": "vite-node --script scripts/buildRatingsLeaderboard", "build:ratingsleaderboard": "vite-node --script scripts/buildRatingsLeaderboard",
"build": "node scripts/build --build=all", "dev:bot": "yarn build:bot && yarn start:bot",
"dev:bot": "yarn build:bot --dev && yarn start:bot", "dev:server": "yarn build:server && yarn start:server",
"dev:server": "yarn build:server --dev && yarn start:server",
"dev:docs": "vitepress dev docs", "dev:docs": "vitepress dev docs",
"start:bot": "node --enable-source-maps --trace-warnings dist/bot.cjs", "dev:website": "next dev",
"start:server": "node --enable-source-maps --trace-warnings dist/server.cjs", "start:bot": "node --enable-source-maps --trace-warnings dist/bot/index.cjs",
"start:server": "node --enable-source-maps --trace-warnings dist/server/index.cjs",
"start:website": "next start",
"host:docs": "vitepress preview docs", "host:docs": "vitepress preview docs",
"publish:ratingsleaderboard": "vite-node --script scripts/buildRatingsLeaderboard --publish", "publish:ratingsleaderboard": "vite-node --script scripts/buildRatingsLeaderboard --publish",
"zip": "zip -r dist.zip dist", "zip": "zip -r dist.zip dist",
"lint": "npx tsc", "lint": "npx tsc",
"lint:website": "next lint",
"format": "prettier --write \"**/*.@(json|js|jsx|css|md|ts|tsx|html|xml|yml|gltf)\"", "format": "prettier --write \"**/*.@(json|js|jsx|css|md|ts|tsx|html|xml|yml|gltf)\"",
"knip": "knip", "knip": "knip",
"update": "yarn upgrade --latest" "update": "yarn upgrade --latest"
@@ -35,23 +39,25 @@
"fuzzysort": "^2.0.4", "fuzzysort": "^2.0.4",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"markdown-escape": "^2.0.0", "markdown-escape": "^2.0.0",
"next": "^13.4.19",
"react": "^18.2.0", "react": "^18.2.0",
"satori": "^0.10.3", "react-dom": "^18.2.0",
"vite-node": "^0.34.2", "satori": "^0.10.4",
"vite-node": "^0.34.4",
"vitepress-plugin-auto-sidebar": "^1.1.0" "vitepress-plugin-auto-sidebar": "^1.1.0"
}, },
"devDependencies": { "devDependencies": {
"@total-typescript/ts-reset": "^0.5.1", "@total-typescript/ts-reset": "^0.5.1",
"@types/escape-html": "^1.0.2", "@types/escape-html": "^1.0.2",
"@types/express": "^4.17.17", "@types/express": "^4.17.17",
"@types/lodash": "^4.14.197", "@types/lodash": "^4.14.198",
"@types/markdown-escape": "^1.1.0", "@types/markdown-escape": "^1.1.0",
"@types/node": "^20.5.3", "@types/node": "^20.6.0",
"@types/react": "^18.2.21", "@types/react": "^18.2.21",
"compare-versions": "^6.1.0", "compare-versions": "^6.1.0",
"knip": "^2.19.9", "knip": "^2.22.0",
"prettier": "^3.0.2", "prettier": "^3.0.3",
"typescript": "^5.0.4", "typescript": "^5.2.2",
"vitepress": "^1.0.0-rc.4" "vitepress": "^1.0.0-rc.10"
} }
} }
+24 -54
View File
@@ -1,63 +1,33 @@
import { build } from 'esbuild'; import { build } from 'esbuild';
import { copyFile, mkdirSync, rmSync } from 'fs';
import { argv } from 'process'; import { argv } from 'process';
const isProd = !argv.includes('--dev'); const targetFile = argv
const buildAll = argv.includes('--build=all'); .find((arg) => arg.startsWith('--build='))
const buildBot = argv.includes('--build=bot') || buildAll; ?.split('=')[1];
const buildServer = argv.includes('--build=server') || buildAll; const files = targetFile ? [targetFile] : ['bot', 'server'];
if (isProd) { files.forEach(async (file) => {
// only remove in production to ensure no time is wasted in dev console.log(`Building ${file}...`);
console.log('Removing dist...');
rmSync('dist', { recursive: true, force: true });
console.log('Dist removed');
console.log('Creating dist...'); await build({
mkdirSync('dist'); entryPoints: [`src/${file}.ts`],
console.log('Dist created'); outfile: `dist/${file}/index.cjs`,
console.log('Copying package.json...'); platform: 'node',
copyFile('package.dist.json', 'dist/package.json', () => loader: {
console.log('package.json copied'), '.node': 'copy',
); '.ttf': 'file',
} },
format: 'cjs',
const commonOptions = { bundle: true,
platform: 'node', sourcemap: true,
loader: { minifyIdentifiers: false, // cause goofy errors
'.node': 'copy', minifySyntax: true,
'.ttf': 'file', minifyWhitespace: true,
},
format: 'cjs',
bundle: true, logLevel: 'info',
sourcemap: true,
minifyIdentifiers: false, // causes errors
minifySyntax: isProd,
minifyWhitespace: isProd,
logLevel: isProd ? 'info' : 'silent',
};
if (buildBot) {
console.log('Building bot...');
build({
...commonOptions,
entryPoints: ['src/bot.ts'],
outfile: 'dist/bot.cjs',
}).then(() => console.log('Bot built'));
}
if (buildServer) {
console.log('Building server...');
build({
...commonOptions,
entryPoints: ['src/server.ts'],
outfile: 'dist/server.cjs',
}).then(() => {
console.log('Server built');
}); });
}
console.log(`Built ${file}`);
});
+10 -3
View File
@@ -31,7 +31,11 @@ const PLAYERS = await fetch(
`https://${server}.wotblitz.com/en/api/rating-leaderboards/season/`, `https://${server}.wotblitz.com/en/api/rating-leaderboards/season/`,
) )
.then((response) => response.json() as Promise<RatingsInfo>) .then((response) => response.json() as Promise<RatingsInfo>)
.then((data) => data.count); .then((data) => (data.detail === undefined ? data.count : undefined));
if (PLAYERS === undefined) {
throw new Error('No current ratings season running');
}
const players: Record<number, RatingsPlayer> = {}; const players: Record<number, RatingsPlayer> = {};
const leaderboard: BlitzkriegRatingsLeaderboard = []; const leaderboard: BlitzkriegRatingsLeaderboard = [];
@@ -60,7 +64,7 @@ async function branchFromPlayer(id: number) {
console.log( console.log(
`Registered ${registered} / ${PLAYERS} (${( `Registered ${registered} / ${PLAYERS} (${(
(registered / PLAYERS) * (registered / PLAYERS!) *
100 100
).toFixed(2)}%)`, ).toFixed(2)}%)`,
); );
@@ -109,7 +113,10 @@ if (publish) {
const info = await fetch( const info = await fetch(
`https://${server}.wotblitz.com/en/api/rating-leaderboards/season/`, `https://${server}.wotblitz.com/en/api/rating-leaderboards/season/`,
).then((response) => response.json() as Promise<RatingsInfo>); ).then(
(response) =>
response.json() as Promise<RatingsInfo & { detail: undefined }>,
);
const normalizedServer = server === 'na' ? 'com' : server; const normalizedServer = server === 'na' ? 'com' : server;
const infoPath = `${normalizedServer}/ratings/${info.current_season}/info.json`; const infoPath = `${normalizedServer}/ratings/${info.current_season}/info.json`;
+31
View File
@@ -0,0 +1,31 @@
import { ReactNode } from 'react';
import Navbar from '../components/Navbar';
interface RootLayoutProps {
children: ReactNode;
}
export default function RootLayout({ children }: RootLayoutProps) {
return (
<html>
<body
style={{
margin: 0,
}}
>
<div
style={{
width: '100vw',
height: '100vh',
display: 'flex',
flexDirection: 'column',
}}
>
<Navbar />
{children}
</div>
</body>
</html>
);
}
+3
View File
@@ -0,0 +1,3 @@
export default function Page() {
return <h1>Hello, Next.js!</h1>;
}
+13 -10
View File
@@ -1,7 +1,8 @@
import { SlashCommandBuilder } from 'discord.js'; import { SlashCommandBuilder, escapeMarkdown } from 'discord.js';
import markdownEscape from 'markdown-escape'; import markdownEscape from 'markdown-escape';
import getWargamingResponse from '../core/blitz/getWargamingResponse'; import getWargamingResponse from '../core/blitz/getWargamingResponse';
import { PlayerHistoriesRaw } from '../core/blitzstars/getPlayerHistories'; import { PlayerHistoriesRaw } from '../core/blitzstars/getPlayerHistories';
import getTimeDaysAgo from '../core/blitzstars/getTimeDaysAgo';
import addClanChoices from '../core/discord/addClanChoices'; import addClanChoices from '../core/discord/addClanChoices';
import autocompleteClan from '../core/discord/autocompleteClan'; import autocompleteClan from '../core/discord/autocompleteClan';
import embedWarning from '../core/discord/embedWarning'; import embedWarning from '../core/discord/embedWarning';
@@ -12,11 +13,8 @@ import { AccountAchievements } from '../types/accountAchievements';
import { AccountInfo } from '../types/accountInfo'; import { AccountInfo } from '../types/accountInfo';
import { ClanInfo } from '../types/clanInfo'; import { ClanInfo } from '../types/clanInfo';
const DEFAULT_THRESHOLD = 7;
export const clanEventCommand: CommandRegistry = { export const clanEventCommand: CommandRegistry = {
inProduction: true, inProduction: true,
inDevelopment: true,
inPublic: true, inPublic: true,
command: new SlashCommandBuilder() command: new SlashCommandBuilder()
@@ -63,19 +61,24 @@ export const clanEventCommand: CommandRegistry = {
const jointVictories = clan.members_ids.map((id) => ({ const jointVictories = clan.members_ids.map((id) => ({
id, id,
joinVictory: joinVictory:
previousJointVictories[id] === undefined players[id].last_battle_time > getTimeDaysAgo(region, 1)
? 0 ? previousJointVictories[id] === undefined
: achievements[id].max_series.jointVictory - ? 0
previousJointVictories[id]!, : achievements[id].max_series.jointVictory -
previousJointVictories[id]!
: 0,
})); }));
return [ return [
`# ${clan.name} [${clan.tag}]'s platoon wins today: ${( `# ${escapeMarkdown(clan.name)} [${escapeMarkdown(
clan.tag,
)}]'s platoon wins today: ${(
jointVictories.reduce( jointVictories.reduce(
(accumulator, { joinVictory }) => accumulator + joinVictory, (accumulator, { joinVictory }) => accumulator + joinVictory,
0, 0,
) / 2 ) / 2
).toFixed(0)}\n${jointVictories ).toFixed(0)}\n${jointVictories
.filter(({ joinVictory }) => joinVictory)
.sort((a, b) => b.joinVictory - a.joinVictory) .sort((a, b) => b.joinVictory - a.joinVictory)
.map( .map(
({ id, joinVictory }) => ({ id, joinVictory }) =>
@@ -85,7 +88,7 @@ export const clanEventCommand: CommandRegistry = {
embedWarning( embedWarning(
'This is an approximation!', 'This is an approximation!',
'Wargaming provides use with little to no information about platoons. Platooning with mixed clans may inflate the number and platooning in non-regular battles may deflate.', "Wargaming provides very little information about platoons publicly. Caveats:\n- Players in two different clans platooning artificially inflates the total count\n- Game-mode battles aren't counted since Wargaming doesn't publicly share that data\n- This command is also subject to Blitzkrieg's reset times (use `/help timezones` for more info)",
), ),
]; ];
}, },
-1
View File
@@ -12,7 +12,6 @@ const executionStart = new Date().getTime();
export const debugCommand: CommandRegistry = { export const debugCommand: CommandRegistry = {
inProduction: true, inProduction: true,
inDevelopment: true,
inPublic: true, inPublic: true,
command: new SlashCommandBuilder() command: new SlashCommandBuilder()
-1
View File
@@ -26,7 +26,6 @@ export const SKILLED_CLANS: Record<SkilledClan, string> = {
export const eligibleCommand: CommandRegistry = { export const eligibleCommand: CommandRegistry = {
inProduction: true, inProduction: true,
inDevelopment: true,
inPublic: false, inPublic: false,
command: new SlashCommandBuilder() command: new SlashCommandBuilder()
-1
View File
@@ -29,7 +29,6 @@ export const evolutionCommand = new Promise<CommandRegistryRaw>(
resolve({ resolve({
inProduction: true, inProduction: true,
inDevelopment: true,
inPublic: true, inPublic: true,
command, command,
-1
View File
@@ -29,7 +29,6 @@ export const fullStatsCommand = new Promise<CommandRegistryRaw>(
resolve({ resolve({
inProduction: true, inProduction: true,
inDevelopment: true,
inPublic: true, inPublic: true,
command, command,
-1
View File
@@ -30,7 +30,6 @@ function addDocsSubcommands(option: SlashCommandSubcommandsOnlyBuilder) {
export const helpCommand: CommandRegistry = { export const helpCommand: CommandRegistry = {
inProduction: true, inProduction: true,
inDevelopment: true,
inPublic: true, inPublic: true,
command: addDocsSubcommands( command: addDocsSubcommands(
-1
View File
@@ -16,7 +16,6 @@ const DEFAULT_THRESHOLD = 7;
export const inactiveCommand: CommandRegistry = { export const inactiveCommand: CommandRegistry = {
inProduction: true, inProduction: true,
inDevelopment: true,
inPublic: true, inPublic: true,
command: new SlashCommandBuilder() command: new SlashCommandBuilder()
-1
View File
@@ -46,7 +46,6 @@ const COMP_TANKS = [
export const ownedTanksCommand: CommandRegistry = { export const ownedTanksCommand: CommandRegistry = {
inProduction: true, inProduction: true,
inDevelopment: true,
inPublic: true, inPublic: true,
command: new SlashCommandBuilder() command: new SlashCommandBuilder()
-1
View File
@@ -3,7 +3,6 @@ import { CommandRegistry } from '../events/interactionCreate';
export const pingCommand: CommandRegistry = { export const pingCommand: CommandRegistry = {
inProduction: true, inProduction: true,
inDevelopment: true,
inPublic: true, inPublic: true,
handlesInteraction: true, handlesInteraction: true,
-1
View File
@@ -16,7 +16,6 @@ type SortBy = 'name' | 'count';
export const playerAchievementsCommand: CommandRegistry = { export const playerAchievementsCommand: CommandRegistry = {
inProduction: true, inProduction: true,
inDevelopment: true,
inPublic: true, inPublic: true,
command: new SlashCommandBuilder() command: new SlashCommandBuilder()
-1
View File
@@ -12,7 +12,6 @@ import { AccountInfo } from '../types/accountInfo';
export const playerInfoCommand: CommandRegistry = { export const playerInfoCommand: CommandRegistry = {
inProduction: true, inProduction: true,
inDevelopment: true,
inPublic: true, inPublic: true,
command: new SlashCommandBuilder() command: new SlashCommandBuilder()
-1
View File
@@ -218,7 +218,6 @@ export const ratingsCommand = new Promise<CommandRegistryRaw>(
resolve({ resolve({
inProduction: true, inProduction: true,
inDevelopment: true,
inPublic: true, inPublic: true,
command, command,
-1
View File
@@ -11,7 +11,6 @@ import { ClanList } from '../types/clanList';
export const searchClansCommand: CommandRegistry = { export const searchClansCommand: CommandRegistry = {
inProduction: true, inProduction: true,
inDevelopment: true,
inPublic: true, inPublic: true,
command: new SlashCommandBuilder() command: new SlashCommandBuilder()
-1
View File
@@ -12,7 +12,6 @@ import { AccountList } from '../types/accountList';
export const searchPlayersCommand: CommandRegistry = { export const searchPlayersCommand: CommandRegistry = {
inProduction: true, inProduction: true,
inDevelopment: true,
inPublic: true, inPublic: true,
command: new SlashCommandBuilder() command: new SlashCommandBuilder()
-1
View File
@@ -8,7 +8,6 @@ import { CommandRegistry } from '../events/interactionCreate';
export const searchTanksCommand: CommandRegistry = { export const searchTanksCommand: CommandRegistry = {
inProduction: true, inProduction: true,
inDevelopment: true,
inPublic: true, inPublic: true,
command: new SlashCommandBuilder() command: new SlashCommandBuilder()
-1
View File
@@ -27,7 +27,6 @@ export const statsCommand = new Promise<CommandRegistryRaw>(async (resolve) => {
resolve({ resolve({
inProduction: true, inProduction: true,
inDevelopment: true,
inPublic: true, inPublic: true,
command, command,
-1
View File
@@ -15,7 +15,6 @@ import { AccountInfo } from '../types/accountInfo';
export const todayCommand: CommandRegistry = { export const todayCommand: CommandRegistry = {
inProduction: true, inProduction: true,
inDevelopment: true,
inPublic: true, inPublic: true,
command: new SlashCommandBuilder() command: new SlashCommandBuilder()
-1
View File
@@ -14,7 +14,6 @@ import { PlayerClanData } from '../types/playerClanData';
export const verifyCommand: CommandRegistry = { export const verifyCommand: CommandRegistry = {
inProduction: true, inProduction: true,
inDevelopment: true,
inPublic: true, inPublic: true,
command: new SlashCommandBuilder() command: new SlashCommandBuilder()
+5
View File
@@ -0,0 +1,5 @@
export default function Navbar() {
return (
<div style={{ display: 'flex', height: 100, backgroundColor: 'red' }}></div>
);
}
+5 -8
View File
@@ -51,7 +51,6 @@ export type InteractionReturnable =
| Promise<InteractionIterableReturnable>; | Promise<InteractionIterableReturnable>;
export interface Registry { export interface Registry {
inDevelopment: boolean;
inProduction: boolean; inProduction: boolean;
} }
@@ -124,14 +123,12 @@ export const publicCommands: RESTPostAPIChatInputApplicationCommandsJSONBody[] =
commands.then((awaitedCommands) => { commands.then((awaitedCommands) => {
Object.entries(awaitedCommands).forEach(([, registry]) => { Object.entries(awaitedCommands).forEach(([, registry]) => {
if (isDev() ? registry.inDevelopment : registry.inProduction) { const json = registry.command.toJSON();
const json = registry.command.toJSON();
if (registry.inPublic) { if (registry.inPublic) {
publicCommands.push(json); publicCommands.push(json);
} else { } else {
guildCommands.push(json); guildCommands.push(json);
}
} }
}); });
-1
View File
@@ -6,7 +6,6 @@ import { RouteRegistry } from '../server';
export const statsRoute: RouteRegistry = { export const statsRoute: RouteRegistry = {
route: '/stats/:type/:period', route: '/stats/:type/:period',
inProduction: true, inProduction: true,
inDevelopment: true,
async handler(req) { async handler(req) {
const type = req.params.type as StatType; const type = req.params.type as StatType;
-1
View File
@@ -5,7 +5,6 @@ import { RouteRegistry } from '../server';
export const todayRoute: RouteRegistry = { export const todayRoute: RouteRegistry = {
route: '/today', route: '/today',
inProduction: true, inProduction: true,
inDevelopment: true,
async handler(req) { async handler(req) {
const player = resolvePlayerFromRequest(req); const player = resolvePlayerFromRequest(req);
-3
View File
@@ -1,7 +1,6 @@
import express, { Request, Response } from 'express'; import express, { Request, Response } from 'express';
import normalizeRouteReturnable from './core/express/normalizeRouteReturnable'; import normalizeRouteReturnable from './core/express/normalizeRouteReturnable';
import withAutoRefresh from './core/express/withAutoRefresh'; import withAutoRefresh from './core/express/withAutoRefresh';
import isDev from './core/node/isDev';
import { Registry } from './events/interactionCreate'; import { Registry } from './events/interactionCreate';
import { statsRoute } from './routes/stats'; import { statsRoute } from './routes/stats';
import { todayRoute } from './routes/today'; import { todayRoute } from './routes/today';
@@ -22,8 +21,6 @@ export interface RouteRegistry<HandlesInteraction extends boolean = false>
const app = express(); const app = express();
([statsRoute, todayRoute] as RouteRegistry[]).forEach((registry) => { ([statsRoute, todayRoute] as RouteRegistry[]).forEach((registry) => {
if (!(isDev() ? registry.inDevelopment : registry.inProduction)) return;
app.get(registry.route, async (req, res) => { app.get(registry.route, async (req, res) => {
console.log(req.originalUrl); console.log(req.originalUrl);
+12 -2
View File
@@ -9,7 +9,17 @@
"skipLibCheck": true, "skipLibCheck": true,
"noEmit": true, "noEmit": true,
"resolveJsonModule": true, "resolveJsonModule": true,
"jsx": "react-jsx" "jsx": "react-jsx",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"incremental": true,
"isolatedModules": true,
"plugins": [
{
"name": "next"
}
]
}, },
"include": ["src/**/*.ts", "src/components/Tanks/components/Row.tsx", "src/commands/clanEvent.ts"] "include": ["src/**/*", ".next/types/**/*.ts", "dist/website/types/**/*.ts"],
"exclude": ["node_modules"]
} }
+407 -576
View File
File diff suppressed because it is too large. Load diff