Skip to content

Commit

Permalink
chore: format
Browse files Browse the repository at this point in the history
  • Loading branch information
shayypy committed Feb 1, 2024
1 parent 659e3d3 commit fbcd32a
Show file tree
Hide file tree
Showing 26 changed files with 136 additions and 137 deletions.
8 changes: 7 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
{
"$schema": "https://biomejs.dev/schemas/1.4.1/schema.json",
"files": {
"ignore": ["node_modules/", "build/", "./packages/site/functions/"]
"ignore": [
"node_modules/",
"build/",
"./packages/site/functions/",
"./packages/site/bot/migrations/",
".wrangler/"
]
},
"organizeImports": {
"enabled": true
Expand Down
7 changes: 6 additions & 1 deletion packages/api/src/games.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { type RESTGetAPIEvents, type RESTGetAPIEvent, APIRouteBases, Routes } from "khl-api-types";
import {
APIRouteBases,
type RESTGetAPIEvent,
type RESTGetAPIEvents,
Routes,
} from "khl-api-types";
import { KhlClientMethodOptions, requestJson } from "./rest";

export const getGames = async (
Expand Down
6 changes: 3 additions & 3 deletions packages/api/src/players.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {
Routes,
type RESTGetAPIPlayers,
type RESTGetAPIPlayersLight,
APILightPlayer,
APIPlayer,
APIRouteBases,
type RESTGetAPIPlayers,
type RESTGetAPIPlayersLight,
Routes,
} from "khl-api-types";
import { KhlApiError, KhlClientMethodOptions, requestJson } from "./rest";

Expand Down
7 changes: 6 additions & 1 deletion packages/api/src/teams.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { APIRouteBases, Routes, type RESTGetAPITeam, type RESTGetAPITeams } from "khl-api-types";
import {
APIRouteBases,
type RESTGetAPITeam,
type RESTGetAPITeams,
Routes,
} from "khl-api-types";
import { KhlClientMethodOptions, requestJson } from "./rest";

// I didn't want to hardcode the teams like this but it tends to make a lot of
Expand Down
7 changes: 2 additions & 5 deletions packages/bot/migrations/meta/0000_snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@
"indexes": {
"notifications_league_channelId_unique": {
"name": "notifications_league_channelId_unique",
"columns": [
"league",
"channelId"
],
"columns": ["league", "channelId"],
"isUnique": true
}
},
Expand All @@ -72,4 +69,4 @@
"tables": {},
"columns": {}
}
}
}
12 changes: 3 additions & 9 deletions packages/bot/migrations/meta/0001_snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,7 @@
"indexes": {
"games_league_nativeId_unique": {
"name": "games_league_nativeId_unique",
"columns": [
"league",
"nativeId"
],
"columns": ["league", "nativeId"],
"isUnique": true
}
},
Expand Down Expand Up @@ -127,10 +124,7 @@
"indexes": {
"notifications_league_channelId_unique": {
"name": "notifications_league_channelId_unique",
"columns": [
"league",
"channelId"
],
"columns": ["league", "channelId"],
"isUnique": true
}
},
Expand All @@ -145,4 +139,4 @@
"tables": {},
"columns": {}
}
}
}
12 changes: 3 additions & 9 deletions packages/bot/migrations/meta/0002_snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,7 @@
"indexes": {
"games_league_nativeId_unique": {
"name": "games_league_nativeId_unique",
"columns": [
"league",
"nativeId"
],
"columns": ["league", "nativeId"],
"isUnique": true
}
},
Expand Down Expand Up @@ -134,10 +131,7 @@
"indexes": {
"notifications_league_channelId_unique": {
"name": "notifications_league_channelId_unique",
"columns": [
"league",
"channelId"
],
"columns": ["league", "channelId"],
"isUnique": true
}
},
Expand All @@ -152,4 +146,4 @@
"tables": {},
"columns": {}
}
}
}
12 changes: 3 additions & 9 deletions packages/bot/migrations/meta/0003_snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,7 @@
"indexes": {
"games_league_nativeId_unique": {
"name": "games_league_nativeId_unique",
"columns": [
"league",
"nativeId"
],
"columns": ["league", "nativeId"],
"isUnique": true
}
},
Expand Down Expand Up @@ -149,10 +146,7 @@
"indexes": {
"notifications_league_channelId_unique": {
"name": "notifications_league_channelId_unique",
"columns": [
"league",
"channelId"
],
"columns": ["league", "channelId"],
"isUnique": true
}
},
Expand All @@ -167,4 +161,4 @@
"tables": {},
"columns": {}
}
}
}
12 changes: 3 additions & 9 deletions packages/bot/migrations/meta/0004_snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,7 @@
"indexes": {
"games_league_nativeId_unique": {
"name": "games_league_nativeId_unique",
"columns": [
"league",
"nativeId"
],
"columns": ["league", "nativeId"],
"isUnique": true
}
},
Expand Down Expand Up @@ -157,10 +154,7 @@
"indexes": {
"notifications_league_channelId_unique": {
"name": "notifications_league_channelId_unique",
"columns": [
"league",
"channelId"
],
"columns": ["league", "channelId"],
"isUnique": true
}
},
Expand All @@ -175,4 +169,4 @@
"tables": {},
"columns": {}
}
}
}
2 changes: 1 addition & 1 deletion packages/bot/migrations/meta/_journal.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@
"breakpoints": true
}
]
}
}
10 changes: 5 additions & 5 deletions packages/bot/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ import {
ChannelType,
RESTPostAPIApplicationCommandsJSONBody,
} from "discord-api-types/v10";
import { InteractionContext } from "./interactions";
import { PermissionFlags, PermissionsBitField } from "discord-bitflag";
import { aboutCallback } from "./commands/about";
import {
khlCalendarCallback,
pwhlGamedayCallback,
pwhlScheduleCallback,
} from "./commands/calendar";
import { aboutCallback } from "./commands/about";
import { teamAutocomplete } from "./commands/teamAutocomplete";
import { notificationsCallback } from "./commands/notifications";
import {
khlPlayerCallback,
pwhlPlayerCallback,
pwhlWhoisCallback,
} from "./commands/player";
import { teamAutocomplete } from "./commands/teamAutocomplete";
import { InteractionContext } from "./interactions";
import { allSeasons, allTeams } from "./pwhl/team";
import { notificationsCallback } from "./commands/notifications";
import { PermissionFlags, PermissionsBitField } from "discord-bitflag";

export type AppCommandCallbackT<T extends APIInteraction> = (
ctx: InteractionContext<T>,
Expand Down
7 changes: 3 additions & 4 deletions packages/bot/src/commands/about.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { ButtonBuilder, EmbedBuilder } from "@discordjs/builders";
import { ChatInputAppCommandCallback } from "../commands";
import { transformLocalizations } from "../util/l10n";
import { ButtonStyle } from "discord-api-types/v10";
import { ChatInputAppCommandCallback } from "../commands";
import { colors } from "../util/colors";
import { transformLocalizations } from "../util/l10n";

const s = transformLocalizations({
en: {
about: "About",
description:
"This bot covers various aspects of the PWHL and KHL.",
description: "This bot covers various aspects of the PWHL and KHL.",
site: "Website",
// site: "Site (+ Mac/iOS app!)",
},
Expand Down
26 changes: 13 additions & 13 deletions packages/bot/src/commands/calendar.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
import {
ActionRowBuilder,
ButtonBuilder,
EmbedBuilder,
time,
} from "@discordjs/builders";
import * as api from "api";
import {
APIGuildScheduledEvent,
ButtonStyle,
Expand All @@ -8,23 +15,16 @@ import {
RESTPostAPIGuildScheduledEventResult,
Routes,
} from "discord-api-types/v10";
import { PermissionFlags } from "discord-bitflag";
import { type APIEvent, State } from "khl-api-types";
import { ChatInputAppCommandCallback } from "../commands";
import { getKhlLocale, transformLocalizations, uni } from "../util/l10n";
import * as api from "api";
import { State, type APIEvent } from "khl-api-types";
import {
ActionRowBuilder,
ButtonBuilder,
EmbedBuilder,
time,
} from "@discordjs/builders";
import { khlTeamEmoji, pwhlTeamEmoji } from "../util/emojis";
import { ButtonCallback, MinimumKVComponentState } from "../components";
import { getPwhlClient } from "../pwhl/client";
import { allSeasons, allTeams } from "../pwhl/team";
import { storeComponents } from "../util/components";
import { ButtonCallback, MinimumKVComponentState } from "../components";
import { PermissionFlags } from "discord-bitflag";
import { colors } from "../util/colors";
import { storeComponents } from "../util/components";
import { khlTeamEmoji, pwhlTeamEmoji } from "../util/emojis";
import { getKhlLocale, transformLocalizations, uni } from "../util/l10n";

export const DATE_REGEX = /^(\d{4})-(\d{1,2})-(\d{1,2})$/;

Expand Down
18 changes: 9 additions & 9 deletions packages/bot/src/commands/notifications.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import { ChatInputAppCommandCallback } from "../commands";
import * as api from "api";
import { allTeams } from "../pwhl/team";
import {
ActionRowBuilder,
ButtonBuilder,
EmbedBuilder,
StringSelectMenuBuilder,
StringSelectMenuOptionBuilder,
} from "@discordjs/builders";
import { storeComponents } from "../util/components";
import * as api from "api";
import { ButtonStyle, ChannelType, MessageFlags } from "discord-api-types/v10";
import { transformLocalizations, uni } from "../util/l10n";
import { colors } from "../util/colors";
import { InteractionContext } from "../interactions";
import { and, eq } from "drizzle-orm";
import { ChatInputAppCommandCallback } from "../commands";
import {
ButtonCallback,
MinimumKVComponentState,
SelectMenuCallback,
} from "../components";
import { League, makeSnowflake, notifications } from "../db/schema";
import { getDb } from "../db";
import { and, eq } from "drizzle-orm";
import { League, makeSnowflake, notifications } from "../db/schema";
import { InteractionContext } from "../interactions";
import { allTeams } from "../pwhl/team";
import { colors } from "../util/colors";
import { storeComponents } from "../util/components";
import { transformLocalizations, uni } from "../util/l10n";

export interface NotificationSendConfig {
preview?: boolean;
Expand Down
28 changes: 14 additions & 14 deletions packages/bot/src/commands/player.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import { ChatInputAppCommandCallback } from "../commands";
import type { APILightPlayer } from "khl-api-types";
import * as api from "api";
import {
getHtLocale,
getKhlLocale,
transformLocalizations,
} from "../util/l10n";
import { APIInteraction, MessageFlags } from "discord-api-types/v10";
import {
ActionRowBuilder,
EmbedBuilder,
SelectMenuBuilder,
StringSelectMenuBuilder,
StringSelectMenuOptionBuilder,
} from "@discordjs/builders";
import { InteractionContext } from "../interactions";
import { countryCodeEmoji, khlTeamEmoji, pwhlTeamEmoji } from "../util/emojis";
import * as api from "api";
import { APIInteraction, MessageFlags } from "discord-api-types/v10";
import { RosterPlayer } from "hockeytech";
import type { APILightPlayer } from "khl-api-types";
import { getBorderCharacters, table } from "table";
import { ChatInputAppCommandCallback } from "../commands";
import { SelectMenuCallback } from "../components";
import { storeComponents } from "../util/components";
import { InteractionContext } from "../interactions";
import { getPwhlClient } from "../pwhl/client";
import { allSeasons, allTeams, pwhlTeamLogoUrl } from "../pwhl/team";
import { RosterPlayer } from "hockeytech";
import { colors } from "../util/colors";
import { getBorderCharacters, table } from "table";
import { storeComponents } from "../util/components";
import { countryCodeEmoji, khlTeamEmoji, pwhlTeamEmoji } from "../util/emojis";
import {
getHtLocale,
getKhlLocale,
transformLocalizations,
} from "../util/l10n";

type KhlPartialPlayer = Pick<APILightPlayer, "id" | "name" | "shirt_number"> & {
team: { name: string } | null;
Expand Down
2 changes: 1 addition & 1 deletion packages/bot/src/commands/teamAutocomplete.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AppCommandAutocompleteCallback } from "../commands";
import * as api from "api";
import { AppCommandAutocompleteCallback } from "../commands";
import { getKhlLocale } from "../util/l10n";

export const teamAutocomplete: AppCommandAutocompleteCallback = async (ctx) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/bot/src/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import {
APIMessageComponentSelectMenuInteraction,
APIModalSubmitInteraction,
} from "discord-api-types/v10";
import { InteractionContext } from "./interactions";
import { playerSearchSelectCallback } from "./commands/player";
import { addScheduleEventsCallback } from "./commands/calendar";
import {
selectNotificationFeaturesCallback,
selectNotificationTeamCallback,
toggleNotificationActiveButtonCallback,
} from "./commands/notifications";
import { playerSearchSelectCallback } from "./commands/player";
import { InteractionContext } from "./interactions";

export interface MinimumKVComponentState {
/** The total number of seconds that the component/modal should be stored. */
Expand Down
Loading

0 comments on commit fbcd32a

Please sign in to comment.