Skip to content

Commit

Permalink
chore: biome format & fix
Browse files Browse the repository at this point in the history
  • Loading branch information
shayypy committed Dec 8, 2024
1 parent 3046a27 commit e6ce62d
Show file tree
Hide file tree
Showing 19 changed files with 67 additions and 102 deletions.
12 changes: 3 additions & 9 deletions packages/bot/migrations/meta/0011_snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,7 @@
"indexes": {
"notifications_league_channelId_unique": {
"name": "notifications_league_channelId_unique",
"columns": [
"league",
"channelId"
],
"columns": ["league", "channelId"],
"isUnique": true
}
},
Expand Down Expand Up @@ -151,10 +148,7 @@
"indexes": {
"players_league_nativeId_unique": {
"name": "players_league_nativeId_unique",
"columns": [
"league",
"nativeId"
],
"columns": ["league", "nativeId"],
"isUnique": true
}
},
Expand All @@ -169,4 +163,4 @@
"tables": {},
"columns": {}
}
}
}
24 changes: 5 additions & 19 deletions packages/bot/migrations/meta/0012_snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,7 @@
"indexes": {
"notifications_league_channelId_unique": {
"name": "notifications_league_channelId_unique",
"columns": [
"league",
"channelId"
],
"columns": ["league", "channelId"],
"isUnique": true
}
},
Expand Down Expand Up @@ -125,10 +122,7 @@
"indexes": {
"pickems_league_guildId_unique": {
"name": "pickems_league_guildId_unique",
"columns": [
"league",
"guildId"
],
"columns": ["league", "guildId"],
"isUnique": true
}
},
Expand Down Expand Up @@ -243,12 +237,7 @@
"indexes": {
"pickems_votes_guildId_userId_league_gameId_unique": {
"name": "pickems_votes_guildId_userId_league_gameId_unique",
"columns": [
"guildId",
"userId",
"league",
"gameId"
],
"columns": ["guildId", "userId", "league", "gameId"],
"isUnique": true
}
},
Expand Down Expand Up @@ -333,10 +322,7 @@
"indexes": {
"players_league_nativeId_unique": {
"name": "players_league_nativeId_unique",
"columns": [
"league",
"nativeId"
],
"columns": ["league", "nativeId"],
"isUnique": true
}
},
Expand All @@ -351,4 +337,4 @@
"tables": {},
"columns": {}
}
}
}
25 changes: 5 additions & 20 deletions packages/bot/migrations/meta/0013_snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,7 @@
"indexes": {
"notifications_league_channelId_unique": {
"name": "notifications_league_channelId_unique",
"columns": [
"league",
"channelId"
],
"columns": ["league", "channelId"],
"isUnique": true
}
},
Expand Down Expand Up @@ -125,10 +122,7 @@
"indexes": {
"pickems_league_guildId_unique": {
"name": "pickems_league_guildId_unique",
"columns": [
"league",
"guildId"
],
"columns": ["league", "guildId"],
"isUnique": true
}
},
Expand Down Expand Up @@ -257,13 +251,7 @@
"indexes": {
"pickems_votes_guildId_userId_league_seasonId_gameId_unique": {
"name": "pickems_votes_guildId_userId_league_seasonId_gameId_unique",
"columns": [
"guildId",
"userId",
"league",
"seasonId",
"gameId"
],
"columns": ["guildId", "userId", "league", "seasonId", "gameId"],
"isUnique": true
}
},
Expand Down Expand Up @@ -348,10 +336,7 @@
"indexes": {
"players_league_nativeId_unique": {
"name": "players_league_nativeId_unique",
"columns": [
"league",
"nativeId"
],
"columns": ["league", "nativeId"],
"isUnique": true
}
},
Expand All @@ -366,4 +351,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 @@ -101,4 +101,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 @@ -15,19 +15,19 @@ import {
scheduleMonthCallback,
} from "./commands/calendar";
import { notificationsCallback } from "./commands/notifications";
import { playerCallback, whoisCallback } from "./commands/player";
import { standingsCallback } from "./commands/standings";
import { teamAutocomplete } from "./commands/teamAutocomplete";
import { threadCloseCallback } from "./commands/thread";
import { InteractionContext } from "./interactions";
import { pickemsConfigCallback } from "./commands/pickemsConfig";
import {
pickemsLeaderboardCallback,
pickemsMeCallback,
pickemsPurgeCallback,
seasonAutocompleteWithAll,
} from "./commands/pickemsLeaderboard";
import { playerCallback, whoisCallback } from "./commands/player";
import { seasonAutocomplete } from "./commands/seasonAutocomplete";
import { standingsCallback } from "./commands/standings";
import { teamAutocomplete } from "./commands/teamAutocomplete";
import { threadCloseCallback } from "./commands/thread";
import { InteractionContext } from "./interactions";

export type AppCommandCallbackT<T extends APIInteraction> = (
ctx: InteractionContext<T>,
Expand Down
4 changes: 2 additions & 2 deletions packages/bot/src/commands/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ import { ChatInputAppCommandCallback } from "../commands";
import { ButtonCallback, MinimumKVComponentState } from "../components";
import { League } from "../db/schema";
import { HockeyTechLeague, getHtClient, hockeyTechLeagues } from "../ht/client";
import { leagueTeams } from "../ht/teams";
import { InteractionContext } from "../interactions";
import { colors } from "../util/colors";
import { storeComponents } from "../util/components";
import { getLeagueLogoUrl, getTeamEmoji } from "../util/emojis";
import { transformLocalizations, uni } from "../util/l10n";
import { getOffset, sleep } from "../util/time";
import { leagueTeams } from "../ht/teams";
import { InteractionContext } from "../interactions";
import { getNow } from "../util/time";

export const DATE_REGEX = /^(\d{4})-(\d{1,2})-(\d{1,2})$/;
Expand Down
2 changes: 1 addition & 1 deletion packages/bot/src/commands/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import {
} from "../components";
import { getDb } from "../db";
import { League, makeSnowflake, notifications } from "../db/schema";
import { leagueTeams } from "../ht/teams";
import { InteractionContext } from "../interactions";
import { colors } from "../util/colors";
import { storeComponents } from "../util/components";
import { getLeagueLogoUrl, getTeamPartialEmoji } from "../util/emojis";
import { transformLocalizations, uni } from "../util/l10n";
import { leagueTeams } from "../ht/teams";

export interface NotificationSendConfig {
preview?: boolean;
Expand Down
6 changes: 3 additions & 3 deletions packages/bot/src/commands/pickemsConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
MessageFlags,
SelectMenuDefaultValueType,
} from "discord-api-types/v10";
import { Snowflake } from "discord-snowflake";
import { and, eq } from "drizzle-orm";
import { ChatInputAppCommandCallback } from "../commands";
import {
Expand All @@ -20,15 +21,14 @@ import {
} from "../components";
import { getDb } from "../db";
import { League, makeSnowflake, pickems } from "../db/schema";
import { leagueTeams } from "../ht/teams";
import { InteractionContext } from "../interactions";
import { colors } from "../util/colors";
import { storeComponents } from "../util/components";
import { getLeagueLogoUrl, getTeamPartialEmoji } from "../util/emojis";
import { transformLocalizations, uni } from "../util/l10n";
import { leagueTeams } from "../ht/teams";
import { emojiBool } from "./notifications";
import { Snowflake } from "discord-snowflake";
import { isPremium } from "../util/premium";
import { emojiBool } from "./notifications";

const s = transformLocalizations({
en: {
Expand Down
18 changes: 9 additions & 9 deletions packages/bot/src/commands/pickemsLeaderboard.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
import {
ActionRowBuilder,
ButtonBuilder,
EmbedBuilder,
} from "@discordjs/builders";
import {
APIApplicationCommandOptionChoice,
ButtonStyle,
Expand All @@ -8,19 +13,14 @@ import {
AppCommandAutocompleteCallback,
ChatInputAppCommandCallback,
} from "../commands";
import { ButtonCallback, componentStore } from "../components";
import { getDb } from "../db";
import { makeSnowflake, pickemsVotes } from "../db/schema";
import { uni } from "../util/l10n";
import { getHtClient, HockeyTechLeague } from "../ht/client";
import {
ActionRowBuilder,
ButtonBuilder,
EmbedBuilder,
} from "@discordjs/builders";
import { HockeyTechLeague, getHtClient } from "../ht/client";
import { colors } from "../util/colors";
import { getLeagueLogoUrl } from "../util/emojis";
import { ButtonCallback, componentStore } from "../components";
import { storeComponents } from "../util/components";
import { getLeagueLogoUrl } from "../util/emojis";
import { uni } from "../util/l10n";

// const s = transformLocalizations({
// en: {
Expand Down
2 changes: 1 addition & 1 deletion packages/bot/src/commands/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ import { League } from "../db/schema";
import { getEpHtPlayer } from "../ep/rest";
import { HockeyTechLeague, getHtClient, isKhl } from "../ht/client";
import { getHtTeamLogoUrl } from "../ht/team";
import { leagueTeams } from "../ht/teams";
import { InteractionContext } from "../interactions";
import { getTeamColor } from "../util/colors";
import { storeComponents } from "../util/components";
import { getTeamEmoji } from "../util/emojis";
import { getExternalUtils } from "../util/external";
import { getHtLocale, transformLocalizations } from "../util/l10n";
import { leagueTeams } from "../ht/teams";
import { getNow } from "../util/time";

const s = transformLocalizations({
Expand Down
2 changes: 1 addition & 1 deletion packages/bot/src/commands/seasonAutocomplete.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { APIApplicationCommandOptionChoice } from "discord-api-types/v10";
import { AppCommandAutocompleteCallback } from "../commands";
import { HockeyTechLeague, getHtClient } from "../ht/client";
import { leagues } from "../db/schema";
import { HockeyTechLeague, getHtClient } from "../ht/client";

export const seasonAutocomplete: AppCommandAutocompleteCallback = async (
ctx,
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,7 +1,7 @@
import { AppCommandAutocompleteCallback } from "../commands";
import { League } from "../db/schema";
import { leagueTeams } from "../ht/teams";
import { isKhl } from "../ht/client";
import { leagueTeams } from "../ht/teams";

export const teamAutocomplete: AppCommandAutocompleteCallback = async (ctx) => {
const league = ctx.getStringOption("league").value as League;
Expand Down
10 changes: 5 additions & 5 deletions packages/bot/src/commands/thread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import {
Routes,
} from "discord-api-types/v10";
import { ChatInputAppCommandCallback } from "../commands";
import {
getHtGamePreviewFinalEmbed,
getHtGoalsEmbed,
getHtStatusEmbed,
} from "../notifications";
import {
GLOBAL_GAME_ID_REGEX,
HockeyTechLeague,
getHtClient,
} from "../ht/client";
import {
getHtGamePreviewFinalEmbed,
getHtGoalsEmbed,
getHtStatusEmbed,
} from "../notifications";
import { getHtLocale } from "../util/l10n";

export const threadCloseCallback: ChatInputAppCommandCallback = 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 @@ -11,8 +11,6 @@ import {
selectNotificationTeamCallback,
toggleNotificationActiveButtonCallback,
} from "./commands/notifications";
import { playerSearchSelectCallback } from "./commands/player";
import { InteractionContext } from "./interactions";
import {
selectPickemsChannelCallback,
selectPickemsTeamCallback,
Expand All @@ -22,6 +20,8 @@ import {
pickemsPurgeCancelCallback,
pickemsPurgeConfirmCallback,
} from "./commands/pickemsLeaderboard";
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
8 changes: 4 additions & 4 deletions packages/bot/src/cron.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RequestMethod, REST, RouteLike } from "@discordjs/rest";
import { REST, RequestMethod, RouteLike } from "@discordjs/rest";
import {
APIEntitlement,
APIMessage,
Expand All @@ -12,6 +12,7 @@ import {
Routes,
ThreadAutoArchiveDuration,
} from "discord-api-types/v10";
import type { Snowflake } from "discord-snowflake";
import { and, eq, inArray, sql } from "drizzle-orm";
import { GamesByDate } from "hockeytech";
import { DBWithSchema, getDb } from "./db";
Expand All @@ -22,12 +23,11 @@ import {
pickemsPolls,
pickemsVotes,
} from "./db/schema";
import { getHtClient, HockeyTechLeague } from "./ht/client";
import { HockeyTechLeague, getHtClient } from "./ht/client";
import { getTeamPartialEmoji } from "./util/emojis";
import { isDiscordError } from "./util/errors";
import { getNow } from "./util/time";
import type { Snowflake } from "discord-snowflake";
import { uni } from "./util/l10n";
import { getNow } from "./util/time";

export type NotificationEntry = Pick<
typeof notifications.$inferSelect,
Expand Down
4 changes: 2 additions & 2 deletions packages/bot/src/ht/teams/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { HockeyTechLeague } from "../client";
import { HockeyTechTeam } from "../team";

import pwhlTeams from "./pwhl";
import ahlTeams from "./ahl";
import khlTeams from "./khl";
import zhhlTeams from "./zhhl";
import mhlTeams from "./mhl";
import pwhlTeams from "./pwhl";
import zhhlTeams from "./zhhl";

export const leagueTeams: Record<HockeyTechLeague, HockeyTechTeam[]> = {
pwhl: pwhlTeams,
Expand Down
Loading

0 comments on commit e6ce62d

Please sign in to comment.