From 9425b41848b1990dce0f4bc377d5a125eed95d44 Mon Sep 17 00:00:00 2001 From: KinjiKawaguchi Date: Tue, 1 Oct 2024 09:14:49 +0900 Subject: [PATCH 01/12] style: biome --- eslint.config.mjs | 6 +- package.json | 86 ++++++------ src/commands/auth.ts | 180 ++++++++++++++---------- src/commands/health_check.ts | 14 +- src/commands/hotChannel.ts | 26 ++-- src/commands/register.ts | 99 ++++++++----- src/commands/rename_all.ts | 64 +++++---- src/commands/who.ts | 59 ++++---- src/controllers/MemberController.ts | 77 +++++----- src/controllers/authController.ts | 52 +++---- src/deployCommands.ts | 97 +++++++------ src/entities/department.ts | 12 +- src/entities/member.ts | 14 +- src/events/clientReady.ts | 34 ++--- src/events/eventHandler.ts | 17 ++- src/events/guildMemberAdd.ts | 49 ++++--- src/events/interactionCreate.ts | 41 +++--- src/events/messageCreate.ts | 211 +++++++++++++++------------- src/infra/firebase.ts | 22 +-- src/loadCommands.ts | 30 ++-- src/main.ts | 20 +-- src/roles/administrator.ts | 8 +- src/roles/authorized.ts | 8 +- src/roles/departments/bi.ts | 8 +- src/roles/departments/cs.ts | 8 +- src/roles/departments/graduate.ts | 8 +- src/roles/departments/ia.ts | 8 +- src/roles/departments/obog.ts | 6 +- src/roles/departments/others.ts | 8 +- src/roles/unAuthorized.ts | 8 +- src/tasks/scheduleHotChannels.ts | 63 +++++---- src/types/authData.ts | 12 +- src/types/command.ts | 6 +- src/types/commandWithArgs.ts | 11 +- src/types/customClient.ts | 28 ++-- src/types/customRole.ts | 8 +- src/usecases/getHotChannels.ts | 130 +++++++++-------- src/usecases/getMembers.ts | 34 ++--- src/usecases/insertMember.ts | 20 +-- src/usecases/sendAuthMail.ts | 38 +++-- src/usecases/setDiscordId.ts | 8 +- src/utils/addRoleToMember.ts | 22 +-- src/utils/authMember.ts | 26 ++-- src/utils/checkMemberRole.ts | 10 +- src/utils/clearAuthData.ts | 16 +-- src/utils/createRoleNotFound.ts | 47 ++++--- src/utils/initializeRoles.ts | 53 +++---- src/utils/makeDepartmentRole.ts | 28 ++-- tsconfig.json | 200 +++++++++++++------------- 49 files changed, 1128 insertions(+), 912 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index b50ce98..1f40688 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -3,7 +3,7 @@ import pluginJs from "@eslint/js"; import tseslint from "typescript-eslint"; export default [ - { languageOptions: { globals: globals.browser } }, - pluginJs.configs.recommended, - ...tseslint.configs.recommended, + { languageOptions: { globals: globals.browser } }, + pluginJs.configs.recommended, + ...tseslint.configs.recommended, ]; diff --git a/package.json b/package.json index 5aa0c82..7ebaded 100644 --- a/package.json +++ b/package.json @@ -1,45 +1,45 @@ { - "name": "its-discord-auth", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "start": "nodemon --exec ts-node src/main.ts", - "test": "ts-node src/main.ts", - "deploy-commands": "ts-node src/deployCommands.ts", - "format": "prettier --write .", - "lint": "eslint --ignore-pattern .gitignore './**/*.{js,ts}'", - "lint:fix": "eslint --ignore-pattern .gitignore './**/*.{js,ts}' --fix" - }, - "keywords": [], - "author": "", - "license": "ISC", - "devDependencies": { - "@eslint/js": "^9.9.1", - "@types/uuid": "^10.0.0", - "@typescript-eslint/eslint-plugin": "^7.18.0", - "@typescript-eslint/parser": "^7.18.0", - "eslint": "^9.9.1", - "eslint-config-prettier": "^9.1.0", - "eslint-plugin-import": "^2.29.1", - "eslint-plugin-prettier": "^5.2.1", - "eslint-plugin-sort-keys-fix": "^1.1.2", - "eslint-plugin-typescript-sort-keys": "^3.2.0", - "eslint-plugin-unused-imports": "^4.1.3", - "globals": "^15.9.0", - "nodemon": "^3.1.4", - "prettier": "^3.3.3", - "ts-node": "^10.9.2", - "typescript": "^5.5.4", - "typescript-eslint": "^7.18.0" - }, - "dependencies": { - "cron": "^3.1.7", - "discord.js": "^14.15.3", - "dotenv": "^16.4.5", - "firebase": "^10.13.1", - "firebase-admin": "^12.4.0", - "uuid": "^10.0.0" - }, - "packageManager": "yarn@4.2.2" + "name": "its-discord-auth", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "start": "nodemon --exec ts-node src/main.ts", + "test": "ts-node src/main.ts", + "deploy-commands": "ts-node src/deployCommands.ts", + "format": "prettier --write .", + "lint": "eslint --ignore-pattern .gitignore './**/*.{js,ts}'", + "lint:fix": "eslint --ignore-pattern .gitignore './**/*.{js,ts}' --fix" + }, + "keywords": [], + "author": "", + "license": "ISC", + "devDependencies": { + "@eslint/js": "^9.9.1", + "@types/uuid": "^10.0.0", + "@typescript-eslint/eslint-plugin": "^7.18.0", + "@typescript-eslint/parser": "^7.18.0", + "eslint": "^9.9.1", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-import": "^2.29.1", + "eslint-plugin-prettier": "^5.2.1", + "eslint-plugin-sort-keys-fix": "^1.1.2", + "eslint-plugin-typescript-sort-keys": "^3.2.0", + "eslint-plugin-unused-imports": "^4.1.3", + "globals": "^15.9.0", + "nodemon": "^3.1.4", + "prettier": "^3.3.3", + "ts-node": "^10.9.2", + "typescript": "^5.5.4", + "typescript-eslint": "^7.18.0" + }, + "dependencies": { + "cron": "^3.1.7", + "discord.js": "^14.15.3", + "dotenv": "^16.4.5", + "firebase": "^10.13.1", + "firebase-admin": "^12.4.0", + "uuid": "^10.0.0" + }, + "packageManager": "yarn@4.2.2" } diff --git a/src/commands/auth.ts b/src/commands/auth.ts index 4a36a21..d96af03 100644 --- a/src/commands/auth.ts +++ b/src/commands/auth.ts @@ -1,8 +1,17 @@ -import { SlashCommandBuilder, CommandInteraction, Guild, Role, GuildMember } from "discord.js"; -import { Command } from "../types/command"; +import { + SlashCommandBuilder, + type CommandInteraction, + type Guild, + type Role, + type GuildMember, +} from "discord.js"; +import type { Command } from "../types/command"; import { adminAuth } from "../infra/firebase"; -import { getMemberByDiscordId, getMemberByEmail } from "../controllers/MemberController"; -import { UserRecord } from "firebase-admin/lib/auth/user-record"; +import { + getMemberByDiscordId, + getMemberByEmail, +} from "../controllers/MemberController"; +import type { UserRecord } from "firebase-admin/lib/auth/user-record"; import createRoleIfNotFound from "../utils/createRoleNotFound"; import addRoleToMember from "../utils/addRoleToMember"; import Department from "../entities/department"; @@ -15,99 +24,120 @@ import csRole from "../roles/departments/cs"; import iaRole from "../roles/departments/ia"; import authorizedRoleProperty from "../roles/authorized"; import unAuthorizedRoleProperty from "../roles/unAuthorized"; -import Member from "../entities/member"; +import type Member from "../entities/member"; const authCommand: Command = { - data: new SlashCommandBuilder().setName("auth").setDescription("認証コマンド"), - execute: authCommandHandler, + data: new SlashCommandBuilder() + .setName("auth") + .setDescription("認証コマンド"), + execute: authCommandHandler, }; async function authCommandHandler(interaction: CommandInteraction) { - //DMでは実行できないようにする - if (!interaction.guild) return await interaction.reply("このコマンドはサーバーでのみ実行可能です"); + //DMでは実行できないようにする + if (!interaction.guild) + return await interaction.reply("このコマンドはサーバーでのみ実行可能です"); - // Firestoreからメンバー情報を取得 - const member = await getMemberByDiscordId(interaction.user.id); - if (!member) { - await interaction.reply("メンバー情報が見つかりませんでした"); - return; - } + // Firestoreからメンバー情報を取得 + const member = await getMemberByDiscordId(interaction.user.id); + if (!member) { + await interaction.reply("メンバー情報が見つかりませんでした"); + return; + } - // メール認証が完了しているか確認 - const user: UserRecord = await adminAuth.getUserByEmail(member.mail); - if (user.emailVerified) { - try { - await changeNickName(interaction, member); - await giveRoles(interaction); - } catch (error) { - console.error("Failed to auth", error); - await interaction.reply("認証に失敗しました"); - } - } else { - await interaction.reply("メール認証が完了していません"); - } + // メール認証が完了しているか確認 + const user: UserRecord = await adminAuth.getUserByEmail(member.mail); + if (user.emailVerified) { + try { + await changeNickName(interaction, member); + await giveRoles(interaction); + } catch (error) { + console.error("Failed to auth", error); + await interaction.reply("認証に失敗しました"); + } + } else { + await interaction.reply("メール認証が完了していません"); + } } async function changeNickName(interaction: CommandInteraction, member: Member) { - const guild: Guild = interaction.guild!; - const guildMember: GuildMember = await guild.members.fetch(interaction.user.id); - const realName: string = member.name; - await guildMember.setNickname(realName); + const guild: Guild = interaction.guild!; + const guildMember: GuildMember = await guild.members.fetch( + interaction.user.id, + ); + const realName: string = member.name; + await guildMember.setNickname(realName); } async function giveRoles(interaction: CommandInteraction) { - const user = await adminAuth.getUserByEmail(interaction.user.tag); - const guild: Guild = interaction.guild!; - const guildMember: GuildMember = await guild.members.fetch(interaction.user.id); + const user = await adminAuth.getUserByEmail(interaction.user.tag); + const guild: Guild = interaction.guild!; + const guildMember: GuildMember = await guild.members.fetch( + interaction.user.id, + ); - await giveAuthorizedRole(interaction, guild, guildMember); - await giveDepartmentRole(interaction, user, guildMember); + await giveAuthorizedRole(interaction, guild, guildMember); + await giveDepartmentRole(interaction, user, guildMember); } -async function giveAuthorizedRole(interaction: CommandInteraction, guild: Guild, guildMember: GuildMember) { - try { - const authorizedRole: Role = await createRoleIfNotFound({ guild, customRole: authorizedRoleProperty }); - const unAuthorizedRole: Role = await createRoleIfNotFound({ guild, customRole: unAuthorizedRoleProperty }); +async function giveAuthorizedRole( + interaction: CommandInteraction, + guild: Guild, + guildMember: GuildMember, +) { + try { + const authorizedRole: Role = await createRoleIfNotFound({ + guild, + customRole: authorizedRoleProperty, + }); + const unAuthorizedRole: Role = await createRoleIfNotFound({ + guild, + customRole: unAuthorizedRoleProperty, + }); - await guildMember.roles.add(authorizedRole); - await guildMember.roles.remove(unAuthorizedRole); + await guildMember.roles.add(authorizedRole); + await guildMember.roles.remove(unAuthorizedRole); - await interaction.reply("認証しました!"); - } catch (error) { - console.error("Failed to give Authorized Role"); - } + await interaction.reply("認証しました!"); + } catch (error) { + console.error("Failed to give Authorized Role"); + } } -async function giveDepartmentRole(interaction: CommandInteraction, userAccount: UserRecord, guildMember: GuildMember) { - const guild: Guild = interaction.guild!; +async function giveDepartmentRole( + interaction: CommandInteraction, + userAccount: UserRecord, + guildMember: GuildMember, +) { + const guild: Guild = interaction.guild!; - //認証用のアカウントから、メンバー情報を取得 - const member: Member | undefined = await getMemberByEmail(userAccount.email!); - if (!member) { - throw new Error("Member not found"); - return; - } + //認証用のアカウントから、メンバー情報を取得 + const member: Member | undefined = await getMemberByEmail(userAccount.email!); + if (!member) { + throw new Error("Member not found"); + return; + } - //TODO: 要リファクタリング - switch (member.department) { - case Department.CS: - await addRoleToMember(guild, guildMember, csRole); - break; - case Department.IA: - await addRoleToMember(guild, guildMember, iaRole); - break; - case Department.BI: - await addRoleToMember(guild, guildMember, biRole); - break; - case Department.GRADUATE: - await addRoleToMember(guild, guildMember, graduateRole); - break; - case Department.OTHERS: - await addRoleToMember(guild, guildMember, othersRole); - break; - default: - throw new Error("Department not found"); - } + //TODO: 要リファクタリング + switch (member.department) { + case Department.CS: + await addRoleToMember(guild, guildMember, csRole); + break; + case Department.IA: + await addRoleToMember(guild, guildMember, iaRole); + break; + case Department.BI: + await addRoleToMember(guild, guildMember, biRole); + break; + case Department.GRADUATE: + await addRoleToMember(guild, guildMember, graduateRole); + break; + case Department.OTHERS: + await addRoleToMember(guild, guildMember, othersRole); + break; + default: + throw new Error("Department not found"); + } } export default authCommand; diff --git a/src/commands/health_check.ts b/src/commands/health_check.ts index f50d786..b5d3747 100644 --- a/src/commands/health_check.ts +++ b/src/commands/health_check.ts @@ -1,11 +1,13 @@ -import { SlashCommandBuilder, CommandInteraction } from "discord.js"; -import { Command } from "../types/command"; +import { SlashCommandBuilder, type CommandInteraction } from "discord.js"; +import type { Command } from "../types/command"; const healthCheckCommand: Command = { - data: new SlashCommandBuilder().setName("health_check").setDescription("ヘルスチェックコマンド"), - async execute(interaction: CommandInteraction) { - await interaction.reply("I am healthy!"); - }, + data: new SlashCommandBuilder() + .setName("health_check") + .setDescription("ヘルスチェックコマンド"), + async execute(interaction: CommandInteraction) { + await interaction.reply("I am healthy!"); + }, }; export default healthCheckCommand; diff --git a/src/commands/hotChannel.ts b/src/commands/hotChannel.ts index 59768d0..432f33b 100644 --- a/src/commands/hotChannel.ts +++ b/src/commands/hotChannel.ts @@ -1,17 +1,23 @@ -import { SlashCommandBuilder, CommandInteraction } from "discord.js"; -import { Command } from "../types/command"; +import { SlashCommandBuilder, type CommandInteraction } from "discord.js"; +import type { Command } from "../types/command"; import { generateChannelActivityRanking } from "../usecases/getHotChannels"; import checkIsAdmin from "../utils/checkMemberRole"; const hotChannelsCommand: Command = { - data: new SlashCommandBuilder().setName("hot_channels").setDescription("Show hot channels ranking"), - async execute(interaction: CommandInteraction) { - if (!interaction.guild) return await interaction.reply("このコマンドはサーバーでのみ実行可能です"); - const isAdmin: boolean = await checkIsAdmin(interaction); - if (!isAdmin) return await interaction.reply("このコマンドは管理者のみ使用可能です"); - const ranking = await generateChannelActivityRanking(interaction.guild!); - await interaction.reply({ embeds: [ranking] }); - }, + data: new SlashCommandBuilder() + .setName("hot_channels") + .setDescription("Show hot channels ranking"), + async execute(interaction: CommandInteraction) { + if (!interaction.guild) + return await interaction.reply( + "このコマンドはサーバーでのみ実行可能です", + ); + const isAdmin: boolean = await checkIsAdmin(interaction); + if (!isAdmin) + return await interaction.reply("このコマンドは管理者のみ使用可能です"); + const ranking = await generateChannelActivityRanking(interaction.guild!); + await interaction.reply({ embeds: [ranking] }); + }, }; export default hotChannelsCommand; diff --git a/src/commands/register.ts b/src/commands/register.ts index 3cef34e..2bed693 100644 --- a/src/commands/register.ts +++ b/src/commands/register.ts @@ -1,64 +1,87 @@ -import { CommandInteraction, SlashCommandBuilder } from "discord.js"; -import CommandWithArgs from "../types/commandWithArgs"; -import Member from "../entities/member"; +import { type CommandInteraction, SlashCommandBuilder } from "discord.js"; +import type CommandWithArgs from "../types/commandWithArgs"; +import type Member from "../entities/member"; import { addMember } from "../controllers/MemberController"; import Department from "../entities/department"; import checkIsAdmin from "../utils/checkMemberRole"; const registerCommand: CommandWithArgs = { - data: new SlashCommandBuilder() - .setName("register") - .setDescription("認証コマンド") - .addStringOption((option) => option.setName("mail").setDescription("メールアドレス").setRequired(true)) - .addStringOption((option) => option.setName("name").setDescription("名前").setRequired(true)) - .addStringOption((option) => option.setName("department").setDescription("学部").setRequired(true)) - .addStringOption((option) => - option.setName("student_number").setDescription("学籍番号").setRequired(true) - ) as SlashCommandBuilder, - execute: addMemberCommandHandler, + data: new SlashCommandBuilder() + .setName("register") + .setDescription("認証コマンド") + .addStringOption((option) => + option.setName("mail").setDescription("メールアドレス").setRequired(true), + ) + .addStringOption((option) => + option.setName("name").setDescription("名前").setRequired(true), + ) + .addStringOption((option) => + option.setName("department").setDescription("学部").setRequired(true), + ) + .addStringOption((option) => + option + .setName("student_number") + .setDescription("学籍番号") + .setRequired(true), + ) as SlashCommandBuilder, + execute: addMemberCommandHandler, }; async function addMemberCommandHandler(interaction: CommandInteraction) { - //DMでは使用不可 - if (!interaction.guild) return await interaction.reply("このコマンドはサーバー内でのみ使用可能です。"); + //DMでは使用不可 + if (!interaction.guild) + return await interaction.reply( + "このコマンドはサーバー内でのみ使用可能です。", + ); - //adminロールを持っているか確認 - const isAdmin: boolean = await checkIsAdmin(interaction); - if (!isAdmin) return await interaction.reply("このコマンドは管理者のみ使用可能です。"); + //adminロールを持っているか確認 + const isAdmin: boolean = await checkIsAdmin(interaction); + if (!isAdmin) + return await interaction.reply("このコマンドは管理者のみ使用可能です。"); - //引数が正しいか確認 - const isArgsValid: boolean = validateArgs( - interaction.options.get("mail")?.value as string, - interaction.options.get("department")?.value as string, - interaction.options.get("student_number")?.value as string - ); - if (!isArgsValid) return await interaction.reply("引数が不正です。"); + //引数が正しいか確認 + const isArgsValid: boolean = validateArgs( + interaction.options.get("mail")?.value as string, + interaction.options.get("department")?.value as string, + interaction.options.get("student_number")?.value as string, + ); + if (!isArgsValid) return await interaction.reply("引数が不正です。"); - await addMember({ - mail: interaction.options.get("mail")?.value as string, - name: interaction.options.get("name")?.value as string, - department: interaction.options.get("department")?.value as string, - student_number: interaction.options.get("student_number")?.value as string, - } as Member); + await addMember({ + mail: interaction.options.get("mail")?.value as string, + name: interaction.options.get("name")?.value as string, + department: interaction.options.get("department")?.value as string, + student_number: interaction.options.get("student_number")?.value as string, + } as Member); - await interaction.reply(`${interaction.options.get("name")?.value}さんを登録しました`); + await interaction.reply( + `${interaction.options.get("name")?.value}さんを登録しました`, + ); } -function validateArgs(mail: string, department: string, studentNumber: string): boolean { - return validateEmail(mail) && validateStudentNumber(studentNumber) && validateDepartment(department); +function validateArgs( + mail: string, + department: string, + studentNumber: string, +): boolean { + return ( + validateEmail(mail) && + validateStudentNumber(studentNumber) && + validateDepartment(department) + ); } function validateEmail(email: string): boolean { - // mailが@shizuoka.ac.jpで終わっているか検証 - return email.endsWith("@shizuoka.ac.jp"); + // mailが@shizuoka.ac.jpで終わっているか検証 + return email.endsWith("@shizuoka.ac.jp"); } function validateStudentNumber(studentNumber: string): boolean { - return studentNumber.startsWith("7") || studentNumber.length === 8; + return studentNumber.startsWith("7") || studentNumber.length === 8; } function validateDepartment(department: string): boolean { - return Object.values(Department).includes(department as Department); + return Object.values(Department).includes(department as Department); } export default registerCommand; diff --git a/src/commands/rename_all.ts b/src/commands/rename_all.ts index 4d9a87b..4d8aee8 100644 --- a/src/commands/rename_all.ts +++ b/src/commands/rename_all.ts @@ -1,38 +1,46 @@ -import { CommandInteraction, SlashCommandBuilder } from "discord.js"; -import { Command } from "../types/command"; +import { type CommandInteraction, SlashCommandBuilder } from "discord.js"; +import type { Command } from "../types/command"; import checkIsAdmin from "../utils/checkMemberRole"; import { getMemberByDiscordId } from "../controllers/MemberController"; const renameALL: Command = { - data: new SlashCommandBuilder().setName("rename_all").setDescription("全員のニックネームを変更する"), - execute: renameALLHandler, + data: new SlashCommandBuilder() + .setName("rename_all") + .setDescription("全員のニックネームを変更する"), + execute: renameALLHandler, }; async function renameALLHandler(interaction: CommandInteraction) { - if (!interaction.guild) return await interaction.reply("このコマンドはサーバー内でのみ使用可能です。"); - - const isAdmin = await checkIsAdmin(interaction); - if (!isAdmin) return await interaction.reply("このコマンドは管理者のみ使用可能です。"); - - // 応答がタイムアウトしないように遅延させる - await interaction.deferReply(); - - const members = await interaction.guild.members.fetch(); - const renamePromises = members.map(async (member) => { - const memberOnFirebase = await getMemberByDiscordId(member.id); - if (!memberOnFirebase) return; - - try { - await member.setNickname(memberOnFirebase.name); - console.log(`[NOTE] Changed nickname of ${member.nickname}, ${memberOnFirebase.name}`); - } catch (error) { - console.error(`[ERROR] Failed to rename ${member.nickname}: ${error}`); - } - }); - - await Promise.all(renamePromises); - await interaction.followUp("ニックネームの変更が完了しました。"); - console.log(`[NOTE] Completed changing nicknames`); + if (!interaction.guild) + return await interaction.reply( + "このコマンドはサーバー内でのみ使用可能です。", + ); + + const isAdmin = await checkIsAdmin(interaction); + if (!isAdmin) + return await interaction.reply("このコマンドは管理者のみ使用可能です。"); + + // 応答がタイムアウトしないように遅延させる + await interaction.deferReply(); + + const members = await interaction.guild.members.fetch(); + const renamePromises = members.map(async (member) => { + const memberOnFirebase = await getMemberByDiscordId(member.id); + if (!memberOnFirebase) return; + + try { + await member.setNickname(memberOnFirebase.name); + console.log( + `[NOTE] Changed nickname of ${member.nickname}, ${memberOnFirebase.name}`, + ); + } catch (error) { + console.error(`[ERROR] Failed to rename ${member.nickname}: ${error}`); + } + }); + + await Promise.all(renamePromises); + await interaction.followUp("ニックネームの変更が完了しました。"); + console.log(`[NOTE] Completed changing nicknames`); } export default renameALL; diff --git a/src/commands/who.ts b/src/commands/who.ts index 57d4a3d..0149cab 100644 --- a/src/commands/who.ts +++ b/src/commands/who.ts @@ -1,38 +1,45 @@ -import { CommandInteraction, SlashCommandBuilder } from "discord.js"; +import { type CommandInteraction, SlashCommandBuilder } from "discord.js"; import { getMemberByDiscordId } from "../controllers/MemberController"; -import CommandWithArgs from "../types/commandWithArgs"; +import type CommandWithArgs from "../types/commandWithArgs"; const whoCommand: CommandWithArgs = { - data: new SlashCommandBuilder() - .setName("who") - .setDescription("ユーザー情報を表示します。") - .addUserOption((option) => - option.setName("user").setDescription("情報を表示するユーザー").setRequired(true) - ) as SlashCommandBuilder, - execute: whoCommandHandler, + data: new SlashCommandBuilder() + .setName("who") + .setDescription("ユーザー情報を表示します。") + .addUserOption((option) => + option + .setName("user") + .setDescription("情報を表示するユーザー") + .setRequired(true), + ) as SlashCommandBuilder, + execute: whoCommandHandler, }; async function whoCommandHandler(interaction: CommandInteraction) { - if (!interaction.guild) return await interaction.reply("このコマンドはサーバー内でのみ使用可能です。"); - - //ログを出力 - printLog(interaction) - - // メンションされたユーザーの情報を取得 - const user = interaction.options.get('user') - if (!user) return await interaction.reply("ユーザーを指定してください。"); - if (!user.user) return await interaction.reply('ユーザーが見つかりません。') - - const member = await getMemberByDiscordId(user.user.id!); - if (!member) return await interaction.reply("メンバー情報が見つかりませんでした。"); - - await interaction.reply( - `名前: ${member.name}\n学部: ${member.department}\n学籍番号: ${member.student_number}\nメールアドレス: ${member.mail}` - ); + if (!interaction.guild) + return await interaction.reply( + "このコマンドはサーバー内でのみ使用可能です。", + ); + + //ログを出力 + printLog(interaction); + + // メンションされたユーザーの情報を取得 + const user = interaction.options.get("user"); + if (!user) return await interaction.reply("ユーザーを指定してください。"); + if (!user.user) return await interaction.reply("ユーザーが見つかりません。"); + + const member = await getMemberByDiscordId(user.user.id!); + if (!member) + return await interaction.reply("メンバー情報が見つかりませんでした。"); + + await interaction.reply( + `名前: ${member.name}\n学部: ${member.department}\n学籍番号: ${member.student_number}\nメールアドレス: ${member.mail}`, + ); } function printLog(interaction: CommandInteraction) { - console.log(`[COMMAND] who command terminated by ${interaction.user}`) + console.log(`[COMMAND] who command terminated by ${interaction.user}`); } export default whoCommand; diff --git a/src/controllers/MemberController.ts b/src/controllers/MemberController.ts index c21e7a9..654c776 100644 --- a/src/controllers/MemberController.ts +++ b/src/controllers/MemberController.ts @@ -1,52 +1,59 @@ import insertMember from "../usecases/insertMember"; -import Member from "../entities/member"; +import type Member from "../entities/member"; import getMembers from "../usecases/getMembers"; import setDiscordId from "../usecases/setDiscordId"; export async function getAllMembers() { - try { - const members = await getMembers(); - return members; - } catch (error) { - console.error("Error getting members:", error); - } + try { + const members = await getMembers(); + return members; + } catch (error) { + console.error("Error getting members:", error); + } } // Emailでメンバーを取得する 見つからなければundefinedを返す -export async function getMemberByEmail(email: string): Promise { - try { - const members = await getMembers(); - const member = members.find((m) => m.mail === email); - return member ? member : undefined; - } catch (error) { - console.error("Error getting member by email:", error); - } +export async function getMemberByEmail( + email: string, +): Promise { + try { + const members = await getMembers(); + const member = members.find((m) => m.mail === email); + return member ? member : undefined; + } catch (error) { + console.error("Error getting member by email:", error); + } } -export async function getMemberByDiscordId(discordId: string): Promise { - try { - const members = await getMembers(); - const member = members.find((m) => m.discordId === discordId); - return member ? member : undefined; - } catch (error) { - console.error("Error getting member by discord id:", error); - } +export async function getMemberByDiscordId( + discordId: string, +): Promise { + try { + const members = await getMembers(); + const member = members.find((m) => m.discordId === discordId); + return member ? member : undefined; + } catch (error) { + console.error("Error getting member by discord id:", error); + } } // memberにdiscordIdを追加する -export async function addDiscordId(member: Member, discordId: string): Promise { - try { - await setDiscordId(member.id!, discordId); - } catch (error) { - console.error("Error adding discord id:", error); - } +export async function addDiscordId( + member: Member, + discordId: string, +): Promise { + try { + await setDiscordId(member.id!, discordId); + } catch (error) { + console.error("Error adding discord id:", error); + } } export async function addMember(memberData: Member): Promise { - try { - await insertMember(memberData); - console.log("Member successfully added"); - } catch (error) { - console.error("Error adding member:", error); - } + try { + await insertMember(memberData); + console.log("Member successfully added"); + } catch (error) { + console.error("Error adding member:", error); + } } diff --git a/src/controllers/authController.ts b/src/controllers/authController.ts index 520e7c0..33d8fd7 100644 --- a/src/controllers/authController.ts +++ b/src/controllers/authController.ts @@ -1,40 +1,44 @@ -import AuthData from "../types/authData"; +import type AuthData from "../types/authData"; import sendAuthMail from "../usecases/sendAuthMail"; import { getMemberByEmail } from "./MemberController"; import setDiscordId from "../usecases/setDiscordId"; -import Member from "../entities/member"; +import type Member from "../entities/member"; async function sendAuthMailController(userInfo: AuthData) { - try { - if (!checkAuthData(userInfo)) { - throw new Error("Invalid AuthData"); - } - await sendAuthMail(userInfo.mail!, userInfo.student_number!, userInfo.department!); + try { + if (!checkAuthData(userInfo)) { + throw new Error("Invalid AuthData"); + } + await sendAuthMail( + userInfo.mail!, + userInfo.student_number!, + userInfo.department!, + ); - const member = await getMemberByEmail(userInfo.mail!); - checkMember(member); + const member = await getMemberByEmail(userInfo.mail!); + checkMember(member); - await setDiscordId(member!.id!, userInfo.discordId!); - } catch (e) { - console.error(e); - } + await setDiscordId(member!.id!, userInfo.discordId!); + } catch (e) { + console.error(e); + } } function checkAuthData(userInfo: AuthData): boolean { - return ( - userInfo.mail !== undefined && - userInfo.student_number !== undefined && - userInfo.department !== undefined && - userInfo.discordId !== undefined - ); + return ( + userInfo.mail !== undefined && + userInfo.student_number !== undefined && + userInfo.department !== undefined && + userInfo.discordId !== undefined + ); } function checkMember(member: Member | undefined): void { - if (!member) { - throw new Error("Member not found"); - } else if (!member.id) { - throw new Error("Member id is not provided"); - } + if (!member) { + throw new Error("Member not found"); + } else if (!member.id) { + throw new Error("Member id is not provided"); + } } export default sendAuthMailController; diff --git a/src/deployCommands.ts b/src/deployCommands.ts index 26963ce..a254205 100644 --- a/src/deployCommands.ts +++ b/src/deployCommands.ts @@ -1,7 +1,7 @@ -import { SlashCommandBuilder, REST, Routes } from "discord.js"; +import { type SlashCommandBuilder, REST, Routes } from "discord.js"; import fs from "fs"; import path from "path"; -import { Command } from "./types/command"; +import type { Command } from "./types/command"; import dotenv from "dotenv"; const commandHandlers: Command[] = []; @@ -9,59 +9,70 @@ const commandHandlers: Command[] = []; // Discord APIに登録するためのコマンドデータの配列 const commandData: SlashCommandBuilder[] = []; - async function readCommands(directory: string): Promise { - const filesOrFolders = fs.readdirSync(directory); + const filesOrFolders = fs.readdirSync(directory); - for (const entry of filesOrFolders) { - const absolutePath = path.join(directory, entry); - if (fs.statSync(absolutePath).isDirectory()) { - await readCommands(absolutePath); - } else if (entry.endsWith(".ts")) { - const module = await import(absolutePath); - const command: Command = module.default; - if ("data" in command && "execute" in command) { - commandHandlers.push(command); - commandData.push(command.data); - console.log(`[INFO] Loaded command: ${command.data.name}`); - } else { - console.log(`[WARNING] The command at ${absolutePath} is missing a required "data" or "execute" property.`); - } - } - } + for (const entry of filesOrFolders) { + const absolutePath = path.join(directory, entry); + if (fs.statSync(absolutePath).isDirectory()) { + await readCommands(absolutePath); + } else if (entry.endsWith(".ts")) { + const module = await import(absolutePath); + const command: Command = module.default; + if ("data" in command && "execute" in command) { + commandHandlers.push(command); + commandData.push(command.data); + console.log(`[INFO] Loaded command: ${command.data.name}`); + } else { + console.log( + `[WARNING] The command at ${absolutePath} is missing a required "data" or "execute" property.`, + ); + } + } + } } function checkEnvVariables() { - dotenv.config(); - const token = process.env.TOKEN; - const clientId = process.env.APP_ID; - const guildId = process.env.GUILD_ID; + dotenv.config(); + const token = process.env.TOKEN; + const clientId = process.env.APP_ID; + const guildId = process.env.GUILD_ID; - if (!token || !clientId || !guildId) { - console.error("Missing environment variables."); - process.exit(1); - } - return { token, clientId, guildId }; + if (!token || !clientId || !guildId) { + console.error("Missing environment variables."); + process.exit(1); + } + return { token, clientId, guildId }; } // コマンドをデプロイする関数 -async function deployCommands(token: string, clientId: string, guildId: string) { - const rest = new REST({ version: "10" }).setToken(token); - try { - console.log(`Started refreshing ${commandData.length} application (/) commands.`); - await rest.put(Routes.applicationGuildCommands(clientId, guildId), { body: commandData }); - console.log(`Successfully reloaded ${commandData.length} application (/) commands.`); - } catch (error) { - console.error(error); - } +async function deployCommands( + token: string, + clientId: string, + guildId: string, +) { + const rest = new REST({ version: "10" }).setToken(token); + try { + console.log( + `Started refreshing ${commandData.length} application (/) commands.`, + ); + await rest.put(Routes.applicationGuildCommands(clientId, guildId), { + body: commandData, + }); + console.log( + `Successfully reloaded ${commandData.length} application (/) commands.`, + ); + } catch (error) { + console.error(error); + } } async function main() { - const commandsPath = path.join(__dirname, "commands"); - await readCommands(commandsPath); + const commandsPath = path.join(__dirname, "commands"); + await readCommands(commandsPath); - const { token, clientId, guildId } = checkEnvVariables(); - await deployCommands(token, clientId, guildId); + const { token, clientId, guildId } = checkEnvVariables(); + await deployCommands(token, clientId, guildId); } -main().catch(console.error); \ No newline at end of file +main().catch(console.error); diff --git a/src/entities/department.ts b/src/entities/department.ts index 6e0fc75..bf0ddee 100644 --- a/src/entities/department.ts +++ b/src/entities/department.ts @@ -1,10 +1,10 @@ enum Department { - CS = "CS", - BI = "BI", - IA = "IA", - GRADUATE = "GRADUATE", - OTHERS = "OTHERS", - OBOG = "OB/OG", + CS = "CS", + BI = "BI", + IA = "IA", + GRADUATE = "GRADUATE", + OTHERS = "OTHERS", + OBOG = "OB/OG", } export default Department; diff --git a/src/entities/member.ts b/src/entities/member.ts index 12606fa..85b306f 100644 --- a/src/entities/member.ts +++ b/src/entities/member.ts @@ -1,12 +1,12 @@ -import department from "./department"; +import type department from "./department"; interface Member { - id?: string; - name: string; - student_number: string; - department: department; - mail: string; - discordId?: string; + id?: string; + name: string; + student_number: string; + department: department; + mail: string; + discordId?: string; } export default Member; diff --git a/src/events/clientReady.ts b/src/events/clientReady.ts index 3b462bc..6ed7a94 100644 --- a/src/events/clientReady.ts +++ b/src/events/clientReady.ts @@ -1,23 +1,23 @@ import { Events } from "discord.js"; -import { CustomClient } from "../types/customClient"; +import type { CustomClient } from "../types/customClient"; import initializeRoles from "../utils/initializeRoles"; export function setupClientReadyHandler(client: CustomClient) { - client.once(Events.ClientReady, () => { - console.log("Ready!"); - if (client.user) { - console.log(`Logged in as ${client.user.tag}`); + client.once(Events.ClientReady, () => { + console.log("Ready!"); + if (client.user) { + console.log(`Logged in as ${client.user.tag}`); - //guildのリストを取得 - const guilds = client.guilds.cache; - if (guilds.size == 0) { - console.error("No guild found."); - throw new Error("No guild found."); - } else { - for (const [, guild] of guilds) { - initializeRoles(guild); - } - } - } - }); + //guildのリストを取得 + const guilds = client.guilds.cache; + if (guilds.size == 0) { + console.error("No guild found."); + throw new Error("No guild found."); + } else { + for (const [, guild] of guilds) { + initializeRoles(guild); + } + } + } + }); } diff --git a/src/events/eventHandler.ts b/src/events/eventHandler.ts index 44b50f4..0a87a02 100644 --- a/src/events/eventHandler.ts +++ b/src/events/eventHandler.ts @@ -1,13 +1,16 @@ -import { CustomClient } from "../types/customClient"; +import type { CustomClient } from "../types/customClient"; import { setupClientReadyHandler } from "./clientReady"; import { setupInteractionCreateHandler } from "./interactionCreate"; import { setupGuildMemberAddHandler } from "./guildMemberAdd"; import { setupMessageCreate } from "./messageCreate"; -import AuthData from "../types/authData"; +import type AuthData from "../types/authData"; -export function setupEventHandlers(client: CustomClient, userStates: Map) { - setupClientReadyHandler(client); - setupInteractionCreateHandler(client); - setupGuildMemberAddHandler(client); - setupMessageCreate(client, userStates); +export function setupEventHandlers( + client: CustomClient, + userStates: Map, +) { + setupClientReadyHandler(client); + setupInteractionCreateHandler(client); + setupGuildMemberAddHandler(client); + setupMessageCreate(client, userStates); } diff --git a/src/events/guildMemberAdd.ts b/src/events/guildMemberAdd.ts index cefc6ee..975be5f 100644 --- a/src/events/guildMemberAdd.ts +++ b/src/events/guildMemberAdd.ts @@ -1,32 +1,39 @@ -import { Events, Guild, GuildMember, Role } from "discord.js"; -import { CustomClient } from "../types/customClient"; +import { Events, type Guild, type GuildMember, type Role } from "discord.js"; +import type { CustomClient } from "../types/customClient"; import createRoleIfNotFound from "../utils/createRoleNotFound"; import unAuthorizedRoleProperty from "../roles/unAuthorized"; export function setupGuildMemberAddHandler(client: CustomClient) { - client.on(Events.GuildMemberAdd, async (member: GuildMember) => { - await sendDM(member); - await giveUnauthorizedRole(member); - }); + client.on(Events.GuildMemberAdd, async (member: GuildMember) => { + await sendDM(member); + await giveUnauthorizedRole(member); + }); } async function sendDM(member: GuildMember) { - try { - await member.send(`ようこそ ${member.displayName} さん! ITS discord 認証botです!`); - await member.send("名前(フルネーム)を教えてください"); - console.log(`Welcome message sent to ${member.displayName}.`); - } catch (error) { - console.error("Error sending DM:", error); - } + try { + await member.send( + `ようこそ ${member.displayName} さん! ITS discord 認証botです!`, + ); + await member.send("名前(フルネーム)を教えてください"); + console.log(`Welcome message sent to ${member.displayName}.`); + } catch (error) { + console.error("Error sending DM:", error); + } } async function giveUnauthorizedRole(member: GuildMember) { - try { - const guild: Guild = member.guild; - const role: Role = await createRoleIfNotFound({ guild, customRole: unAuthorizedRoleProperty }); - await member.roles.add(role); - console.log(`Unauthorized role has been assigned to ${member.displayName}.`); - } catch (error) { - console.error("Error creating Unauthorized role:", error); - } + try { + const guild: Guild = member.guild; + const role: Role = await createRoleIfNotFound({ + guild, + customRole: unAuthorizedRoleProperty, + }); + await member.roles.add(role); + console.log( + `Unauthorized role has been assigned to ${member.displayName}.`, + ); + } catch (error) { + console.error("Error creating Unauthorized role:", error); + } } diff --git a/src/events/interactionCreate.ts b/src/events/interactionCreate.ts index b8ebe3f..a951fdd 100644 --- a/src/events/interactionCreate.ts +++ b/src/events/interactionCreate.ts @@ -1,24 +1,29 @@ import { Events } from "discord.js"; -import { CustomClient } from "../types/customClient"; +import type { CustomClient } from "../types/customClient"; export function setupInteractionCreateHandler(client: CustomClient) { - client.on(Events.InteractionCreate, async (interaction) => { - if (!interaction.isChatInputCommand()) return; + client.on(Events.InteractionCreate, async (interaction) => { + if (!interaction.isChatInputCommand()) return; - const command = client.commands.get(interaction.commandName); - if (!command) { - console.error(`No command matching ${interaction.commandName} was found.`); - return; - } + const command = client.commands.get(interaction.commandName); + if (!command) { + console.error( + `No command matching ${interaction.commandName} was found.`, + ); + return; + } - try { - await command.execute(interaction); - } catch (error) { - console.error(error); - const replyContent = { content: "There was an error while executing this command!", ephemeral: true }; - interaction.replied || interaction.deferred - ? await interaction.followUp(replyContent) - : await interaction.reply(replyContent); - } - }); + try { + await command.execute(interaction); + } catch (error) { + console.error(error); + const replyContent = { + content: "There was an error while executing this command!", + ephemeral: true, + }; + interaction.replied || interaction.deferred + ? await interaction.followUp(replyContent) + : await interaction.reply(replyContent); + } + }); } diff --git a/src/events/messageCreate.ts b/src/events/messageCreate.ts index 4b045d0..9e0cc9d 100644 --- a/src/events/messageCreate.ts +++ b/src/events/messageCreate.ts @@ -1,120 +1,143 @@ -import { ChannelType, Events, Message } from "discord.js"; -import { CustomClient } from "../types/customClient"; +import { ChannelType, Events, type Message } from "discord.js"; +import type { CustomClient } from "../types/customClient"; import clearAuthData from "../utils/clearAuthData"; -import AuthData from "../types/authData"; +import type AuthData from "../types/authData"; import Department from "../entities/department"; import authMember from "../utils/authMember"; import sendAuthMailController from "../controllers/authController"; -export function setupMessageCreate(client: CustomClient, userStates: Map) { - client.on(Events.MessageCreate, async (message: Message) => { - if (message.author.bot || message.channel.type !== ChannelType.DM) return; - handleDM(message, userStates); - }); +export function setupMessageCreate( + client: CustomClient, + userStates: Map, +) { + client.on(Events.MessageCreate, async (message: Message) => { + if (message.author.bot || message.channel.type !== ChannelType.DM) return; + handleDM(message, userStates); + }); } async function handleDM(message: Message, userStates: Map) { - const userId = message.author.id; - const userInfo = userStates.get(userId) || {}; - const reply = async (text: string) => message.reply(text); + const userId = message.author.id; + const userInfo = userStates.get(userId) || {}; + const reply = async (text: string) => message.reply(text); - if (!userInfo.name) { - await setUserInfoAndReply(userStates, userId, { name: message.content }, "学籍番号を教えてください", reply); - } else if (!userInfo.student_number) { - await validateAndSetStudentNumber(message, userInfo, userStates, userId, reply); - } else if (!userInfo.department) { - await validateAndSetDepartment(message, userInfo, userStates, userId, reply); - } else if (!userInfo.mail) { - await validateAndRegisterUser(message, userInfo, userStates, userId, reply); - } + if (!userInfo.name) { + await setUserInfoAndReply( + userStates, + userId, + { name: message.content }, + "学籍番号を教えてください", + reply, + ); + } else if (!userInfo.student_number) { + await validateAndSetStudentNumber( + message, + userInfo, + userStates, + userId, + reply, + ); + } else if (!userInfo.department) { + await validateAndSetDepartment( + message, + userInfo, + userStates, + userId, + reply, + ); + } else if (!userInfo.mail) { + await validateAndRegisterUser(message, userInfo, userStates, userId, reply); + } } async function setUserInfoAndReply( - userStates: Map, - userId: string, - update: Partial, - replyMessage: string, - reply: (message: string) => Promise + userStates: Map, + userId: string, + update: Partial, + replyMessage: string, + reply: (message: string) => Promise, ) { - const userInfo = userStates.get(userId) || {}; - Object.assign(userInfo, update); - userStates.set(userId, userInfo); - await reply(replyMessage); + const userInfo = userStates.get(userId) || {}; + Object.assign(userInfo, update); + userStates.set(userId, userInfo); + await reply(replyMessage); } async function validateAndSetStudentNumber( - message: Message, - userInfo: AuthData, - userStates: Map, - userId: string, - reply: (message: string) => Promise + message: Message, + userInfo: AuthData, + userStates: Map, + userId: string, + reply: (message: string) => Promise, ) { - const studentNumber = message.content; - // 学籍番号の形式が正しいかどうか曖昧にチェック - if (!/^[a-zA-Z0-9]{8}$/.test(studentNumber)) { - await reply("学籍番号の形式が正しくありません。"); - return; - } - await setUserInfoAndReply( - userStates, - userId, - { student_number: studentNumber }, - "学科を以下から教えてください: CS, BI, IA, OTHERS", - reply - ); + const studentNumber = message.content; + // 学籍番号の形式が正しいかどうか曖昧にチェック + if (!/^[a-zA-Z0-9]{8}$/.test(studentNumber)) { + await reply("学籍番号の形式が正しくありません。"); + return; + } + await setUserInfoAndReply( + userStates, + userId, + { student_number: studentNumber }, + "学科を以下から教えてください: CS, BI, IA, OTHERS", + reply, + ); } async function validateAndSetDepartment( - message: Message, - userInfo: AuthData, - userStates: Map, - userId: string, - reply: (message: string) => Promise + message: Message, + userInfo: AuthData, + userStates: Map, + userId: string, + reply: (message: string) => Promise, ) { - const departmentInput = message.content.toUpperCase(); - if (departmentInput in Department) { - await setUserInfoAndReply( - userStates, - userId, - { department: Department[departmentInput as keyof typeof Department] }, - "メールアドレスを教えてください", - reply - ); - } else { - await reply("形式が正しくありません。学科を以下から教えてください: CS, BI, IA, GRADUATE, OTHERS"); - } + const departmentInput = message.content.toUpperCase(); + if (departmentInput in Department) { + await setUserInfoAndReply( + userStates, + userId, + { department: Department[departmentInput as keyof typeof Department] }, + "メールアドレスを教えてください", + reply, + ); + } else { + await reply( + "形式が正しくありません。学科を以下から教えてください: CS, BI, IA, GRADUATE, OTHERS", + ); + } } async function validateAndRegisterUser( - message: Message, - userInfo: AuthData, - userStates: Map, - userId: string, - reply: (message: string) => Promise + message: Message, + userInfo: AuthData, + userStates: Map, + userId: string, + reply: (message: string) => Promise, ) { - const mail = message.content; - if (mail.endsWith("@shizuoka.ac.jp")) { - userInfo.mail = mail; - if (await authMember(userInfo)) { - try { - userInfo.discordId = message.author.id; - await sendAuthMailController(userInfo); - } catch (e) { - userInfo = clearAuthData(); - await reply("認証に失敗しました。もう一度やり直してください"); - await reply("名前(フルネーム)を教えてください"); - return; - } - await reply( - "認証メールを送信しました。静大メールから認証を行い、Discordサーバーで`/auth`コマンドを実行してください" - ); - } else { - userInfo = clearAuthData(); - await reply("認証に失敗しました。もう一度やり直してください"); - await reply("名前(フルネーム)を教えてください"); - } - userStates.delete(userId); // 登録後は状態をクリア - } else { - await reply("メールアドレスの形式が正しくありません。もう一度お願いします"); - } + const mail = message.content; + if (mail.endsWith("@shizuoka.ac.jp")) { + userInfo.mail = mail; + if (await authMember(userInfo)) { + try { + userInfo.discordId = message.author.id; + await sendAuthMailController(userInfo); + } catch (e) { + userInfo = clearAuthData(); + await reply("認証に失敗しました。もう一度やり直してください"); + await reply("名前(フルネーム)を教えてください"); + return; + } + await reply( + "認証メールを送信しました。静大メールから認証を行い、Discordサーバーで`/auth`コマンドを実行してください", + ); + } else { + userInfo = clearAuthData(); + await reply("認証に失敗しました。もう一度やり直してください"); + await reply("名前(フルネーム)を教えてください"); + } + userStates.delete(userId); // 登録後は状態をクリア + } else { + await reply("メールアドレスの形式が正しくありません。もう一度お願いします"); + } } diff --git a/src/infra/firebase.ts b/src/infra/firebase.ts index 846db36..7cf7e1d 100644 --- a/src/infra/firebase.ts +++ b/src/infra/firebase.ts @@ -1,26 +1,26 @@ import * as admin from "firebase-admin"; -import { initializeApp, FirebaseApp } from "firebase/app"; +import { initializeApp, type FirebaseApp } from "firebase/app"; import { getAuth } from "firebase/auth"; //TODO: コンフィグの読み込みを分離 import serviceAccount from "../../its-discord-auth-firebase-adminsdk-wn2uo-ac781d8325.json"; import dotenv from "dotenv"; admin.initializeApp({ - credential: admin.credential.cert(serviceAccount as admin.ServiceAccount), + credential: admin.credential.cert(serviceAccount as admin.ServiceAccount), }); dotenv.config(); // 環境変数をロード const firebaseConfig = { - apiKey: process.env.FIREBASE_API_KEY, - authDomain: process.env.FIREBASE_AUTH_DOMAIN, - databaseURL: process.env.FIREBASE_DATABASE_URL, - projectId: process.env.FIREBASE_PROJECT_ID, - storageBucket: process.env.FIREBASE_STORAGE_BUCKET, - messagingSenderId: process.env.FIREBASE_MESSAGING_SENDER_ID, - messageSenderId: process.env.FIREBASE_MESSAGE_SENDER_ID, - appId: process.env.FIREBASE_APP_ID, - measurementId: process.env.FIREBASE_MEASUREMENT_ID, + apiKey: process.env.FIREBASE_API_KEY, + authDomain: process.env.FIREBASE_AUTH_DOMAIN, + databaseURL: process.env.FIREBASE_DATABASE_URL, + projectId: process.env.FIREBASE_PROJECT_ID, + storageBucket: process.env.FIREBASE_STORAGE_BUCKET, + messagingSenderId: process.env.FIREBASE_MESSAGING_SENDER_ID, + messageSenderId: process.env.FIREBASE_MESSAGE_SENDER_ID, + appId: process.env.FIREBASE_APP_ID, + measurementId: process.env.FIREBASE_MEASUREMENT_ID, }; const app: FirebaseApp = initializeApp(firebaseConfig); diff --git a/src/loadCommands.ts b/src/loadCommands.ts index ad614fe..a4449cb 100644 --- a/src/loadCommands.ts +++ b/src/loadCommands.ts @@ -1,19 +1,21 @@ import fs from "fs/promises"; import path from "path"; -import { CustomClient } from "./types/customClient"; +import type { CustomClient } from "./types/customClient"; export async function loadCommands(client: CustomClient) { - const commandsFoldersPath = path.resolve("src", "commands"); - const commandFiles = await fs.readdir(commandsFoldersPath); - const tsCommandFiles = commandFiles.filter((file) => file.endsWith(".ts")); - for (const file of tsCommandFiles) { - const filePath = path.join(commandsFoldersPath, file); - const { default: command } = await import(filePath); - if (command.data && command.execute) { - client.commands.set(command.data.name, command); - console.log(`[INFO] Loaded command: ${command.data.name}`); - } else { - console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`); - } - } + const commandsFoldersPath = path.resolve("src", "commands"); + const commandFiles = await fs.readdir(commandsFoldersPath); + const tsCommandFiles = commandFiles.filter((file) => file.endsWith(".ts")); + for (const file of tsCommandFiles) { + const filePath = path.join(commandsFoldersPath, file); + const { default: command } = await import(filePath); + if (command.data && command.execute) { + client.commands.set(command.data.name, command); + console.log(`[INFO] Loaded command: ${command.data.name}`); + } else { + console.log( + `[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`, + ); + } + } } diff --git a/src/main.ts b/src/main.ts index 2273bad..abc9c77 100644 --- a/src/main.ts +++ b/src/main.ts @@ -2,7 +2,7 @@ import { CustomClient } from "./types/customClient"; import dotenv from "dotenv"; import { loadCommands } from "./loadCommands"; import { setupEventHandlers } from "./events/eventHandler"; -import AuthData from "./types/authData"; +import type AuthData from "./types/authData"; import { scheduleHotChannels } from "./tasks/scheduleHotChannels"; dotenv.config(); @@ -14,17 +14,17 @@ const horChannelId = process.env.HOT_CHANNEL_ID; const postHotChannelTime = process.env.POST_HOT_CHANNEL_TIME; async function main() { - if (!token) { - console.error("Missing environment variables."); - process.exit(1); - } + if (!token) { + console.error("Missing environment variables."); + process.exit(1); + } - await loadCommands(client); - setupEventHandlers(client, userStates); - scheduleHotChannels(client, horChannelId!, postHotChannelTime!); + await loadCommands(client); + setupEventHandlers(client, userStates); + scheduleHotChannels(client, horChannelId!, postHotChannelTime!); - await client.login(token); - console.log("Bot is running..."); + await client.login(token); + console.log("Bot is running..."); } main().catch(console.error); diff --git a/src/roles/administrator.ts b/src/roles/administrator.ts index 472ad4d..8432924 100644 --- a/src/roles/administrator.ts +++ b/src/roles/administrator.ts @@ -1,9 +1,9 @@ -import CustomRole from "../types/customRole"; +import type CustomRole from "../types/customRole"; const administratorRoleProperty: CustomRole = { - roleName: "Administrator", - color: "Red", - reason: "Role for administrators.", + roleName: "Administrator", + color: "Red", + reason: "Role for administrators.", }; export default administratorRoleProperty; diff --git a/src/roles/authorized.ts b/src/roles/authorized.ts index 17ecfac..92388dc 100644 --- a/src/roles/authorized.ts +++ b/src/roles/authorized.ts @@ -1,9 +1,9 @@ -import CustomRole from "../types/customRole"; +import type CustomRole from "../types/customRole"; const authorizedRoleProperty: CustomRole = { - roleName: "Authorized", - color: "Green", - reason: "Member role for authenticated members.", + roleName: "Authorized", + color: "Green", + reason: "Member role for authenticated members.", }; export default authorizedRoleProperty; diff --git a/src/roles/departments/bi.ts b/src/roles/departments/bi.ts index b590508..2a11ca9 100644 --- a/src/roles/departments/bi.ts +++ b/src/roles/departments/bi.ts @@ -1,5 +1,9 @@ -import CustomRole from "../../types/customRole"; +import type CustomRole from "../../types/customRole"; import makeDepartmentRole from "../../utils/makeDepartmentRole"; -const biRole: CustomRole = makeDepartmentRole({ department: "BI", color: [0, 112, 255], reason: "BI Department Role" }); +const biRole: CustomRole = makeDepartmentRole({ + department: "BI", + color: [0, 112, 255], + reason: "BI Department Role", +}); export default biRole; diff --git a/src/roles/departments/cs.ts b/src/roles/departments/cs.ts index ef81265..49a48f8 100644 --- a/src/roles/departments/cs.ts +++ b/src/roles/departments/cs.ts @@ -1,5 +1,9 @@ -import CustomRole from "../../types/customRole"; +import type CustomRole from "../../types/customRole"; import makeDepartmentRole from "../../utils/makeDepartmentRole"; -const csRole: CustomRole = makeDepartmentRole({ department: "CS", color: "Orange", reason: "CS Department Role" }); +const csRole: CustomRole = makeDepartmentRole({ + department: "CS", + color: "Orange", + reason: "CS Department Role", +}); export default csRole; diff --git a/src/roles/departments/graduate.ts b/src/roles/departments/graduate.ts index c5be27d..c275cc9 100644 --- a/src/roles/departments/graduate.ts +++ b/src/roles/departments/graduate.ts @@ -1,9 +1,9 @@ -import CustomRole from "../../types/customRole"; +import type CustomRole from "../../types/customRole"; import makeDepartmentRole from "../../utils/makeDepartmentRole"; const graduateRole: CustomRole = makeDepartmentRole({ - department: "GRADUATE", - color: [255, 215, 0], - reason: "Graduate student Role", + department: "GRADUATE", + color: [255, 215, 0], + reason: "Graduate student Role", }); export default graduateRole; diff --git a/src/roles/departments/ia.ts b/src/roles/departments/ia.ts index d908fde..ab3109c 100644 --- a/src/roles/departments/ia.ts +++ b/src/roles/departments/ia.ts @@ -1,5 +1,9 @@ -import CustomRole from "../../types/customRole"; +import type CustomRole from "../../types/customRole"; import makeDepartmentRole from "../../utils/makeDepartmentRole"; -const iaRole: CustomRole = makeDepartmentRole({ department: "IA", color: [0, 128, 0], reason: "BI Department Role" }); +const iaRole: CustomRole = makeDepartmentRole({ + department: "IA", + color: [0, 128, 0], + reason: "BI Department Role", +}); export default iaRole; diff --git a/src/roles/departments/obog.ts b/src/roles/departments/obog.ts index 94ba7e5..cf0030b 100644 --- a/src/roles/departments/obog.ts +++ b/src/roles/departments/obog.ts @@ -1,4 +1,8 @@ import makeDepartmentRole from "../../utils/makeDepartmentRole"; -export const obOgRole = makeDepartmentRole({ department: "OB/OG", color: [0, 128, 128], reason: "Role for OB/OG" }); +export const obOgRole = makeDepartmentRole({ + department: "OB/OG", + color: [0, 128, 128], + reason: "Role for OB/OG", +}); export default obOgRole; diff --git a/src/roles/departments/others.ts b/src/roles/departments/others.ts index 5fbf6d3..0b1e241 100644 --- a/src/roles/departments/others.ts +++ b/src/roles/departments/others.ts @@ -1,9 +1,9 @@ -import CustomRole from "../../types/customRole"; +import type CustomRole from "../../types/customRole"; import makeDepartmentRole from "../../utils/makeDepartmentRole"; const othersRole: CustomRole = makeDepartmentRole({ - department: "OTHERS", - color: [128, 0, 128], - reason: "Role for non informatics major students", + department: "OTHERS", + color: [128, 0, 128], + reason: "Role for non informatics major students", }); export default othersRole; diff --git a/src/roles/unAuthorized.ts b/src/roles/unAuthorized.ts index 9329e51..b24a785 100644 --- a/src/roles/unAuthorized.ts +++ b/src/roles/unAuthorized.ts @@ -1,9 +1,9 @@ -import CustomRole from "../types/customRole"; +import type CustomRole from "../types/customRole"; const unAuthorizedRoleProperty: CustomRole = { - roleName: "Unauthorized", - color: "Grey", - reason: "Unauthorized role for new members.", + roleName: "Unauthorized", + color: "Grey", + reason: "Unauthorized role for new members.", }; export default unAuthorizedRoleProperty; diff --git a/src/tasks/scheduleHotChannels.ts b/src/tasks/scheduleHotChannels.ts index 1c12180..7279a9b 100644 --- a/src/tasks/scheduleHotChannels.ts +++ b/src/tasks/scheduleHotChannels.ts @@ -1,31 +1,40 @@ import { CronJob } from "cron"; -import { CustomClient } from "../types/customClient"; +import type { CustomClient } from "../types/customClient"; import { generateChannelActivityRanking } from "../usecases/getHotChannels"; -import { TextChannel } from "discord.js"; +import type { TextChannel } from "discord.js"; -export function scheduleHotChannels(client: CustomClient, channelId: string, time: string): void { - const job = new CronJob(time, async () => { - try { - console.log("[INFO] Posting hot channels cron job started"); - const guild = client.guilds.cache.first(); - if (guild) { - console.log("[INFO] Generating hot channels ranking"); - const ranking = await generateChannelActivityRanking(guild); - console.log("[INFO] Generated hot channels ranking"); - console.log("[INFO] Finding hot channels channel"); - const channel = guild.channels.cache.find((ch) => ch.id === channelId) as TextChannel; - if (channel) { - console.log("[INFO] Found hot channels channel"); - await channel.send({ embeds: [ranking] }); - } else { - console.error("[ERROR] Hot channels channel not found"); - } - } else { - console.error("[ERROR] Guild not found"); - } - } catch (error) { - console.error("[ERROR] An error occurred in the hot channels cron job:", error); - } - }); - job.start(); +export function scheduleHotChannels( + client: CustomClient, + channelId: string, + time: string, +): void { + const job = new CronJob(time, async () => { + try { + console.log("[INFO] Posting hot channels cron job started"); + const guild = client.guilds.cache.first(); + if (guild) { + console.log("[INFO] Generating hot channels ranking"); + const ranking = await generateChannelActivityRanking(guild); + console.log("[INFO] Generated hot channels ranking"); + console.log("[INFO] Finding hot channels channel"); + const channel = guild.channels.cache.find( + (ch) => ch.id === channelId, + ) as TextChannel; + if (channel) { + console.log("[INFO] Found hot channels channel"); + await channel.send({ embeds: [ranking] }); + } else { + console.error("[ERROR] Hot channels channel not found"); + } + } else { + console.error("[ERROR] Guild not found"); + } + } catch (error) { + console.error( + "[ERROR] An error occurred in the hot channels cron job:", + error, + ); + } + }); + job.start(); } diff --git a/src/types/authData.ts b/src/types/authData.ts index 341a142..bb12c3f 100644 --- a/src/types/authData.ts +++ b/src/types/authData.ts @@ -1,11 +1,11 @@ -import Department from "../entities/department"; +import type Department from "../entities/department"; interface AuthData { - name?: string; - student_number?: string; - department?: Department; - mail?: string; - discordId?: string; + name?: string; + student_number?: string; + department?: Department; + mail?: string; + discordId?: string; } export default AuthData; diff --git a/src/types/command.ts b/src/types/command.ts index e784a76..2a637d1 100644 --- a/src/types/command.ts +++ b/src/types/command.ts @@ -1,6 +1,6 @@ -import { CommandInteraction, SlashCommandBuilder } from "discord.js"; +import type { CommandInteraction, SlashCommandBuilder } from "discord.js"; export interface Command { - data: SlashCommandBuilder; - execute: (interaction: CommandInteraction) => void; + data: SlashCommandBuilder; + execute: (interaction: CommandInteraction) => void; } diff --git a/src/types/commandWithArgs.ts b/src/types/commandWithArgs.ts index ce6f570..8f59f82 100644 --- a/src/types/commandWithArgs.ts +++ b/src/types/commandWithArgs.ts @@ -1,10 +1,13 @@ -import { CommandInteraction, SlashCommandBuilder } from "discord.js"; +import type { CommandInteraction, SlashCommandBuilder } from "discord.js"; -type OmittedSlashCommandBuilder = Omit; +type OmittedSlashCommandBuilder = Omit< + SlashCommandBuilder, + "addSubcommand" | "addSubcommandGroup" +>; interface CommandWithArgs { - data: OmittedSlashCommandBuilder; - execute: (interaction: CommandInteraction) => void; + data: OmittedSlashCommandBuilder; + execute: (interaction: CommandInteraction) => void; } export default CommandWithArgs; diff --git a/src/types/customClient.ts b/src/types/customClient.ts index 2898807..cd75f3d 100644 --- a/src/types/customClient.ts +++ b/src/types/customClient.ts @@ -1,19 +1,19 @@ import { GatewayIntentBits, Client, Partials, Collection } from "discord.js"; -import { Command } from "./command"; +import type { Command } from "./command"; export class CustomClient extends Client { - public commands: Collection; + public commands: Collection; - constructor() { - super({ - intents: [ - GatewayIntentBits.DirectMessages, - GatewayIntentBits.GuildMembers, - GatewayIntentBits.GuildMessages, - GatewayIntentBits.GuildInvites, - ], - partials: [Partials.Message, Partials.Channel], - }); - this.commands = new Collection(); - } + constructor() { + super({ + intents: [ + GatewayIntentBits.DirectMessages, + GatewayIntentBits.GuildMembers, + GatewayIntentBits.GuildMessages, + GatewayIntentBits.GuildInvites, + ], + partials: [Partials.Message, Partials.Channel], + }); + this.commands = new Collection(); + } } diff --git a/src/types/customRole.ts b/src/types/customRole.ts index 6ecfd2a..4c58b18 100644 --- a/src/types/customRole.ts +++ b/src/types/customRole.ts @@ -1,9 +1,9 @@ -import { ColorResolvable } from "discord.js"; +import type { ColorResolvable } from "discord.js"; interface CustomRole { - roleName: string; - color: ColorResolvable; - reason: string; + roleName: string; + color: ColorResolvable; + reason: string; } export default CustomRole; diff --git a/src/usecases/getHotChannels.ts b/src/usecases/getHotChannels.ts index d42b60c..15e13eb 100644 --- a/src/usecases/getHotChannels.ts +++ b/src/usecases/getHotChannels.ts @@ -1,66 +1,84 @@ -import { ChannelType, Guild, TextChannel, SnowflakeUtil, EmbedBuilder, APIEmbedField } from "discord.js"; +import { + ChannelType, + type Guild, + type TextChannel, + SnowflakeUtil, + EmbedBuilder, + type APIEmbedField, +} from "discord.js"; export async function generateChannelActivityRanking(guild: Guild) { - const now = new Date(); - const oneDayAgoSnowflake = SnowflakeUtil.generate({ timestamp: now.getTime() - 24 * 60 * 60 * 1000 }); + const now = new Date(); + const oneDayAgoSnowflake = SnowflakeUtil.generate({ + timestamp: now.getTime() - 24 * 60 * 60 * 1000, + }); - const channels = await guild.channels.fetch(); - const textChannels = channels.filter( - (channel): channel is TextChannel => channel !== null && channel.type === ChannelType.GuildText - ); + const channels = await guild.channels.fetch(); + const textChannels = channels.filter( + (channel): channel is TextChannel => + channel !== null && channel.type === ChannelType.GuildText, + ); - const channelStats = await Promise.all( - textChannels.map(async (channel) => { - try { - let totalMessages = 0; - let lastId: string | undefined; - while (true) { - const messages = await channel.messages.fetch({ - limit: 100, - after: lastId || oneDayAgoSnowflake.toString(), - }); - if (messages.size === 0) break; - totalMessages += messages.size; - lastId = messages.last()?.id; - if (messages.last()!.createdTimestamp < oneDayAgoSnowflake) break; - } - return { - id: channel.id, - name: channel.name, - count: totalMessages, - }; - } catch (error) { - console.error(`Error fetching messages for channel ${channel.name}:`, error); - return { - id: channel.id, - name: channel.name, - count: 0, - }; - } - }) - ); + const channelStats = await Promise.all( + textChannels.map(async (channel) => { + try { + let totalMessages = 0; + let lastId: string | undefined; + while (true) { + const messages = await channel.messages.fetch({ + limit: 100, + after: lastId || oneDayAgoSnowflake.toString(), + }); + if (messages.size === 0) break; + totalMessages += messages.size; + lastId = messages.last()?.id; + if (messages.last()!.createdTimestamp < oneDayAgoSnowflake) break; + } + return { + id: channel.id, + name: channel.name, + count: totalMessages, + }; + } catch (error) { + console.error( + `Error fetching messages for channel ${channel.name}:`, + error, + ); + return { + id: channel.id, + name: channel.name, + count: 0, + }; + } + }), + ); - const targetChannels = channelStats.filter((channel) => channel.count > 0); - const sortedStats = targetChannels.sort((a, b) => b.count - a.count).slice(0, 20); - const totalMessages = sortedStats.reduce((sum, channel) => sum + channel.count, 0); + const targetChannels = channelStats.filter((channel) => channel.count > 0); + const sortedStats = targetChannels + .sort((a, b) => b.count - a.count) + .slice(0, 20); + const totalMessages = sortedStats.reduce( + (sum, channel) => sum + channel.count, + 0, + ); - const embed = new EmbedBuilder() - .setColor(0x0099ff) - .setTitle("Hot Channels Bot") - .setDescription(`${now.toISOString().split("T")[0]} の発言数ランキング`) - .setFooter({ text: `合計発言数: ${totalMessages}` }); + const embed = new EmbedBuilder() + .setColor(0x0099ff) + .setTitle("Hot Channels Bot") + .setDescription(`${now.toISOString().split("T")[0]} の発言数ランキング`) + .setFooter({ text: `合計発言数: ${totalMessages}` }); - const fields: APIEmbedField | APIEmbedField[] = []; - sortedStats.forEach((channel, index) => { - const percentage = ((channel.count / totalMessages) * 100).toFixed(1); - fields.push({ - name: `${index + 1}. https://discord.com/channels/${guild.id}/${channel.id}`, - value: `発言数: ${channel.count} (${percentage}%)`, - inline: false, - }); - }); + const fields: APIEmbedField | APIEmbedField[] = []; + sortedStats.forEach((channel, index) => { + const percentage = ((channel.count / totalMessages) * 100).toFixed(1); + fields.push({ + name: `${index + 1}. https://discord.com/channels/${guild.id}/${channel.id}`, + value: `発言数: ${channel.count} (${percentage}%)`, + inline: false, + }); + }); - embed.addFields(fields); + embed.addFields(fields); - return embed; + return embed; } diff --git a/src/usecases/getMembers.ts b/src/usecases/getMembers.ts index 64e5d9a..ce71efb 100644 --- a/src/usecases/getMembers.ts +++ b/src/usecases/getMembers.ts @@ -1,26 +1,26 @@ -import Member from "../entities/member"; +import type Member from "../entities/member"; import { db } from "../infra/firebase"; async function getMembers(): Promise { - const snapshot = await db.collection("members").get(); - const members: Member[] = snapshot.docs.map((doc) => - convertToMember({ - id: doc.id, - ...doc.data(), - }) - ); - return members; + const snapshot = await db.collection("members").get(); + const members: Member[] = snapshot.docs.map((doc) => + convertToMember({ + id: doc.id, + ...doc.data(), + }), + ); + return members; } function convertToMember(docData: FirebaseFirestore.DocumentData): Member { - return { - id: docData.id, - name: docData.name, - student_number: docData.student_number, - department: docData.department, - mail: docData.mail, - discordId: docData.discordId, - }; + return { + id: docData.id, + name: docData.name, + student_number: docData.student_number, + department: docData.department, + mail: docData.mail, + discordId: docData.discordId, + }; } export default getMembers; diff --git a/src/usecases/insertMember.ts b/src/usecases/insertMember.ts index 03e2e3f..41fb0c3 100644 --- a/src/usecases/insertMember.ts +++ b/src/usecases/insertMember.ts @@ -1,17 +1,17 @@ -import Member from "../entities/member"; +import type Member from "../entities/member"; import { v4 as uuidv4 } from "uuid"; import { db } from "../infra/firebase"; async function insertMember(member: Member) { - const uniqueId = uuidv4(); - const docRef = await db.collection("members").doc(uniqueId); - await docRef.set({ - name: member.name, - student_number: member.student_number, - department: member.department, - mail: member.mail, - }); - console.log("Document written with ID: ", docRef.id); + const uniqueId = uuidv4(); + const docRef = await db.collection("members").doc(uniqueId); + await docRef.set({ + name: member.name, + student_number: member.student_number, + department: member.department, + mail: member.mail, + }); + console.log("Document written with ID: ", docRef.id); } export default insertMember; diff --git a/src/usecases/sendAuthMail.ts b/src/usecases/sendAuthMail.ts index c841054..57183a8 100644 --- a/src/usecases/sendAuthMail.ts +++ b/src/usecases/sendAuthMail.ts @@ -1,20 +1,32 @@ import { auth } from "../infra/firebase"; -import { ActionCodeSettings, createUserWithEmailAndPassword, sendEmailVerification } from "firebase/auth"; +import { + type ActionCodeSettings, + createUserWithEmailAndPassword, + sendEmailVerification, +} from "firebase/auth"; -async function sendAuthMail(mail: string, student_number: string, department: string) { - const actionCodeSettings: ActionCodeSettings = { - url: "https://discord.com/channels/1224047445714010143/1224047445714010146", - handleCodeInApp: true, - }; +async function sendAuthMail( + mail: string, + student_number: string, + department: string, +) { + const actionCodeSettings: ActionCodeSettings = { + url: "https://discord.com/channels/1224047445714010143/1224047445714010146", + handleCodeInApp: true, + }; - try { - const user = await createUserWithEmailAndPassword(auth, mail, student_number + department); - await sendEmailVerification(user.user!, actionCodeSettings); + try { + const user = await createUserWithEmailAndPassword( + auth, + mail, + student_number + department, + ); + await sendEmailVerification(user.user!, actionCodeSettings); - console.log("Send mail to " + mail + " successfully"); - } catch (e) { - console.error(e); - } + console.log("Send mail to " + mail + " successfully"); + } catch (e) { + console.error(e); + } } export default sendAuthMail; diff --git a/src/usecases/setDiscordId.ts b/src/usecases/setDiscordId.ts index ec87ddc..d2a941c 100644 --- a/src/usecases/setDiscordId.ts +++ b/src/usecases/setDiscordId.ts @@ -1,10 +1,10 @@ import { db } from "../infra/firebase"; async function setDiscordId(memberId: string, discordId: string) { - const docRef = db.collection("members").doc(memberId); - await docRef.update({ - discordId: discordId, - }); + const docRef = db.collection("members").doc(memberId); + await docRef.update({ + discordId: discordId, + }); } export default setDiscordId; diff --git a/src/utils/addRoleToMember.ts b/src/utils/addRoleToMember.ts index c349a34..816ca6b 100644 --- a/src/utils/addRoleToMember.ts +++ b/src/utils/addRoleToMember.ts @@ -1,14 +1,18 @@ -import { Guild, GuildMember } from "discord.js"; -import CustomRole from "../types/customRole"; +import type { Guild, GuildMember } from "discord.js"; +import type CustomRole from "../types/customRole"; import createRoleIfNotFound from "./createRoleNotFound"; -async function addRoleToMember(guild: Guild, member: GuildMember, customRole: CustomRole) { - try { - const role = await createRoleIfNotFound({ guild, customRole: customRole }); - await member.roles.add(role); - } catch (error) { - console.error("Failed to add role to member"); - } +async function addRoleToMember( + guild: Guild, + member: GuildMember, + customRole: CustomRole, +) { + try { + const role = await createRoleIfNotFound({ guild, customRole: customRole }); + await member.roles.add(role); + } catch (error) { + console.error("Failed to add role to member"); + } } export default addRoleToMember; diff --git a/src/utils/authMember.ts b/src/utils/authMember.ts index c4460b4..80774e8 100644 --- a/src/utils/authMember.ts +++ b/src/utils/authMember.ts @@ -1,20 +1,20 @@ -import Member from "../entities/member"; -import AuthData from "../types/authData"; +import type Member from "../entities/member"; +import type AuthData from "../types/authData"; import getMembers from "../usecases/getMembers"; async function authMember(authData: AuthData): Promise { - const members: Member[] = await getMembers(); - //membersの中からauthDataと一致するものがあるかどうかを確認する - const authMember: Member | undefined = members.find((member) => { - return ( - member.student_number === authData.student_number && - member.mail === authData.mail && - member.department === authData.department && - member.name === authData.name - ); - }); + const members: Member[] = await getMembers(); + //membersの中からauthDataと一致するものがあるかどうかを確認する + const authMember: Member | undefined = members.find((member) => { + return ( + member.student_number === authData.student_number && + member.mail === authData.mail && + member.department === authData.department && + member.name === authData.name + ); + }); - return authMember ? true : false; + return authMember ? true : false; } export default authMember; diff --git a/src/utils/checkMemberRole.ts b/src/utils/checkMemberRole.ts index 52b38d2..61bb611 100644 --- a/src/utils/checkMemberRole.ts +++ b/src/utils/checkMemberRole.ts @@ -1,10 +1,12 @@ -import { CommandInteraction } from "discord.js"; +import type { CommandInteraction } from "discord.js"; import administratorRoleProperty from "../roles/administrator"; async function checkIsAdmin(interaction: CommandInteraction): Promise { - const member = await interaction.guild!.members.fetch(interaction.user.id); - const isAdmin: boolean = member.roles.cache.some((role) => role.name === administratorRoleProperty.roleName); - return isAdmin; + const member = await interaction.guild!.members.fetch(interaction.user.id); + const isAdmin: boolean = member.roles.cache.some( + (role) => role.name === administratorRoleProperty.roleName, + ); + return isAdmin; } export default checkIsAdmin; diff --git a/src/utils/clearAuthData.ts b/src/utils/clearAuthData.ts index 4236371..e40bf8b 100644 --- a/src/utils/clearAuthData.ts +++ b/src/utils/clearAuthData.ts @@ -1,13 +1,13 @@ -import AuthData from "../types/authData"; +import type AuthData from "../types/authData"; function clearAuthData(): AuthData { - return { - name: undefined, - student_number: undefined, - department: undefined, - mail: undefined, - discordId: undefined, - }; + return { + name: undefined, + student_number: undefined, + department: undefined, + mail: undefined, + discordId: undefined, + }; } export default clearAuthData; diff --git a/src/utils/createRoleNotFound.ts b/src/utils/createRoleNotFound.ts index 035272f..beed863 100644 --- a/src/utils/createRoleNotFound.ts +++ b/src/utils/createRoleNotFound.ts @@ -1,28 +1,33 @@ -import { Guild, Role } from "discord.js"; -import CustomRole from "../types/customRole"; +import type { Guild, Role } from "discord.js"; +import type CustomRole from "../types/customRole"; type createRoleNotFoundParams = { - guild: Guild; - customRole: CustomRole; + guild: Guild; + customRole: CustomRole; }; -async function createRoleIfNotFound({ guild, customRole }: createRoleNotFoundParams): Promise { - const roles = await guild.roles.fetch(); - let role: Role | undefined = roles.find((r) => r.name === customRole.roleName); - if (!role) { - try { - role = await guild.roles.create({ - name: customRole.roleName, - color: customRole.color, - reason: customRole.reason, - }); - console.log(`${customRole.roleName} role created.`); - } catch (error) { - console.error(`Error creating ${customRole.roleName} role:`, error); - throw error; - } - } - return role; +async function createRoleIfNotFound({ + guild, + customRole, +}: createRoleNotFoundParams): Promise { + const roles = await guild.roles.fetch(); + let role: Role | undefined = roles.find( + (r) => r.name === customRole.roleName, + ); + if (!role) { + try { + role = await guild.roles.create({ + name: customRole.roleName, + color: customRole.color, + reason: customRole.reason, + }); + console.log(`${customRole.roleName} role created.`); + } catch (error) { + console.error(`Error creating ${customRole.roleName} role:`, error); + throw error; + } + } + return role; } export default createRoleIfNotFound; diff --git a/src/utils/initializeRoles.ts b/src/utils/initializeRoles.ts index b5b0f7e..4ed3f57 100644 --- a/src/utils/initializeRoles.ts +++ b/src/utils/initializeRoles.ts @@ -1,38 +1,43 @@ import { readdirSync, statSync } from "fs"; import { join, resolve } from "path"; import createRoleIfNotFound from "./createRoleNotFound"; -import CustomRole from "../types/customRole"; -import { Guild } from "discord.js"; +import type CustomRole from "../types/customRole"; +import type { Guild } from "discord.js"; async function readRolesFromDirectory(directoryPath: string, guild: Guild) { - const files = readdirSync(directoryPath); - for (const file of files) { - const fullPath = join(directoryPath, file); - if (statSync(fullPath).isDirectory()) { - await readRolesFromDirectory(fullPath, guild); - } else if (fullPath.endsWith("ts")) { - try { - const module = await import(fullPath); - const roleConfig = module.default || module; - if (roleConfig && roleConfig.roleName && roleConfig.color && roleConfig.reason) { - await initializeRole(roleConfig, guild); - } else { - console.error(`Failed to load a valid role config from ${fullPath}`); - } - } catch (error) { - console.error(`Error importing file ${fullPath}: ${error}`); - } - } - } + const files = readdirSync(directoryPath); + for (const file of files) { + const fullPath = join(directoryPath, file); + if (statSync(fullPath).isDirectory()) { + await readRolesFromDirectory(fullPath, guild); + } else if (fullPath.endsWith("ts")) { + try { + const module = await import(fullPath); + const roleConfig = module.default || module; + if ( + roleConfig && + roleConfig.roleName && + roleConfig.color && + roleConfig.reason + ) { + await initializeRole(roleConfig, guild); + } else { + console.error(`Failed to load a valid role config from ${fullPath}`); + } + } catch (error) { + console.error(`Error importing file ${fullPath}: ${error}`); + } + } + } } async function initializeRole(roleConfig: CustomRole, guild: Guild) { - await createRoleIfNotFound({ guild, customRole: roleConfig }); + await createRoleIfNotFound({ guild, customRole: roleConfig }); } async function initializeRoles(guild: Guild) { - const rolesDirectory = resolve(__dirname, "../roles"); - await readRolesFromDirectory(rolesDirectory, guild); + const rolesDirectory = resolve(__dirname, "../roles"); + await readRolesFromDirectory(rolesDirectory, guild); } export default initializeRoles; diff --git a/src/utils/makeDepartmentRole.ts b/src/utils/makeDepartmentRole.ts index cf734c5..8329f6a 100644 --- a/src/utils/makeDepartmentRole.ts +++ b/src/utils/makeDepartmentRole.ts @@ -1,20 +1,24 @@ -import { ColorResolvable } from "discord.js"; -import CustomRole from "../types/customRole"; +import type { ColorResolvable } from "discord.js"; +import type CustomRole from "../types/customRole"; interface makeDepartmentRoleProps { - department: string; - color: ColorResolvable; - reason?: string; + department: string; + color: ColorResolvable; + reason?: string; } -function makeDepartmentRole({ department, color, reason }: makeDepartmentRoleProps): CustomRole { - const role: CustomRole = { - roleName: "DP:" + department, - color: color, - reason: reason ? reason : department + "Department Role", - }; +function makeDepartmentRole({ + department, + color, + reason, +}: makeDepartmentRoleProps): CustomRole { + const role: CustomRole = { + roleName: "DP:" + department, + color: color, + reason: reason ? reason : department + "Department Role", + }; - return role; + return role; } export default makeDepartmentRole; diff --git a/tsconfig.json b/tsconfig.json index e548276..92b0647 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,109 +1,109 @@ { - "compilerOptions": { - "target": "es6", - "module": "commonjs", - "resolveJsonModule": true, - "esModuleInterop": true, - /* Visit https://aka.ms/tsconfig to read more about this file */ - /* Projects */ - // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ - // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ - // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ - // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ - // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ - // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + "compilerOptions": { + "target": "es6", + "module": "commonjs", + "resolveJsonModule": true, + "esModuleInterop": true, + /* Visit https://aka.ms/tsconfig to read more about this file */ + /* Projects */ + // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ - /* Language and Environment */ - // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ - // "jsx": "preserve", /* Specify what JSX code is generated. */ - // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ - // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ - // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ - // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ - // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ - // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ - // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ - // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ - // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + /* Language and Environment */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "preserve", /* Specify what JSX code is generated. */ + // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ - /* Modules */ - // "rootDir": "./", /* Specify the root folder within your source files. */ - // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ - // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ - // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ - // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ - // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ - // "types": [], /* Specify type package names to be included without being referenced in a source file. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ - // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ - // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ - // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ - // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ - // "resolveJsonModule": true, /* Enable importing .json files. */ - // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ - // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + /* Modules */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ + // "types": [], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ + // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ + // "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ - /* JavaScript Support */ - // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ - // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ - // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + /* JavaScript Support */ + // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ - /* Emit */ - // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ - // "declarationMap": true, /* Create sourcemaps for d.ts files. */ - // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ - // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ - // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ - // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ - "outDir": "./build" /* Specify an output folder for all emitted files. */, - // "removeComments": true, /* Disable emitting comments. */ - // "noEmit": true, /* Disable emitting files from a compilation. */ - // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ - // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ - // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ - // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ - // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ - // "newLine": "crlf", /* Set the newline character for emitting files. */ - // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ - // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ - // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ - // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ - // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ - // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + /* Emit */ + // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + "outDir": "./build" /* Specify an output folder for all emitted files. */, + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ - /* Interop Constraints */ - // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ - // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ - // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ - // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ - "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, - /* Type Checking */ - "strict": true /* Enable all strict type-checking options. */, - // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ - // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ - // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ - // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ - // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ - // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ - // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ - // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ - // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ - // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ - // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ - // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ - // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ - // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ - // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ - // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ - // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + /* Type Checking */ + "strict": true /* Enable all strict type-checking options. */, + // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ - /* Completeness */ - // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ - "skipLibCheck": true /* Skip type checking all .d.ts files. */ - } + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + } } From b4a1c2497fb662b8c9f25fc954f4855561d21589 Mon Sep 17 00:00:00 2001 From: KinjiKawaguchi Date: Tue, 1 Oct 2024 09:30:52 +0900 Subject: [PATCH 02/12] ci: install biome --- .eslintrc.json | 39 - biome.json | 30 + eslint.config.mjs | 9 - github/workflows/code_queality.yaml | 18 + package.json | 19 +- yarn.lock | 3143 +++++---------------------- 6 files changed, 595 insertions(+), 2663 deletions(-) delete mode 100644 .eslintrc.json create mode 100644 biome.json delete mode 100644 eslint.config.mjs create mode 100644 github/workflows/code_queality.yaml diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 31410ef..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "root": true, - "env": { - "node": true, - "es6": true, - }, - "parser": "@typescript-eslint/parser", - "parserOptions": { - "project": "./tsconfig.json", - "sourceType": "module" - }, - "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"], - "plugins": ["import", "sort-keys-fix", "typescript-sort-keys", "unused-imports"], - "rules": { - "import/order": [ - "error", - { - "groups": [ - "builtin", - "external", - "internal", - "parent", - "sibling", - "index", - "object", - "type" - ], - "newlines-between": "always", - "alphabetize": { - "order": "asc" - } - } - ], - "import/no-duplicates": "error", - "sort-keys-fix/sort-keys-fix": "error", - "typescript-sort-keys/interface": "error", - "unused-imports/no-unused-imports": "error" - } -} diff --git a/biome.json b/biome.json new file mode 100644 index 0000000..da2af85 --- /dev/null +++ b/biome.json @@ -0,0 +1,30 @@ +{ + "$schema": "https://biomejs.dev/schemas/1.9.2/schema.json", + "vcs": { + "enabled": false, + "clientKind": "git", + "useIgnoreFile": false + }, + "files": { + "ignoreUnknown": false, + "ignore": [] + }, + "formatter": { + "enabled": true, + "indentStyle": "tab" + }, + "organizeImports": { + "enabled": true + }, + "linter": { + "enabled": true, + "rules": { + "recommended": true + } + }, + "javascript": { + "formatter": { + "quoteStyle": "double" + } + } +} diff --git a/eslint.config.mjs b/eslint.config.mjs deleted file mode 100644 index 1f40688..0000000 --- a/eslint.config.mjs +++ /dev/null @@ -1,9 +0,0 @@ -import globals from "globals"; -import pluginJs from "@eslint/js"; -import tseslint from "typescript-eslint"; - -export default [ - { languageOptions: { globals: globals.browser } }, - pluginJs.configs.recommended, - ...tseslint.configs.recommended, -]; diff --git a/github/workflows/code_queality.yaml b/github/workflows/code_queality.yaml new file mode 100644 index 0000000..461742b --- /dev/null +++ b/github/workflows/code_queality.yaml @@ -0,0 +1,18 @@ +name: Code quality + +on: + push: + pull_request: + +jobs: + quality: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Biome + uses: biomejs/setup-biome@v2 + with: + version: latest + - name: Run Biome + run: biome ci . diff --git a/package.json b/package.json index 7ebaded..bccc0f2 100644 --- a/package.json +++ b/package.json @@ -7,31 +7,20 @@ "start": "nodemon --exec ts-node src/main.ts", "test": "ts-node src/main.ts", "deploy-commands": "ts-node src/deployCommands.ts", - "format": "prettier --write .", - "lint": "eslint --ignore-pattern .gitignore './**/*.{js,ts}'", + "format": "biome format --write", + "lint": "biome lint --write", "lint:fix": "eslint --ignore-pattern .gitignore './**/*.{js,ts}' --fix" }, "keywords": [], "author": "", "license": "ISC", "devDependencies": { - "@eslint/js": "^9.9.1", + "@biomejs/biome": "1.9.2", "@types/uuid": "^10.0.0", - "@typescript-eslint/eslint-plugin": "^7.18.0", - "@typescript-eslint/parser": "^7.18.0", - "eslint": "^9.9.1", - "eslint-config-prettier": "^9.1.0", - "eslint-plugin-import": "^2.29.1", - "eslint-plugin-prettier": "^5.2.1", - "eslint-plugin-sort-keys-fix": "^1.1.2", - "eslint-plugin-typescript-sort-keys": "^3.2.0", - "eslint-plugin-unused-imports": "^4.1.3", "globals": "^15.9.0", "nodemon": "^3.1.4", - "prettier": "^3.3.3", "ts-node": "^10.9.2", - "typescript": "^5.5.4", - "typescript-eslint": "^7.18.0" + "typescript": "^5.5.4" }, "dependencies": { "cron": "^3.1.7", diff --git a/yarn.lock b/yarn.lock index cc1b918..1f4cde7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5,6 +5,97 @@ __metadata: version: 8 cacheKey: 10c0 +"@biomejs/biome@npm:1.9.2": + version: 1.9.2 + resolution: "@biomejs/biome@npm:1.9.2" + dependencies: + "@biomejs/cli-darwin-arm64": "npm:1.9.2" + "@biomejs/cli-darwin-x64": "npm:1.9.2" + "@biomejs/cli-linux-arm64": "npm:1.9.2" + "@biomejs/cli-linux-arm64-musl": "npm:1.9.2" + "@biomejs/cli-linux-x64": "npm:1.9.2" + "@biomejs/cli-linux-x64-musl": "npm:1.9.2" + "@biomejs/cli-win32-arm64": "npm:1.9.2" + "@biomejs/cli-win32-x64": "npm:1.9.2" + dependenciesMeta: + "@biomejs/cli-darwin-arm64": + optional: true + "@biomejs/cli-darwin-x64": + optional: true + "@biomejs/cli-linux-arm64": + optional: true + "@biomejs/cli-linux-arm64-musl": + optional: true + "@biomejs/cli-linux-x64": + optional: true + "@biomejs/cli-linux-x64-musl": + optional: true + "@biomejs/cli-win32-arm64": + optional: true + "@biomejs/cli-win32-x64": + optional: true + bin: + biome: bin/biome + checksum: 10c0/0addf6a387112ba950693ae0b782db93f307300de111a46902c745c25baab5aaf1a3558be830f373e4f034d45eaa011b6bccfdc1e18d26f733136c32dffd83f9 + languageName: node + linkType: hard + +"@biomejs/cli-darwin-arm64@npm:1.9.2": + version: 1.9.2 + resolution: "@biomejs/cli-darwin-arm64@npm:1.9.2" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@biomejs/cli-darwin-x64@npm:1.9.2": + version: 1.9.2 + resolution: "@biomejs/cli-darwin-x64@npm:1.9.2" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@biomejs/cli-linux-arm64-musl@npm:1.9.2": + version: 1.9.2 + resolution: "@biomejs/cli-linux-arm64-musl@npm:1.9.2" + conditions: os=linux & cpu=arm64 & libc=musl + languageName: node + linkType: hard + +"@biomejs/cli-linux-arm64@npm:1.9.2": + version: 1.9.2 + resolution: "@biomejs/cli-linux-arm64@npm:1.9.2" + conditions: os=linux & cpu=arm64 & libc=glibc + languageName: node + linkType: hard + +"@biomejs/cli-linux-x64-musl@npm:1.9.2": + version: 1.9.2 + resolution: "@biomejs/cli-linux-x64-musl@npm:1.9.2" + conditions: os=linux & cpu=x64 & libc=musl + languageName: node + linkType: hard + +"@biomejs/cli-linux-x64@npm:1.9.2": + version: 1.9.2 + resolution: "@biomejs/cli-linux-x64@npm:1.9.2" + conditions: os=linux & cpu=x64 & libc=glibc + languageName: node + linkType: hard + +"@biomejs/cli-win32-arm64@npm:1.9.2": + version: 1.9.2 + resolution: "@biomejs/cli-win32-arm64@npm:1.9.2" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@biomejs/cli-win32-x64@npm:1.9.2": + version: 1.9.2 + resolution: "@biomejs/cli-win32-x64@npm:1.9.2" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + "@cspotcode/source-map-support@npm:^0.8.0": version: 0.8.1 resolution: "@cspotcode/source-map-support@npm:0.8.1" @@ -14,18 +105,18 @@ __metadata: languageName: node linkType: hard -"@discordjs/builders@npm:^1.8.2": - version: 1.8.2 - resolution: "@discordjs/builders@npm:1.8.2" +"@discordjs/builders@npm:^1.9.0": + version: 1.9.0 + resolution: "@discordjs/builders@npm:1.9.0" dependencies: - "@discordjs/formatters": "npm:^0.4.0" - "@discordjs/util": "npm:^1.1.0" - "@sapphire/shapeshift": "npm:^3.9.7" - discord-api-types: "npm:0.37.83" + "@discordjs/formatters": "npm:^0.5.0" + "@discordjs/util": "npm:^1.1.1" + "@sapphire/shapeshift": "npm:^4.0.0" + discord-api-types: "npm:0.37.97" fast-deep-equal: "npm:^3.1.3" ts-mixer: "npm:^6.0.4" - tslib: "npm:^2.6.2" - checksum: 10c0/108fe8903e9bc875a28b39629589391e44f41835169114e93c15548b5635632862168d4bec3392eac12e981d06b830d90f11b7af38fd664d7ea9cfa46b0726f3 + tslib: "npm:^2.6.3" + checksum: 10c0/3287b87624c11112faeac0acc0063427dd85f4174ca7b2c3bbd0f77feab99e97193e5d6e6fb5989000eb50aff67d2831af3fc6cdf2907a05ac23a475f5b65ab6 languageName: node linkType: hard @@ -36,47 +127,47 @@ __metadata: languageName: node linkType: hard -"@discordjs/collection@npm:^2.1.0": - version: 2.1.0 - resolution: "@discordjs/collection@npm:2.1.0" - checksum: 10c0/537df017962d4b98a35768db0d47e457a3f64daf550921368f98d3fbd66358d76f00ce01eac61163841b353747e702d1e1ea8badfdc2fb5a412eae7e84b1c607 +"@discordjs/collection@npm:^2.1.0, @discordjs/collection@npm:^2.1.1": + version: 2.1.1 + resolution: "@discordjs/collection@npm:2.1.1" + checksum: 10c0/7bbb007271a046c981957b4a0543f6ca7e4c294a2d40987437ff06db5e92dbf35b8dc61719db2a7bc99557a58275742aa34be9f50487870a6e80acfc4fe45fa1 languageName: node linkType: hard -"@discordjs/formatters@npm:^0.4.0": - version: 0.4.0 - resolution: "@discordjs/formatters@npm:0.4.0" +"@discordjs/formatters@npm:^0.5.0": + version: 0.5.0 + resolution: "@discordjs/formatters@npm:0.5.0" dependencies: - discord-api-types: "npm:0.37.83" - checksum: 10c0/9788e00559155f1767f85d02f14b0368affd4b7b86c1ff2207779906093ad9caf86cd74a60e681da5e762234b45fc9368c044247a484b4691cd652d5ff0d4f70 + discord-api-types: "npm:0.37.97" + checksum: 10c0/784e7a7cb82874eb3d5741c8058088accdc6151151d5dbafa634efdb184e0f5666a95e57ac8f6e514b2819b07f764dbb1d4258c0dbba37fc5645f800182ae1d9 languageName: node linkType: hard -"@discordjs/rest@npm:^2.3.0": - version: 2.3.0 - resolution: "@discordjs/rest@npm:2.3.0" +"@discordjs/rest@npm:^2.3.0, @discordjs/rest@npm:^2.4.0": + version: 2.4.0 + resolution: "@discordjs/rest@npm:2.4.0" dependencies: - "@discordjs/collection": "npm:^2.1.0" - "@discordjs/util": "npm:^1.1.0" - "@sapphire/async-queue": "npm:^1.5.2" + "@discordjs/collection": "npm:^2.1.1" + "@discordjs/util": "npm:^1.1.1" + "@sapphire/async-queue": "npm:^1.5.3" "@sapphire/snowflake": "npm:^3.5.3" - "@vladfrangu/async_event_emitter": "npm:^2.2.4" - discord-api-types: "npm:0.37.83" + "@vladfrangu/async_event_emitter": "npm:^2.4.6" + discord-api-types: "npm:0.37.97" magic-bytes.js: "npm:^1.10.0" - tslib: "npm:^2.6.2" - undici: "npm:6.13.0" - checksum: 10c0/f971c16f4095fd9f092d8d73dfed788341823bc06901b5b6b3b15a65697dc6bff4cc6ade93bedc2c2a6e01d39dae8bac9ebbed59a3a336fdbf2d81a4e63d2581 + tslib: "npm:^2.6.3" + undici: "npm:6.19.8" + checksum: 10c0/2de35ff6c0ad734685e329fc29df52823faf6e9eb68045b780f5b657555c699da7e9e0ffdf2ab1ee7ef902d7a8901993b6ea6e0f3c85938570a2b74e15207c0a languageName: node linkType: hard -"@discordjs/util@npm:^1.1.0": - version: 1.1.0 - resolution: "@discordjs/util@npm:1.1.0" - checksum: 10c0/e4a7945b17eb86b3fa5bf49e49e0d0786c8f39e66bbeee19f01db4e817cf5a4761e684ec63a7d832722648d0e23236eeb21c450c34a11683102813a23701bda4 +"@discordjs/util@npm:^1.1.0, @discordjs/util@npm:^1.1.1": + version: 1.1.1 + resolution: "@discordjs/util@npm:1.1.1" + checksum: 10c0/a374648aae0dd98345996f41891add0523388297a6f6b99c7a37c83de4d832d91a464195502126967fac0f071e5ecb80f776ee42a887fffa9c5c0f4612381b98 languageName: node linkType: hard -"@discordjs/ws@npm:^1.1.1": +"@discordjs/ws@npm:1.1.1": version: 1.1.1 resolution: "@discordjs/ws@npm:1.1.1" dependencies: @@ -93,73 +184,6 @@ __metadata: languageName: node linkType: hard -"@eslint-community/eslint-utils@npm:^4.2.0, @eslint-community/eslint-utils@npm:^4.4.0": - version: 4.4.0 - resolution: "@eslint-community/eslint-utils@npm:4.4.0" - dependencies: - eslint-visitor-keys: "npm:^3.3.0" - peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 - checksum: 10c0/7e559c4ce59cd3a06b1b5a517b593912e680a7f981ae7affab0d01d709e99cd5647019be8fafa38c350305bc32f1f7d42c7073edde2ab536c745e365f37b607e - languageName: node - linkType: hard - -"@eslint-community/regexpp@npm:^4.10.0": - version: 4.10.1 - resolution: "@eslint-community/regexpp@npm:4.10.1" - checksum: 10c0/f59376025d0c91dd9fdf18d33941df499292a3ecba3e9889c360f3f6590197d30755604588786cdca0f9030be315a26b206014af4b65c0ff85b4ec49043de780 - languageName: node - linkType: hard - -"@eslint-community/regexpp@npm:^4.11.0": - version: 4.11.0 - resolution: "@eslint-community/regexpp@npm:4.11.0" - checksum: 10c0/0f6328869b2741e2794da4ad80beac55cba7de2d3b44f796a60955b0586212ec75e6b0253291fd4aad2100ad471d1480d8895f2b54f1605439ba4c875e05e523 - languageName: node - linkType: hard - -"@eslint/config-array@npm:^0.18.0": - version: 0.18.0 - resolution: "@eslint/config-array@npm:0.18.0" - dependencies: - "@eslint/object-schema": "npm:^2.1.4" - debug: "npm:^4.3.1" - minimatch: "npm:^3.1.2" - checksum: 10c0/0234aeb3e6b052ad2402a647d0b4f8a6aa71524bafe1adad0b8db1dfe94d7f5f26d67c80f79bb37ac61361a1d4b14bb8fb475efe501de37263cf55eabb79868f - languageName: node - linkType: hard - -"@eslint/eslintrc@npm:^3.1.0": - version: 3.1.0 - resolution: "@eslint/eslintrc@npm:3.1.0" - dependencies: - ajv: "npm:^6.12.4" - debug: "npm:^4.3.2" - espree: "npm:^10.0.1" - globals: "npm:^14.0.0" - ignore: "npm:^5.2.0" - import-fresh: "npm:^3.2.1" - js-yaml: "npm:^4.1.0" - minimatch: "npm:^3.1.2" - strip-json-comments: "npm:^3.1.1" - checksum: 10c0/5b7332ed781edcfc98caa8dedbbb843abfb9bda2e86538529c843473f580e40c69eb894410eddc6702f487e9ee8f8cfa8df83213d43a8fdb549f23ce06699167 - languageName: node - linkType: hard - -"@eslint/js@npm:9.9.1, @eslint/js@npm:^9.9.1": - version: 9.9.1 - resolution: "@eslint/js@npm:9.9.1" - checksum: 10c0/a3a91de2ce78469f7c4eee78c1eba77360706e1d0fa0ace2e19102079bcf237b851217c85ea501dc92c4c3719d60d9df966977abc8554d4c38e3638c1f53dcb2 - languageName: node - linkType: hard - -"@eslint/object-schema@npm:^2.1.4": - version: 2.1.4 - resolution: "@eslint/object-schema@npm:2.1.4" - checksum: 10c0/e9885532ea70e483fb007bf1275968b05bb15ebaa506d98560c41a41220d33d342e19023d5f2939fed6eb59676c1bda5c847c284b4b55fce521d282004da4dda - languageName: node - linkType: hard - "@fastify/busboy@npm:^3.0.0": version: 3.0.0 resolution: "@fastify/busboy@npm:3.0.0" @@ -167,18 +191,18 @@ __metadata: languageName: node linkType: hard -"@firebase/analytics-compat@npm:0.2.13": - version: 0.2.13 - resolution: "@firebase/analytics-compat@npm:0.2.13" +"@firebase/analytics-compat@npm:0.2.14": + version: 0.2.14 + resolution: "@firebase/analytics-compat@npm:0.2.14" dependencies: - "@firebase/analytics": "npm:0.10.7" + "@firebase/analytics": "npm:0.10.8" "@firebase/analytics-types": "npm:0.8.2" - "@firebase/component": "npm:0.6.8" - "@firebase/util": "npm:1.9.7" + "@firebase/component": "npm:0.6.9" + "@firebase/util": "npm:1.10.0" tslib: "npm:^2.1.0" peerDependencies: "@firebase/app-compat": 0.x - checksum: 10c0/7d7b57b1800f69c3b58ccbe96112cb7b350b3673e52e8090fc5c25287fbb3e520a8a5c9db8822d2014dcf4e6feb8f6cf68fa1dd43b1226e81bf8c755c175e4af + checksum: 10c0/d63982fb8d423968b61240f00771fd96858b269f11ccbdd05887c1d1c03356df4aff854070fad2934b49819a4a78ec0b1f81eddec1e341f0e3f78127f9d1d646 languageName: node linkType: hard @@ -189,34 +213,34 @@ __metadata: languageName: node linkType: hard -"@firebase/analytics@npm:0.10.7": - version: 0.10.7 - resolution: "@firebase/analytics@npm:0.10.7" +"@firebase/analytics@npm:0.10.8": + version: 0.10.8 + resolution: "@firebase/analytics@npm:0.10.8" dependencies: - "@firebase/component": "npm:0.6.8" - "@firebase/installations": "npm:0.6.8" + "@firebase/component": "npm:0.6.9" + "@firebase/installations": "npm:0.6.9" "@firebase/logger": "npm:0.4.2" - "@firebase/util": "npm:1.9.7" + "@firebase/util": "npm:1.10.0" tslib: "npm:^2.1.0" peerDependencies: "@firebase/app": 0.x - checksum: 10c0/97713ee4ac50f1920d3c79990356a3b0f903cf6867e605054e6489eccb3354d7f923dc5626c0f577a60897dbf25a510f6ec40b8d74ba35f5d79efb59062e0d7c + checksum: 10c0/0ad50a59a2e8aa4f7a3a297081e0e6ec5b78b4180f7c28822d1a722ce70a8274190089104b62febae9dbfa9bd2f17e7c22e6417d5ef9b0319ce4dcc3d6f18946 languageName: node linkType: hard -"@firebase/app-check-compat@npm:0.3.14": - version: 0.3.14 - resolution: "@firebase/app-check-compat@npm:0.3.14" +"@firebase/app-check-compat@npm:0.3.15": + version: 0.3.15 + resolution: "@firebase/app-check-compat@npm:0.3.15" dependencies: - "@firebase/app-check": "npm:0.8.7" + "@firebase/app-check": "npm:0.8.8" "@firebase/app-check-types": "npm:0.5.2" - "@firebase/component": "npm:0.6.8" + "@firebase/component": "npm:0.6.9" "@firebase/logger": "npm:0.4.2" - "@firebase/util": "npm:1.9.7" + "@firebase/util": "npm:1.10.0" tslib: "npm:^2.1.0" peerDependencies: "@firebase/app-compat": 0.x - checksum: 10c0/f1d58e541bc24a39f58f882f16ac0135756c2b860980a9db391ebea20e8bd7c595657c1cb87289c26e92d47d8a7b68142b723feb96614282b289888e8dfda562 + checksum: 10c0/590b7af980c9efd852c671a232fed666e4502e13754e85ad58a85a4651882486089cb5d8b4bb6be79bb648d3b66524b71965565a68f2757e2cbd93daf37b4bcf languageName: node linkType: hard @@ -234,30 +258,30 @@ __metadata: languageName: node linkType: hard -"@firebase/app-check@npm:0.8.7": - version: 0.8.7 - resolution: "@firebase/app-check@npm:0.8.7" +"@firebase/app-check@npm:0.8.8": + version: 0.8.8 + resolution: "@firebase/app-check@npm:0.8.8" dependencies: - "@firebase/component": "npm:0.6.8" + "@firebase/component": "npm:0.6.9" "@firebase/logger": "npm:0.4.2" - "@firebase/util": "npm:1.9.7" + "@firebase/util": "npm:1.10.0" tslib: "npm:^2.1.0" peerDependencies: "@firebase/app": 0.x - checksum: 10c0/289247c7e03da48fa53b8baf1427f7b74b4212e0637ec148783acd4bc0ff80d2c8fbee7d08bd6f2e5aecdc64c121927e6163ab51b257c9622b5849549825539d + checksum: 10c0/1d083e4b8cefc04a068ec5996c201fa2179e4315142a832c777558e6d44fa224d67cdbd9ac90086cca2c222fa6316168fa15c720b81672bafa2d722e48e1035a languageName: node linkType: hard -"@firebase/app-compat@npm:0.2.40": - version: 0.2.40 - resolution: "@firebase/app-compat@npm:0.2.40" +"@firebase/app-compat@npm:0.2.42": + version: 0.2.42 + resolution: "@firebase/app-compat@npm:0.2.42" dependencies: - "@firebase/app": "npm:0.10.10" - "@firebase/component": "npm:0.6.8" + "@firebase/app": "npm:0.10.12" + "@firebase/component": "npm:0.6.9" "@firebase/logger": "npm:0.4.2" - "@firebase/util": "npm:1.9.7" + "@firebase/util": "npm:1.10.0" tslib: "npm:^2.1.0" - checksum: 10c0/a56636fa939a637e2d2418e6dcfca2d7538722598026160723fee8102a7e731b101032995f723ec3333c0fef6d55e283b6fe96b9e55b4e4eb84f06c839f3db50 + checksum: 10c0/d1cc6378119cafffed4143ec359967cc28713ff99cff6e38adb163adc1921b29f6841ea1fed5f03d0e5900804a103fb59192573e433c418f7dc82035f10c55ce languageName: node linkType: hard @@ -268,32 +292,32 @@ __metadata: languageName: node linkType: hard -"@firebase/app@npm:0.10.10": - version: 0.10.10 - resolution: "@firebase/app@npm:0.10.10" +"@firebase/app@npm:0.10.12": + version: 0.10.12 + resolution: "@firebase/app@npm:0.10.12" dependencies: - "@firebase/component": "npm:0.6.8" + "@firebase/component": "npm:0.6.9" "@firebase/logger": "npm:0.4.2" - "@firebase/util": "npm:1.9.7" + "@firebase/util": "npm:1.10.0" idb: "npm:7.1.1" tslib: "npm:^2.1.0" - checksum: 10c0/edcbdcae5852e5cbbfa169398ff757bdf595ebff3a06cc6740f316bdd7c0e4b5e5fc5b8497df62aa730055c99a8873ed8b5be51caa2705291f229d0ee9cec3e6 + checksum: 10c0/ec37facf98d787a306f9a58bcca0678cf990e63b618cd2344cce2a2141a95fbe2171ee070a667ffa6c0965b7eadee21424908cd83544b08d1342571ebc54d836 languageName: node linkType: hard -"@firebase/auth-compat@npm:0.5.13": - version: 0.5.13 - resolution: "@firebase/auth-compat@npm:0.5.13" +"@firebase/auth-compat@npm:0.5.14": + version: 0.5.14 + resolution: "@firebase/auth-compat@npm:0.5.14" dependencies: - "@firebase/auth": "npm:1.7.8" + "@firebase/auth": "npm:1.7.9" "@firebase/auth-types": "npm:0.12.2" - "@firebase/component": "npm:0.6.8" - "@firebase/util": "npm:1.9.7" + "@firebase/component": "npm:0.6.9" + "@firebase/util": "npm:1.10.0" tslib: "npm:^2.1.0" undici: "npm:6.19.7" peerDependencies: "@firebase/app-compat": 0.x - checksum: 10c0/ad207d97d3e091c2364de8f99dfeb3bfd77e2268555b14f868b7b155addb962171737d8d2ee45f6d27e952632ee954b7b633e5fcaf9b45145919ae81407cff8a + checksum: 10c0/09fdd896fd39b34a7364ac2a75979ba99091afda9472730ff4911c84382d7b719b5ee8b26c92cca80a7b2aa60dc26fe0dfb46423c961552b5fc660a01ef1e465 languageName: node linkType: hard @@ -314,13 +338,13 @@ __metadata: languageName: node linkType: hard -"@firebase/auth@npm:1.7.8": - version: 1.7.8 - resolution: "@firebase/auth@npm:1.7.8" +"@firebase/auth@npm:1.7.9": + version: 1.7.9 + resolution: "@firebase/auth@npm:1.7.9" dependencies: - "@firebase/component": "npm:0.6.8" + "@firebase/component": "npm:0.6.9" "@firebase/logger": "npm:0.4.2" - "@firebase/util": "npm:1.9.7" + "@firebase/util": "npm:1.10.0" tslib: "npm:^2.1.0" undici: "npm:6.19.7" peerDependencies: @@ -329,120 +353,86 @@ __metadata: peerDependenciesMeta: "@react-native-async-storage/async-storage": optional: true - checksum: 10c0/2d5a8f54994271df583b6c2c02cfe295bd36c2dc4b4db8a11aef5e3435becec2a58a912bab1cc4e35ea7a094f51d34225b0edfc594fa82a2b1f18a424ec14c0f - languageName: node - linkType: hard - -"@firebase/component@npm:0.6.7": - version: 0.6.7 - resolution: "@firebase/component@npm:0.6.7" - dependencies: - "@firebase/util": "npm:1.9.6" - tslib: "npm:^2.1.0" - checksum: 10c0/d6ef646b796fc120af477c9e538ea435278d397db5312f6578ead8b712f10ababc635a33ab78225ad5f5029e1504866054b623a76990316c9cef186feb41b0d7 + checksum: 10c0/dab94919c8f695b6915b509b87bd36d97a739feb905c353779a2b7798745c391e4284d856e3682f10ee9f2953b0cacefcb682b36b02cc8857debb169abae8e61 languageName: node linkType: hard -"@firebase/component@npm:0.6.8": - version: 0.6.8 - resolution: "@firebase/component@npm:0.6.8" +"@firebase/component@npm:0.6.9": + version: 0.6.9 + resolution: "@firebase/component@npm:0.6.9" dependencies: - "@firebase/util": "npm:1.9.7" + "@firebase/util": "npm:1.10.0" tslib: "npm:^2.1.0" - checksum: 10c0/943aca2e59fe16b9f62e2fb45fc708c7497268ca6cfb19b916e3c88b74ce168a305a8b4480594d4e00cc23a7b5775bddd24cb8b34243df039a7799904b6fae49 + checksum: 10c0/609dd193000dd9bdd12d820fbf2653d693e9aa2f768aa7817573e4f349b83ae4aa3b80ccd13b5cde4fb6bdf924a283a33ba0b608896bf6112db9265607202d28 languageName: node linkType: hard -"@firebase/database-compat@npm:1.0.7": - version: 1.0.7 - resolution: "@firebase/database-compat@npm:1.0.7" +"@firebase/data-connect@npm:0.1.0": + version: 0.1.0 + resolution: "@firebase/data-connect@npm:0.1.0" dependencies: - "@firebase/component": "npm:0.6.8" - "@firebase/database": "npm:1.0.7" - "@firebase/database-types": "npm:1.0.4" + "@firebase/auth-interop-types": "npm:0.2.3" + "@firebase/component": "npm:0.6.9" "@firebase/logger": "npm:0.4.2" - "@firebase/util": "npm:1.9.7" + "@firebase/util": "npm:1.10.0" tslib: "npm:^2.1.0" - checksum: 10c0/74c698d8e9e0a2659cbea3335dd6a70a69b9233329993b4973ea20b1f53509e9c29c23682ed5a11b8e91a707134c10740cd41c3da2f15e7eda5d18cb365e8940 + peerDependencies: + "@firebase/app": 0.x + checksum: 10c0/f32bb7508ce3cdc4d9f3825c67acf2cb2e3be74c428fb802f81febbd38d3b38e72ebb9252630f23ba46af954e7cc5013f8e79109a96d24dc9b59f57cdeaf13fb languageName: node linkType: hard -"@firebase/database-compat@npm:^1.0.2": - version: 1.0.5 - resolution: "@firebase/database-compat@npm:1.0.5" +"@firebase/database-compat@npm:1.0.8, @firebase/database-compat@npm:^1.0.2": + version: 1.0.8 + resolution: "@firebase/database-compat@npm:1.0.8" dependencies: - "@firebase/component": "npm:0.6.7" - "@firebase/database": "npm:1.0.5" - "@firebase/database-types": "npm:1.0.3" + "@firebase/component": "npm:0.6.9" + "@firebase/database": "npm:1.0.8" + "@firebase/database-types": "npm:1.0.5" "@firebase/logger": "npm:0.4.2" - "@firebase/util": "npm:1.9.6" + "@firebase/util": "npm:1.10.0" tslib: "npm:^2.1.0" - checksum: 10c0/5539dc52cbf67624aaa6d93f5d97b74f442d1ff5ba4fa08bec05eabfe566918d0a24a59ada7f69cb4cc6929a7c481f5000dc734bccaad7d263bc0a0af40d9bab - languageName: node - linkType: hard - -"@firebase/database-types@npm:1.0.3, @firebase/database-types@npm:^1.0.0": - version: 1.0.3 - resolution: "@firebase/database-types@npm:1.0.3" - dependencies: - "@firebase/app-types": "npm:0.9.2" - "@firebase/util": "npm:1.9.6" - checksum: 10c0/da37b0f4601ea0d2a17841b186a1ec12abbc0151cd978caca42f529cd948566e4f6d809c88f5856760de43449d8e1ade7091f9afc637f6d9e132f73787e92263 - languageName: node - linkType: hard - -"@firebase/database-types@npm:1.0.4": - version: 1.0.4 - resolution: "@firebase/database-types@npm:1.0.4" - dependencies: - "@firebase/app-types": "npm:0.9.2" - "@firebase/util": "npm:1.9.7" - checksum: 10c0/4211ad551df20193c05aa4848f103a3548e009e23be8c19d098c1653d747d996b0e17d7ab081bc7dc06394c897f30e5bfef7558a0ba21ebb709967374f9b3663 + checksum: 10c0/34456da205dc0376601cef43ac1eb22b9bddac0555ccde14d759e0737b041bad6b996335f824543e4d782e9440893ae9c09e28be2c26c6afc6dbbfedd2c3eb84 languageName: node linkType: hard -"@firebase/database@npm:1.0.5": +"@firebase/database-types@npm:1.0.5, @firebase/database-types@npm:^1.0.0": version: 1.0.5 - resolution: "@firebase/database@npm:1.0.5" + resolution: "@firebase/database-types@npm:1.0.5" dependencies: - "@firebase/app-check-interop-types": "npm:0.3.2" - "@firebase/auth-interop-types": "npm:0.2.3" - "@firebase/component": "npm:0.6.7" - "@firebase/logger": "npm:0.4.2" - "@firebase/util": "npm:1.9.6" - faye-websocket: "npm:0.11.4" - tslib: "npm:^2.1.0" - checksum: 10c0/96ffe13f14801672fa0d286ede3adcb7ccd506273e32aacb3bf9aba2626632d65cdff99e87cb1744c1a0f0898a85cf31e6dada8f51400add42728fbfcd00a6f5 + "@firebase/app-types": "npm:0.9.2" + "@firebase/util": "npm:1.10.0" + checksum: 10c0/64067fd5f11117898ec499bd63b04e13e0a3ef08c82d10873c112ef86be503152d0848f996d6f3f178392a141f20206d7cadb8e3163fd7ffaf7221c132d0f7a2 languageName: node linkType: hard -"@firebase/database@npm:1.0.7": - version: 1.0.7 - resolution: "@firebase/database@npm:1.0.7" +"@firebase/database@npm:1.0.8": + version: 1.0.8 + resolution: "@firebase/database@npm:1.0.8" dependencies: "@firebase/app-check-interop-types": "npm:0.3.2" "@firebase/auth-interop-types": "npm:0.2.3" - "@firebase/component": "npm:0.6.8" + "@firebase/component": "npm:0.6.9" "@firebase/logger": "npm:0.4.2" - "@firebase/util": "npm:1.9.7" + "@firebase/util": "npm:1.10.0" faye-websocket: "npm:0.11.4" tslib: "npm:^2.1.0" - checksum: 10c0/58a4550299ab95ab866c9ce9634468b14b7ed1accec9d07ed37aeb6e34657546eba32e28007672ea0cd24a480b4e7cad97f4d73832825b6ee5435346a50d56d3 + checksum: 10c0/dac0f0d1836cdd1ccc4785bdf35a1cc35a00d35c5c3d21dd87afccd1873f10ed56a606c72de07dbc93600115cd5a94686fbcf169e34ee9ae19a184469c110810 languageName: node linkType: hard -"@firebase/firestore-compat@npm:0.3.36": - version: 0.3.36 - resolution: "@firebase/firestore-compat@npm:0.3.36" +"@firebase/firestore-compat@npm:0.3.38": + version: 0.3.38 + resolution: "@firebase/firestore-compat@npm:0.3.38" dependencies: - "@firebase/component": "npm:0.6.8" - "@firebase/firestore": "npm:4.7.1" + "@firebase/component": "npm:0.6.9" + "@firebase/firestore": "npm:4.7.3" "@firebase/firestore-types": "npm:3.0.2" - "@firebase/util": "npm:1.9.7" + "@firebase/util": "npm:1.10.0" tslib: "npm:^2.1.0" peerDependencies: "@firebase/app-compat": 0.x - checksum: 10c0/12a315c026dd478d412c13c0be5d033046c11cc66772ade459f80009ae950c8623383b05280bf24dfc2c5907203a86883899ed1f7ab845952f20ea788cb6083f + checksum: 10c0/0031df5086304e55f077424da557b218741f8f35897e032186d5b8c0044f0dbeeafba9fb6ef5002c07501106f2f10aabaccbe1452d3c58e461c188c88f6e722d languageName: node linkType: hard @@ -456,13 +446,13 @@ __metadata: languageName: node linkType: hard -"@firebase/firestore@npm:4.7.1": - version: 4.7.1 - resolution: "@firebase/firestore@npm:4.7.1" +"@firebase/firestore@npm:4.7.3": + version: 4.7.3 + resolution: "@firebase/firestore@npm:4.7.3" dependencies: - "@firebase/component": "npm:0.6.8" + "@firebase/component": "npm:0.6.9" "@firebase/logger": "npm:0.4.2" - "@firebase/util": "npm:1.9.7" + "@firebase/util": "npm:1.10.0" "@firebase/webchannel-wrapper": "npm:1.0.1" "@grpc/grpc-js": "npm:~1.9.0" "@grpc/proto-loader": "npm:^0.7.8" @@ -470,22 +460,22 @@ __metadata: undici: "npm:6.19.7" peerDependencies: "@firebase/app": 0.x - checksum: 10c0/649b8a2c89ab96c247e877ebe4b8ae5664db927346c32b236e6e49b127cdc7c320a34e1fd3fce7457725d61e14d62f98b24f3715acda7e5ad974eca47fdd2808 + checksum: 10c0/689aab3b50af01a7c8a3a6fc87f04835fe67e971040d082380452f31ba2e5acad891876ec3ab4c4207381c01d92329773365080b4ffd308831e4b4e53393b025 languageName: node linkType: hard -"@firebase/functions-compat@npm:0.3.13": - version: 0.3.13 - resolution: "@firebase/functions-compat@npm:0.3.13" +"@firebase/functions-compat@npm:0.3.14": + version: 0.3.14 + resolution: "@firebase/functions-compat@npm:0.3.14" dependencies: - "@firebase/component": "npm:0.6.8" - "@firebase/functions": "npm:0.11.7" + "@firebase/component": "npm:0.6.9" + "@firebase/functions": "npm:0.11.8" "@firebase/functions-types": "npm:0.6.2" - "@firebase/util": "npm:1.9.7" + "@firebase/util": "npm:1.10.0" tslib: "npm:^2.1.0" peerDependencies: "@firebase/app-compat": 0.x - checksum: 10c0/2a1a69a9120b480c99c862a6744e337ed94d81c4e55ac7539cf9aa38ab648720bd41197a32150e4dd89065e88ff3eccc9b6fdf3643cd5996da8472a7638d98fc + checksum: 10c0/1e2626fbf7d1d79ea4e9bf6f3b29803116e10498b1fd0334da6a8d4a47fd339b7e10db83aecf6b633e4c37ed08f43c5a1645f2679a67c0906143fef68c4180bb languageName: node linkType: hard @@ -496,35 +486,35 @@ __metadata: languageName: node linkType: hard -"@firebase/functions@npm:0.11.7": - version: 0.11.7 - resolution: "@firebase/functions@npm:0.11.7" +"@firebase/functions@npm:0.11.8": + version: 0.11.8 + resolution: "@firebase/functions@npm:0.11.8" dependencies: "@firebase/app-check-interop-types": "npm:0.3.2" "@firebase/auth-interop-types": "npm:0.2.3" - "@firebase/component": "npm:0.6.8" + "@firebase/component": "npm:0.6.9" "@firebase/messaging-interop-types": "npm:0.2.2" - "@firebase/util": "npm:1.9.7" + "@firebase/util": "npm:1.10.0" tslib: "npm:^2.1.0" undici: "npm:6.19.7" peerDependencies: "@firebase/app": 0.x - checksum: 10c0/8eb026ef8c87a0195eb73cb981e7857a269a04c3ce137d13bb4ebd967f3fd71af273222c82d70370a17cd2e421bf338c98a31db5c49cb57ffc6a66e8afae79e5 + checksum: 10c0/4e6eadb2a94b6fd2ed208fcc8dc29810b660a8834641bb9990d8010859ac2f5cfe8ff32f6b2616ab26012d017a7a70a49bc6c1a1c4992c4f6a0f1a956ca4b8b5 languageName: node linkType: hard -"@firebase/installations-compat@npm:0.2.8": - version: 0.2.8 - resolution: "@firebase/installations-compat@npm:0.2.8" +"@firebase/installations-compat@npm:0.2.9": + version: 0.2.9 + resolution: "@firebase/installations-compat@npm:0.2.9" dependencies: - "@firebase/component": "npm:0.6.8" - "@firebase/installations": "npm:0.6.8" + "@firebase/component": "npm:0.6.9" + "@firebase/installations": "npm:0.6.9" "@firebase/installations-types": "npm:0.5.2" - "@firebase/util": "npm:1.9.7" + "@firebase/util": "npm:1.10.0" tslib: "npm:^2.1.0" peerDependencies: "@firebase/app-compat": 0.x - checksum: 10c0/05eed2e2543b3e70a5cf080f408cd735dfa0f75391873cb04b879a668bc50e705c17f12dfc5753ab2d4113c49a9ddae5b8a93845d58f25cfd58ce1550e7a0785 + checksum: 10c0/c86329a04e055db3755d8ae501e7a7720c975c12aaa963083e90096901831c42bd746e4322de674d0fbf7a6e92381a314e73e85b5500083ab52cb0a8b3ff68ce languageName: node linkType: hard @@ -537,17 +527,17 @@ __metadata: languageName: node linkType: hard -"@firebase/installations@npm:0.6.8": - version: 0.6.8 - resolution: "@firebase/installations@npm:0.6.8" +"@firebase/installations@npm:0.6.9": + version: 0.6.9 + resolution: "@firebase/installations@npm:0.6.9" dependencies: - "@firebase/component": "npm:0.6.8" - "@firebase/util": "npm:1.9.7" + "@firebase/component": "npm:0.6.9" + "@firebase/util": "npm:1.10.0" idb: "npm:7.1.1" tslib: "npm:^2.1.0" peerDependencies: "@firebase/app": 0.x - checksum: 10c0/8a62c8905ea1df581c9cbdedf7d0224feee91271e5857fef1d58ef323aa3bdf6e67d7efc09893a56dfd34687d5bac7b0903cce2f1f419508540b4d394ae471b6 + checksum: 10c0/fafae83f93ad697e4da18c947605edb5debe68bc80737697e15c25681a17d0be04c743fcfd18358e3e467ff3e7260b7285e6854c5e998953e881383ceb70fe22 languageName: node linkType: hard @@ -560,17 +550,17 @@ __metadata: languageName: node linkType: hard -"@firebase/messaging-compat@npm:0.2.10": - version: 0.2.10 - resolution: "@firebase/messaging-compat@npm:0.2.10" +"@firebase/messaging-compat@npm:0.2.11": + version: 0.2.11 + resolution: "@firebase/messaging-compat@npm:0.2.11" dependencies: - "@firebase/component": "npm:0.6.8" - "@firebase/messaging": "npm:0.12.10" - "@firebase/util": "npm:1.9.7" + "@firebase/component": "npm:0.6.9" + "@firebase/messaging": "npm:0.12.11" + "@firebase/util": "npm:1.10.0" tslib: "npm:^2.1.0" peerDependencies: "@firebase/app-compat": 0.x - checksum: 10c0/a391a9f69cc6aa80704eddb4211247c9d7e831df4cf12401fa2624b5bf8f758228387f4fac6eb018f387fc5cd5abb6c0fe97f86486d8357f7e1886a4f57c1ff7 + checksum: 10c0/c78a548bfa911f391990ff0f77336094dc1259da8a6f6e839719950410739a7ff9fe541bd72ef689a8ed9f2cc595dd41c289444e0876e119741b0a3c582985e7 languageName: node linkType: hard @@ -581,35 +571,35 @@ __metadata: languageName: node linkType: hard -"@firebase/messaging@npm:0.12.10": - version: 0.12.10 - resolution: "@firebase/messaging@npm:0.12.10" +"@firebase/messaging@npm:0.12.11": + version: 0.12.11 + resolution: "@firebase/messaging@npm:0.12.11" dependencies: - "@firebase/component": "npm:0.6.8" - "@firebase/installations": "npm:0.6.8" + "@firebase/component": "npm:0.6.9" + "@firebase/installations": "npm:0.6.9" "@firebase/messaging-interop-types": "npm:0.2.2" - "@firebase/util": "npm:1.9.7" + "@firebase/util": "npm:1.10.0" idb: "npm:7.1.1" tslib: "npm:^2.1.0" peerDependencies: "@firebase/app": 0.x - checksum: 10c0/9c1ad173d506aba0b1e0b577f48c8391bc0dcb1a92ce68ad90cb27cc46b9bf17e70044730bd04b53208e7f2987d2a327ba993b6df4a2a4598846bfafc60a998e + checksum: 10c0/8e745e0ca34bd12c115755904979f18b799ffe8a6e8205c756d075c526aa5d955197d7734f9930757e6b1b8e14d60c29cc30a3d72a4d9d41acd9f35ac76301b0 languageName: node linkType: hard -"@firebase/performance-compat@npm:0.2.8": - version: 0.2.8 - resolution: "@firebase/performance-compat@npm:0.2.8" +"@firebase/performance-compat@npm:0.2.9": + version: 0.2.9 + resolution: "@firebase/performance-compat@npm:0.2.9" dependencies: - "@firebase/component": "npm:0.6.8" + "@firebase/component": "npm:0.6.9" "@firebase/logger": "npm:0.4.2" - "@firebase/performance": "npm:0.6.8" + "@firebase/performance": "npm:0.6.9" "@firebase/performance-types": "npm:0.2.2" - "@firebase/util": "npm:1.9.7" + "@firebase/util": "npm:1.10.0" tslib: "npm:^2.1.0" peerDependencies: "@firebase/app-compat": 0.x - checksum: 10c0/63636954055382389b6b34586339b96a54fcdd48125e3d0f361c85daf2012e42302c0176ba09c4726bbdb01972ae66400ea15775d9f6eb5b26fb8af4ef47e53a + checksum: 10c0/4359a27fea0d5ac1da46146cad5039d8746639d5a2099810fe162c8fa05a87e78d38a64fa1d92007914ff0858b3ddf5ba3cd461d4ce9c83e5c277c208c5a03c4 languageName: node linkType: hard @@ -620,34 +610,34 @@ __metadata: languageName: node linkType: hard -"@firebase/performance@npm:0.6.8": - version: 0.6.8 - resolution: "@firebase/performance@npm:0.6.8" +"@firebase/performance@npm:0.6.9": + version: 0.6.9 + resolution: "@firebase/performance@npm:0.6.9" dependencies: - "@firebase/component": "npm:0.6.8" - "@firebase/installations": "npm:0.6.8" + "@firebase/component": "npm:0.6.9" + "@firebase/installations": "npm:0.6.9" "@firebase/logger": "npm:0.4.2" - "@firebase/util": "npm:1.9.7" + "@firebase/util": "npm:1.10.0" tslib: "npm:^2.1.0" peerDependencies: "@firebase/app": 0.x - checksum: 10c0/1b7eedff33512aaa7cf10465f8c6802af520b1b9d4b8010a926c3e2868eee5226c53524c92bb5faef99e8b073a5ab9799265ea6259e367b272a62538eea8cfad + checksum: 10c0/ac6d37c9cb087789bb31c4afb0a202e017214e7ec2e1226260a140cd977465743817685cb7cd37e64cb1063aaf78fb119bc48e69c5c865fd5e90df9d2c5464e1 languageName: node linkType: hard -"@firebase/remote-config-compat@npm:0.2.8": - version: 0.2.8 - resolution: "@firebase/remote-config-compat@npm:0.2.8" +"@firebase/remote-config-compat@npm:0.2.9": + version: 0.2.9 + resolution: "@firebase/remote-config-compat@npm:0.2.9" dependencies: - "@firebase/component": "npm:0.6.8" + "@firebase/component": "npm:0.6.9" "@firebase/logger": "npm:0.4.2" - "@firebase/remote-config": "npm:0.4.8" + "@firebase/remote-config": "npm:0.4.9" "@firebase/remote-config-types": "npm:0.3.2" - "@firebase/util": "npm:1.9.7" + "@firebase/util": "npm:1.10.0" tslib: "npm:^2.1.0" peerDependencies: "@firebase/app-compat": 0.x - checksum: 10c0/e8a9c7ad53e9c03f262099600bb74b3a09b45986c7b539b87bbe4fe6b96c6a655e46b660d45e6039ccc1aa310cd59dc6a428b35a7ecf4ce79b50dcfb5ae00a78 + checksum: 10c0/bd5393ce8aa518262851158acaf4c2e383bd01d09a92b4f4e1d9ec7b26e463c1b0d35b843e3db375c91a8ad397fb5b51f164960ffc990ab2b51d2e5a16f7a240 languageName: node linkType: hard @@ -658,33 +648,33 @@ __metadata: languageName: node linkType: hard -"@firebase/remote-config@npm:0.4.8": - version: 0.4.8 - resolution: "@firebase/remote-config@npm:0.4.8" +"@firebase/remote-config@npm:0.4.9": + version: 0.4.9 + resolution: "@firebase/remote-config@npm:0.4.9" dependencies: - "@firebase/component": "npm:0.6.8" - "@firebase/installations": "npm:0.6.8" + "@firebase/component": "npm:0.6.9" + "@firebase/installations": "npm:0.6.9" "@firebase/logger": "npm:0.4.2" - "@firebase/util": "npm:1.9.7" + "@firebase/util": "npm:1.10.0" tslib: "npm:^2.1.0" peerDependencies: "@firebase/app": 0.x - checksum: 10c0/0ba479fdf5b23929575554b20222b1be667997e5a3f8a4e6ffeecbc9751f9a54aba8cdae80419488ecd2cd3387c6c0ec8a588da8720976bb84369e8df072f9e2 + checksum: 10c0/48c27cc86bc92e3ffc9e22758697fa788cc46d855e3117af153bc5dbdf0d66fb7400432349d0f143b0482fdbfaddadbeaa34819574efe10f4ef100fe86b5d469 languageName: node linkType: hard -"@firebase/storage-compat@npm:0.3.11": - version: 0.3.11 - resolution: "@firebase/storage-compat@npm:0.3.11" +"@firebase/storage-compat@npm:0.3.12": + version: 0.3.12 + resolution: "@firebase/storage-compat@npm:0.3.12" dependencies: - "@firebase/component": "npm:0.6.8" - "@firebase/storage": "npm:0.13.1" + "@firebase/component": "npm:0.6.9" + "@firebase/storage": "npm:0.13.2" "@firebase/storage-types": "npm:0.8.2" - "@firebase/util": "npm:1.9.7" + "@firebase/util": "npm:1.10.0" tslib: "npm:^2.1.0" peerDependencies: "@firebase/app-compat": 0.x - checksum: 10c0/2f868c6b364e573ea2fbe8dcaa7b45a7aa5cc2349651c37c89aaa08015dc86d1ebb90e3c8d0289471ff4957510ae3868ffba40f30629d1b5c0d032ddb0edde7d + checksum: 10c0/7fd4febb0e48eed42b46913b0433eb7befc6c33a97b3efe23209c0ed8add600ed8626a91722a36fbc59cdd36206fecd0043e7169fd6ca07c5c123dceb6510058 languageName: node linkType: hard @@ -698,51 +688,42 @@ __metadata: languageName: node linkType: hard -"@firebase/storage@npm:0.13.1": - version: 0.13.1 - resolution: "@firebase/storage@npm:0.13.1" +"@firebase/storage@npm:0.13.2": + version: 0.13.2 + resolution: "@firebase/storage@npm:0.13.2" dependencies: - "@firebase/component": "npm:0.6.8" - "@firebase/util": "npm:1.9.7" + "@firebase/component": "npm:0.6.9" + "@firebase/util": "npm:1.10.0" tslib: "npm:^2.1.0" undici: "npm:6.19.7" peerDependencies: "@firebase/app": 0.x - checksum: 10c0/91ec989c1d466817ad6ec82c35a2c834ad5344a2be421746f225a8d7968de6912138d3fbede7115b9315c639855e3c88f8174fb5b8e387078ccdbeae6cc0ff9b - languageName: node - linkType: hard - -"@firebase/util@npm:1.9.6": - version: 1.9.6 - resolution: "@firebase/util@npm:1.9.6" - dependencies: - tslib: "npm:^2.1.0" - checksum: 10c0/06d09748edb5ee2d045f138428e27fc206bdbb3ccaa2bd2b732379bc0ac56465b6a360a946150d6263604b8b8060141db2dfab21d6f1caee5aa0d3720eedfc85 + checksum: 10c0/12791911ef1bab345d62584fb5edfed18576a18990408ff9203bed8a04b6988946af4af515ad878fe7346d355709310c5fa05946c2701e68a27a3653ecfac83f languageName: node linkType: hard -"@firebase/util@npm:1.9.7": - version: 1.9.7 - resolution: "@firebase/util@npm:1.9.7" +"@firebase/util@npm:1.10.0": + version: 1.10.0 + resolution: "@firebase/util@npm:1.10.0" dependencies: tslib: "npm:^2.1.0" - checksum: 10c0/0cce6680d5f3f93eb941c2b8feb18b6a82ecb667e941614f23980a77828cb6a852a3dc5526a86d14e9a20d36c71921eba5db5d2b8fd8b331148b5e714624e51b + checksum: 10c0/fc152a2cbdd06323f57f66c90cd388369e48e8910d589127f2ea76ca415c43c1c59b5b7b240307ae18f7f4c9cf0f97c71cb06e5ed8cba770b70958903ec52571 languageName: node linkType: hard -"@firebase/vertexai-preview@npm:0.0.3": - version: 0.0.3 - resolution: "@firebase/vertexai-preview@npm:0.0.3" +"@firebase/vertexai-preview@npm:0.0.4": + version: 0.0.4 + resolution: "@firebase/vertexai-preview@npm:0.0.4" dependencies: "@firebase/app-check-interop-types": "npm:0.3.2" - "@firebase/component": "npm:0.6.8" + "@firebase/component": "npm:0.6.9" "@firebase/logger": "npm:0.4.2" - "@firebase/util": "npm:1.9.7" + "@firebase/util": "npm:1.10.0" tslib: "npm:^2.1.0" peerDependencies: "@firebase/app": 0.x "@firebase/app-types": 0.x - checksum: 10c0/7a867726edd402d39a3105fdf85ddb97e499baa3913702ac83124a6d92631ae91c8c891a879fd429ec2d225c80243d618b8dbbf633d19f4f050cfc0913c5806c + checksum: 10c0/863fb2a92952f0eb543cbedaad8153d61060dfc4df93492dff87ce07d74710946e6bab255f1659de629a673a7b4bb46db0c2a36bc7314de781cf28c7938431a3 languageName: node linkType: hard @@ -754,14 +735,15 @@ __metadata: linkType: hard "@google-cloud/firestore@npm:^7.7.0": - version: 7.8.0 - resolution: "@google-cloud/firestore@npm:7.8.0" + version: 7.10.0 + resolution: "@google-cloud/firestore@npm:7.10.0" dependencies: + "@opentelemetry/api": "npm:^1.3.0" fast-deep-equal: "npm:^3.1.1" functional-red-black-tree: "npm:^1.0.1" google-gax: "npm:^4.3.3" protobufjs: "npm:^7.2.6" - checksum: 10c0/6d31506c1b6bb3b7d3d8f8250de0bf7a50497f22432a212f039438db2206cf184600a069cf16aa39d73e2fbdb26ae00c6833cbda2e76f1e53687c07000ce5567 + checksum: 10c0/0b6c11914c7563e073c5c3b1d535ec12e1f7cf9db92cdf68b75fc17604da303f39dfb9372f45185de8f54eb238f556228111590705f15accd3f85c88b1828a49 languageName: node linkType: hard @@ -790,8 +772,8 @@ __metadata: linkType: hard "@google-cloud/storage@npm:^7.7.0": - version: 7.11.1 - resolution: "@google-cloud/storage@npm:7.11.1" + version: 7.13.0 + resolution: "@google-cloud/storage@npm:7.13.0" dependencies: "@google-cloud/paginator": "npm:^5.0.0" "@google-cloud/projectify": "npm:^4.0.0" @@ -799,7 +781,7 @@ __metadata: abort-controller: "npm:^3.0.0" async-retry: "npm:^1.3.3" duplexify: "npm:^4.1.3" - fast-xml-parser: "npm:^4.3.0" + fast-xml-parser: "npm:^4.4.1" gaxios: "npm:^6.0.2" google-auth-library: "npm:^9.6.3" html-entities: "npm:^2.5.2" @@ -808,31 +790,31 @@ __metadata: retry-request: "npm:^7.0.0" teeny-request: "npm:^9.0.0" uuid: "npm:^8.0.0" - checksum: 10c0/3118edeb0cef302699dac9d67606cdfc04cbd5de4a091d1ba91751290940390d605d13a72233ec303492643fa1f2f67a22fd4e6c43b2b9b6edf660c96111d0d1 + checksum: 10c0/f97928ae9d3e7c035dabda061efac06f96353c5886382aaa5745f442b28114d70051b835977b84363cb55dee93c1ded4323568340e62653a587675e0234f4c32 languageName: node linkType: hard -"@grpc/grpc-js@npm:~1.10.3": - version: 1.10.8 - resolution: "@grpc/grpc-js@npm:1.10.8" +"@grpc/grpc-js@npm:^1.10.9": + version: 1.11.3 + resolution: "@grpc/grpc-js@npm:1.11.3" dependencies: "@grpc/proto-loader": "npm:^0.7.13" "@js-sdsl/ordered-map": "npm:^4.4.2" - checksum: 10c0/600ccd5fc1f4d5e49b52c1ac8fd656b4583d81e6f9708a75459861dbf55251e7c0378ff6ba0043c140916f22dee195119cec6535c7b7e8a0a9da244d48cacc9e + checksum: 10c0/2946a70c709688737603be573f6836beea26e4c132a50164591020860ae0e62375c1475c26017011fabfbaf6a9fa2bfdabfe9058aed11bab2f697e4242533afc languageName: node linkType: hard "@grpc/grpc-js@npm:~1.9.0": - version: 1.9.14 - resolution: "@grpc/grpc-js@npm:1.9.14" + version: 1.9.15 + resolution: "@grpc/grpc-js@npm:1.9.15" dependencies: "@grpc/proto-loader": "npm:^0.7.8" "@types/node": "npm:>=12.12.47" - checksum: 10c0/921c5a34b4b290555b41291f514658b89c5035926d77bbbedc2e7d408bd7156450539df4f6b8698cd5a6ee7f20109a444efb9ec200a4302c84dda0c6f223b7c0 + checksum: 10c0/5bd40e1b886df238f8ffe4cab694ceb51250f94ede7da6f94233b4d9a2526a4e525aafbc8f319850c2d8126c189232be458991768877b2af441f0234fb4b4292 languageName: node linkType: hard -"@grpc/proto-loader@npm:^0.7.0, @grpc/proto-loader@npm:^0.7.13, @grpc/proto-loader@npm:^0.7.8": +"@grpc/proto-loader@npm:^0.7.13, @grpc/proto-loader@npm:^0.7.8": version: 0.7.13 resolution: "@grpc/proto-loader@npm:0.7.13" dependencies: @@ -846,20 +828,6 @@ __metadata: languageName: node linkType: hard -"@humanwhocodes/module-importer@npm:^1.0.1": - version: 1.0.1 - resolution: "@humanwhocodes/module-importer@npm:1.0.1" - checksum: 10c0/909b69c3b86d482c26b3359db16e46a32e0fb30bd306a3c176b8313b9e7313dba0f37f519de6aa8b0a1921349e505f259d19475e123182416a506d7f87e7f529 - languageName: node - linkType: hard - -"@humanwhocodes/retry@npm:^0.3.0": - version: 0.3.0 - resolution: "@humanwhocodes/retry@npm:0.3.0" - checksum: 10c0/7111ec4e098b1a428459b4e3be5a5d2a13b02905f805a2468f4fa628d072f0de2da26a27d04f65ea2846f73ba51f4204661709f05bfccff645e3cedef8781bb6 - languageName: node - linkType: hard - "@isaacs/cliui@npm:^8.0.2": version: 8.0.2 resolution: "@isaacs/cliui@npm:8.0.2" @@ -882,9 +850,9 @@ __metadata: linkType: hard "@jridgewell/sourcemap-codec@npm:^1.4.10": - version: 1.4.15 - resolution: "@jridgewell/sourcemap-codec@npm:1.4.15" - checksum: 10c0/0c6b5ae663087558039052a626d2d7ed5208da36cfd707dcc5cea4a07cfc918248403dcb5989a8f7afaf245ce0573b7cc6fd94c4a30453bd10e44d9363940ba5 + version: 1.5.0 + resolution: "@jridgewell/sourcemap-codec@npm:1.5.0" + checksum: 10c0/2eb864f276eb1096c3c11da3e9bb518f6d9fc0023c78344cdc037abadc725172c70314bdb360f2d4b7bffec7f5d657ce006816bc5d4ecb35e61b66132db00c18 languageName: node linkType: hard @@ -905,33 +873,6 @@ __metadata: languageName: node linkType: hard -"@nodelib/fs.scandir@npm:2.1.5": - version: 2.1.5 - resolution: "@nodelib/fs.scandir@npm:2.1.5" - dependencies: - "@nodelib/fs.stat": "npm:2.0.5" - run-parallel: "npm:^1.1.9" - checksum: 10c0/732c3b6d1b1e967440e65f284bd06e5821fedf10a1bea9ed2bb75956ea1f30e08c44d3def9d6a230666574edbaf136f8cfd319c14fd1f87c66e6a44449afb2eb - languageName: node - linkType: hard - -"@nodelib/fs.stat@npm:2.0.5, @nodelib/fs.stat@npm:^2.0.2": - version: 2.0.5 - resolution: "@nodelib/fs.stat@npm:2.0.5" - checksum: 10c0/88dafe5e3e29a388b07264680dc996c17f4bda48d163a9d4f5c1112979f0ce8ec72aa7116122c350b4e7976bc5566dc3ddb579be1ceaacc727872eb4ed93926d - languageName: node - linkType: hard - -"@nodelib/fs.walk@npm:^1.2.3, @nodelib/fs.walk@npm:^1.2.8": - version: 1.2.8 - resolution: "@nodelib/fs.walk@npm:1.2.8" - dependencies: - "@nodelib/fs.scandir": "npm:2.1.5" - fastq: "npm:^1.6.0" - checksum: 10c0/db9de047c3bb9b51f9335a7bb46f4fcfb6829fb628318c12115fbaf7d369bfce71c15b103d1fc3b464812d936220ee9bc1c8f762d032c9f6be9acc99249095b1 - languageName: node - linkType: hard - "@npmcli/agent@npm:^2.0.0": version: 2.2.2 resolution: "@npmcli/agent@npm:2.2.2" @@ -954,6 +895,13 @@ __metadata: languageName: node linkType: hard +"@opentelemetry/api@npm:^1.3.0": + version: 1.9.0 + resolution: "@opentelemetry/api@npm:1.9.0" + checksum: 10c0/9aae2fe6e8a3a3eeb6c1fdef78e1939cf05a0f37f8a4fae4d6bf2e09eb1e06f966ece85805626e01ba5fab48072b94f19b835449e58b6d26720ee19a58298add + languageName: node + linkType: hard + "@pkgjs/parseargs@npm:^0.11.0": version: 0.11.0 resolution: "@pkgjs/parseargs@npm:0.11.0" @@ -961,13 +909,6 @@ __metadata: languageName: node linkType: hard -"@pkgr/core@npm:^0.1.0": - version: 0.1.1 - resolution: "@pkgr/core@npm:0.1.1" - checksum: 10c0/3f7536bc7f57320ab2cf96f8973664bef624710c403357429fbf680a5c3b4843c1dbd389bb43daa6b1f6f1f007bb082f5abcb76bb2b5dc9f421647743b71d3d8 - languageName: node - linkType: hard - "@protobufjs/aspromise@npm:^1.1.1, @protobufjs/aspromise@npm:^1.1.2": version: 1.1.2 resolution: "@protobufjs/aspromise@npm:1.1.2" @@ -1041,20 +982,20 @@ __metadata: languageName: node linkType: hard -"@sapphire/async-queue@npm:^1.5.2": - version: 1.5.2 - resolution: "@sapphire/async-queue@npm:1.5.2" - checksum: 10c0/e588a70efe7993a85e3e81103f3f9c3c2c12dd6f3ab2a0f0b763fa412a99780db7a9e1560f188c77945e5e561a40be53120f49b5d83dfa88dd2cf02955e46647 +"@sapphire/async-queue@npm:^1.5.2, @sapphire/async-queue@npm:^1.5.3": + version: 1.5.3 + resolution: "@sapphire/async-queue@npm:1.5.3" + checksum: 10c0/fcf860cdde9bfbc1625dab5e11924caa871c9e741a8fb836193a519267179a4a1979604f88f8a40855c6b931bc82d489dcd11d034fea38bb8a4d9816ab821ed1 languageName: node linkType: hard -"@sapphire/shapeshift@npm:^3.9.7": - version: 3.9.7 - resolution: "@sapphire/shapeshift@npm:3.9.7" +"@sapphire/shapeshift@npm:^4.0.0": + version: 4.0.0 + resolution: "@sapphire/shapeshift@npm:4.0.0" dependencies: fast-deep-equal: "npm:^3.1.3" lodash: "npm:^4.17.21" - checksum: 10c0/29883d4c1986714fd4b2a7e4a58bf30a4598a02bbe031605dd99b766310a98889e2ae6f16bf37f43d91cf5960733dc1a619bfdaa85a96bc0ff9cc5ce57b8e689 + checksum: 10c0/2abbfd20977e800455108688e45fff7b7c6e197256c8f8a54db90025a900914908b5fa4ffcbd1eacb4c692792cbed980613aa878e09f1fd87ab5052b6a6d6bce languageName: node linkType: hard @@ -1127,14 +1068,14 @@ __metadata: linkType: hard "@types/express-serve-static-core@npm:^4.17.33": - version: 4.19.3 - resolution: "@types/express-serve-static-core@npm:4.19.3" + version: 4.19.6 + resolution: "@types/express-serve-static-core@npm:4.19.6" dependencies: "@types/node": "npm:*" "@types/qs": "npm:*" "@types/range-parser": "npm:*" "@types/send": "npm:*" - checksum: 10c0/5d2a1fb96a17a8e0e8c59325dfeb6d454bbc5c9b9b6796eec0397ddf9dbd262892040d5da3d72b5d7148f34bb3fcd438faf1b37fcba8c5a03e75fae491ad1edf + checksum: 10c0/4281f4ead71723f376b3ddf64868ae26244d434d9906c101cf8d436d4b5c779d01bd046e4ea0ed1a394d3e402216fabfa22b1fa4dba501061cd7c81c54045983 languageName: node linkType: hard @@ -1157,26 +1098,12 @@ __metadata: languageName: node linkType: hard -"@types/json-schema@npm:^7.0.9": - version: 7.0.15 - resolution: "@types/json-schema@npm:7.0.15" - checksum: 10c0/a996a745e6c5d60292f36731dd41341339d4eeed8180bb09226e5c8d23759067692b1d88e5d91d72ee83dfc00d3aca8e7bd43ea120516c17922cbcb7c3e252db - languageName: node - linkType: hard - -"@types/json5@npm:^0.0.29": - version: 0.0.29 - resolution: "@types/json5@npm:0.0.29" - checksum: 10c0/6bf5337bc447b706bb5b4431d37686aa2ea6d07cfd6f79cc31de80170d6ff9b1c7384a9c0ccbc45b3f512bae9e9f75c2e12109806a15331dc94e8a8db6dbb4ac - languageName: node - linkType: hard - "@types/jsonwebtoken@npm:^9.0.2": - version: 9.0.6 - resolution: "@types/jsonwebtoken@npm:9.0.6" + version: 9.0.7 + resolution: "@types/jsonwebtoken@npm:9.0.7" dependencies: "@types/node": "npm:*" - checksum: 10c0/9c29e3896e5fb6056e54d87514643e59e0cfb966ae25171a107776270195bba955f0373e98c8ed6450c145b18984f5df9cf0fcac360f382cec3c7c4d3510b202 + checksum: 10c0/e1cd0e48fcae21b1d4378887a23453bd7212b480a131b11bcda2cdeb0687d03c9646ee5ba592e04cfaf76f7cc80f179950e627cdb3ebc90a5923bce49a35631a languageName: node linkType: hard @@ -1201,28 +1128,19 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:*, @types/node@npm:>=12.12.47, @types/node@npm:>=13.7.0": - version: 20.14.2 - resolution: "@types/node@npm:20.14.2" - dependencies: - undici-types: "npm:~5.26.4" - checksum: 10c0/2d86e5f2227aaa42212e82ea0affe72799111b888ff900916376450b02b09b963ca888b20d9c332d8d2b833ed4781987867a38eaa2e4863fa8439071468b0a6f - languageName: node - linkType: hard - -"@types/node@npm:^22.0.1": - version: 22.5.1 - resolution: "@types/node@npm:22.5.1" +"@types/node@npm:*, @types/node@npm:>=12.12.47, @types/node@npm:>=13.7.0, @types/node@npm:^22.0.1": + version: 22.7.4 + resolution: "@types/node@npm:22.7.4" dependencies: undici-types: "npm:~6.19.2" - checksum: 10c0/35373176d8a1d4e16004a1ed303e68d39e4c6341024dc056f2577982df98c1a045a6b677f12ed557796f09bbf7d621f428f6874cc37ed28f7b336fa604b5f6a6 + checksum: 10c0/c22bf54515c78ff3170142c1e718b90e2a0003419dc2d55f79c9c9362edd590a6ab1450deb09ff6e1b32d1b4698da407930b16285e8be3a009ea6cd2695cac01 languageName: node linkType: hard "@types/qs@npm:*": - version: 6.9.15 - resolution: "@types/qs@npm:6.9.15" - checksum: 10c0/49c5ff75ca3adb18a1939310042d273c9fc55920861bd8e5100c8a923b3cda90d759e1a95e18334092da1c8f7b820084687770c83a1ccef04fb2c6908117c823 + version: 6.9.16 + resolution: "@types/qs@npm:6.9.16" + checksum: 10c0/a4e871b80fff623755e356fd1f225aea45ff7a29da30f99fddee1a05f4f5f33485b314ab5758145144ed45708f97e44595aa9a8368e9bbc083932f931b12dbb6 languageName: node linkType: hard @@ -1245,13 +1163,6 @@ __metadata: languageName: node linkType: hard -"@types/semver@npm:^7.3.12": - version: 7.5.8 - resolution: "@types/semver@npm:7.5.8" - checksum: 10c0/8663ff927234d1c5fcc04b33062cb2b9fcfbe0f5f351ed26c4d1e1581657deebd506b41ff7fdf89e787e3d33ce05854bc01686379b89e9c49b564c4cfa988efa - languageName: node - linkType: hard - "@types/send@npm:*": version: 0.17.4 resolution: "@types/send@npm:0.17.4" @@ -1288,210 +1199,18 @@ __metadata: linkType: hard "@types/ws@npm:^8.5.10": - version: 8.5.10 - resolution: "@types/ws@npm:8.5.10" + version: 8.5.12 + resolution: "@types/ws@npm:8.5.12" dependencies: "@types/node": "npm:*" - checksum: 10c0/e9af279b984c4a04ab53295a40aa95c3e9685f04888df5c6920860d1dd073fcc57c7bd33578a04b285b2c655a0b52258d34bee0a20569dca8defb8393e1e5d29 - languageName: node - linkType: hard - -"@typescript-eslint/eslint-plugin@npm:7.18.0, @typescript-eslint/eslint-plugin@npm:^7.18.0": - version: 7.18.0 - resolution: "@typescript-eslint/eslint-plugin@npm:7.18.0" - dependencies: - "@eslint-community/regexpp": "npm:^4.10.0" - "@typescript-eslint/scope-manager": "npm:7.18.0" - "@typescript-eslint/type-utils": "npm:7.18.0" - "@typescript-eslint/utils": "npm:7.18.0" - "@typescript-eslint/visitor-keys": "npm:7.18.0" - graphemer: "npm:^1.4.0" - ignore: "npm:^5.3.1" - natural-compare: "npm:^1.4.0" - ts-api-utils: "npm:^1.3.0" - peerDependencies: - "@typescript-eslint/parser": ^7.0.0 - eslint: ^8.56.0 - peerDependenciesMeta: - typescript: - optional: true - checksum: 10c0/2b37948fa1b0dab77138909dabef242a4d49ab93e4019d4ef930626f0a7d96b03e696cd027fa0087881c20e73be7be77c942606b4a76fa599e6b37f6985304c3 - languageName: node - linkType: hard - -"@typescript-eslint/experimental-utils@npm:^5.0.0": - version: 5.62.0 - resolution: "@typescript-eslint/experimental-utils@npm:5.62.0" - dependencies: - "@typescript-eslint/utils": "npm:5.62.0" - peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - checksum: 10c0/f7037977e00849cd8c03677a88b0659a4f0e0b1e0151aebb47c49c92b8e57408578142df598eac08b364623d926343c724f42494f87662e437b1c89f0b2e815b - languageName: node - linkType: hard - -"@typescript-eslint/parser@npm:7.18.0, @typescript-eslint/parser@npm:^7.18.0": - version: 7.18.0 - resolution: "@typescript-eslint/parser@npm:7.18.0" - dependencies: - "@typescript-eslint/scope-manager": "npm:7.18.0" - "@typescript-eslint/types": "npm:7.18.0" - "@typescript-eslint/typescript-estree": "npm:7.18.0" - "@typescript-eslint/visitor-keys": "npm:7.18.0" - debug: "npm:^4.3.4" - peerDependencies: - eslint: ^8.56.0 - peerDependenciesMeta: - typescript: - optional: true - checksum: 10c0/370e73fca4278091bc1b657f85e7d74cd52b24257ea20c927a8e17546107ce04fbf313fec99aed0cc2a145ddbae1d3b12e9cc2c1320117636dc1281bcfd08059 - languageName: node - linkType: hard - -"@typescript-eslint/scope-manager@npm:5.62.0": - version: 5.62.0 - resolution: "@typescript-eslint/scope-manager@npm:5.62.0" - dependencies: - "@typescript-eslint/types": "npm:5.62.0" - "@typescript-eslint/visitor-keys": "npm:5.62.0" - checksum: 10c0/861253235576c1c5c1772d23cdce1418c2da2618a479a7de4f6114a12a7ca853011a1e530525d0931c355a8fd237b9cd828fac560f85f9623e24054fd024726f - languageName: node - linkType: hard - -"@typescript-eslint/scope-manager@npm:7.18.0": - version: 7.18.0 - resolution: "@typescript-eslint/scope-manager@npm:7.18.0" - dependencies: - "@typescript-eslint/types": "npm:7.18.0" - "@typescript-eslint/visitor-keys": "npm:7.18.0" - checksum: 10c0/038cd58c2271de146b3a594afe2c99290034033326d57ff1f902976022c8b0138ffd3cb893ae439ae41003b5e4bcc00cabf6b244ce40e8668f9412cc96d97b8e - languageName: node - linkType: hard - -"@typescript-eslint/type-utils@npm:7.18.0": - version: 7.18.0 - resolution: "@typescript-eslint/type-utils@npm:7.18.0" - dependencies: - "@typescript-eslint/typescript-estree": "npm:7.18.0" - "@typescript-eslint/utils": "npm:7.18.0" - debug: "npm:^4.3.4" - ts-api-utils: "npm:^1.3.0" - peerDependencies: - eslint: ^8.56.0 - peerDependenciesMeta: - typescript: - optional: true - checksum: 10c0/ad92a38007be620f3f7036f10e234abdc2fdc518787b5a7227e55fd12896dacf56e8b34578723fbf9bea8128df2510ba8eb6739439a3879eda9519476d5783fd - languageName: node - linkType: hard - -"@typescript-eslint/types@npm:5.62.0": - version: 5.62.0 - resolution: "@typescript-eslint/types@npm:5.62.0" - checksum: 10c0/7febd3a7f0701c0b927e094f02e82d8ee2cada2b186fcb938bc2b94ff6fbad88237afc304cbaf33e82797078bbbb1baf91475f6400912f8b64c89be79bfa4ddf - languageName: node - linkType: hard - -"@typescript-eslint/types@npm:7.18.0": - version: 7.18.0 - resolution: "@typescript-eslint/types@npm:7.18.0" - checksum: 10c0/eb7371ac55ca77db8e59ba0310b41a74523f17e06f485a0ef819491bc3dd8909bb930120ff7d30aaf54e888167e0005aa1337011f3663dc90fb19203ce478054 - languageName: node - linkType: hard - -"@typescript-eslint/typescript-estree@npm:5.62.0": - version: 5.62.0 - resolution: "@typescript-eslint/typescript-estree@npm:5.62.0" - dependencies: - "@typescript-eslint/types": "npm:5.62.0" - "@typescript-eslint/visitor-keys": "npm:5.62.0" - debug: "npm:^4.3.4" - globby: "npm:^11.1.0" - is-glob: "npm:^4.0.3" - semver: "npm:^7.3.7" - tsutils: "npm:^3.21.0" - peerDependenciesMeta: - typescript: - optional: true - checksum: 10c0/d7984a3e9d56897b2481940ec803cb8e7ead03df8d9cfd9797350be82ff765dfcf3cfec04e7355e1779e948da8f02bc5e11719d07a596eb1cb995c48a95e38cf - languageName: node - linkType: hard - -"@typescript-eslint/typescript-estree@npm:7.18.0": - version: 7.18.0 - resolution: "@typescript-eslint/typescript-estree@npm:7.18.0" - dependencies: - "@typescript-eslint/types": "npm:7.18.0" - "@typescript-eslint/visitor-keys": "npm:7.18.0" - debug: "npm:^4.3.4" - globby: "npm:^11.1.0" - is-glob: "npm:^4.0.3" - minimatch: "npm:^9.0.4" - semver: "npm:^7.6.0" - ts-api-utils: "npm:^1.3.0" - peerDependenciesMeta: - typescript: - optional: true - checksum: 10c0/0c7f109a2e460ec8a1524339479cf78ff17814d23c83aa5112c77fb345e87b3642616291908dcddea1e671da63686403dfb712e4a4435104f92abdfddf9aba81 - languageName: node - linkType: hard - -"@typescript-eslint/utils@npm:5.62.0": - version: 5.62.0 - resolution: "@typescript-eslint/utils@npm:5.62.0" - dependencies: - "@eslint-community/eslint-utils": "npm:^4.2.0" - "@types/json-schema": "npm:^7.0.9" - "@types/semver": "npm:^7.3.12" - "@typescript-eslint/scope-manager": "npm:5.62.0" - "@typescript-eslint/types": "npm:5.62.0" - "@typescript-eslint/typescript-estree": "npm:5.62.0" - eslint-scope: "npm:^5.1.1" - semver: "npm:^7.3.7" - peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - checksum: 10c0/f09b7d9952e4a205eb1ced31d7684dd55cee40bf8c2d78e923aa8a255318d97279825733902742c09d8690f37a50243f4c4d383ab16bd7aefaf9c4b438f785e1 - languageName: node - linkType: hard - -"@typescript-eslint/utils@npm:7.18.0": - version: 7.18.0 - resolution: "@typescript-eslint/utils@npm:7.18.0" - dependencies: - "@eslint-community/eslint-utils": "npm:^4.4.0" - "@typescript-eslint/scope-manager": "npm:7.18.0" - "@typescript-eslint/types": "npm:7.18.0" - "@typescript-eslint/typescript-estree": "npm:7.18.0" - peerDependencies: - eslint: ^8.56.0 - checksum: 10c0/a25a6d50eb45c514469a01ff01f215115a4725fb18401055a847ddf20d1b681409c4027f349033a95c4ff7138d28c3b0a70253dfe8262eb732df4b87c547bd1e - languageName: node - linkType: hard - -"@typescript-eslint/visitor-keys@npm:5.62.0": - version: 5.62.0 - resolution: "@typescript-eslint/visitor-keys@npm:5.62.0" - dependencies: - "@typescript-eslint/types": "npm:5.62.0" - eslint-visitor-keys: "npm:^3.3.0" - checksum: 10c0/7c3b8e4148e9b94d9b7162a596a1260d7a3efc4e65199693b8025c71c4652b8042501c0bc9f57654c1e2943c26da98c0f77884a746c6ae81389fcb0b513d995d - languageName: node - linkType: hard - -"@typescript-eslint/visitor-keys@npm:7.18.0": - version: 7.18.0 - resolution: "@typescript-eslint/visitor-keys@npm:7.18.0" - dependencies: - "@typescript-eslint/types": "npm:7.18.0" - eslint-visitor-keys: "npm:^3.4.3" - checksum: 10c0/538b645f8ff1d9debf264865c69a317074eaff0255e63d7407046176b0f6a6beba34a6c51d511f12444bae12a98c69891eb6f403c9f54c6c2e2849d1c1cb73c0 + checksum: 10c0/3fd77c9e4e05c24ce42bfc7647f7506b08c40a40fe2aea236ef6d4e96fc7cb4006a81ed1b28ec9c457e177a74a72924f4768b7b4652680b42dfd52bc380e15f9 languageName: node linkType: hard -"@vladfrangu/async_event_emitter@npm:^2.2.4": - version: 2.2.4 - resolution: "@vladfrangu/async_event_emitter@npm:2.2.4" - checksum: 10c0/0f17294f0f4458b0e71cdf0b3e10d0e9ceedfd0d6fe3a846d3033e2644659323bf31de3b025f67eead507d367d27054e4f4976fd4fa7fec716000e32ab853822 +"@vladfrangu/async_event_emitter@npm:^2.2.4, @vladfrangu/async_event_emitter@npm:^2.4.6": + version: 2.4.6 + resolution: "@vladfrangu/async_event_emitter@npm:2.4.6" + checksum: 10c0/1fe634878902da584493ecb8e81c855436c002b215dd7c25c21780930fc5621ebe8eb79d5b899a56af0d1ea9ea9171e35175221e4438e2f56c67ce64d4b8a373 languageName: node linkType: hard @@ -1511,41 +1230,16 @@ __metadata: languageName: node linkType: hard -"acorn-jsx@npm:^5.2.0, acorn-jsx@npm:^5.3.2": - version: 5.3.2 - resolution: "acorn-jsx@npm:5.3.2" - peerDependencies: - acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 - checksum: 10c0/4c54868fbef3b8d58927d5e33f0a4de35f59012fe7b12cf9dfbb345fb8f46607709e1c4431be869a23fb63c151033d84c4198fa9f79385cec34fcb1dd53974c1 - languageName: node - linkType: hard - "acorn-walk@npm:^8.1.1": - version: 8.3.2 - resolution: "acorn-walk@npm:8.3.2" - checksum: 10c0/7e2a8dad5480df7f872569b9dccff2f3da7e65f5353686b1d6032ab9f4ddf6e3a2cb83a9b52cf50b1497fd522154dda92f0abf7153290cc79cd14721ff121e52 - languageName: node - linkType: hard - -"acorn@npm:^7.1.1": - version: 7.4.1 - resolution: "acorn@npm:7.4.1" - bin: - acorn: bin/acorn - checksum: 10c0/bd0b2c2b0f334bbee48828ff897c12bd2eb5898d03bf556dcc8942022cec795ac5bb5b6b585e2de687db6231faf07e096b59a361231dd8c9344d5df5f7f0e526 - languageName: node - linkType: hard - -"acorn@npm:^8.11.3, acorn@npm:^8.4.1": - version: 8.11.3 - resolution: "acorn@npm:8.11.3" - bin: - acorn: bin/acorn - checksum: 10c0/3ff155f8812e4a746fee8ecff1f227d527c4c45655bb1fad6347c3cb58e46190598217551b1500f18542d2bbe5c87120cb6927f5a074a59166fbdd9468f0a299 + version: 8.3.4 + resolution: "acorn-walk@npm:8.3.4" + dependencies: + acorn: "npm:^8.11.0" + checksum: 10c0/76537ac5fb2c37a64560feaf3342023dadc086c46da57da363e64c6148dc21b57d49ace26f949e225063acb6fb441eabffd89f7a3066de5ad37ab3e328927c62 languageName: node linkType: hard -"acorn@npm:^8.12.0": +"acorn@npm:^8.11.0, acorn@npm:^8.4.1": version: 8.12.1 resolution: "acorn@npm:8.12.1" bin: @@ -1582,18 +1276,6 @@ __metadata: languageName: node linkType: hard -"ajv@npm:^6.12.4": - version: 6.12.6 - resolution: "ajv@npm:6.12.6" - dependencies: - fast-deep-equal: "npm:^3.1.1" - fast-json-stable-stringify: "npm:^2.0.0" - json-schema-traverse: "npm:^0.4.1" - uri-js: "npm:^4.2.2" - checksum: 10c0/41e23642cbe545889245b9d2a45854ebba51cda6c778ebced9649420d9205f2efb39cb43dbc41e358409223b1ea43303ae4839db682c848b891e4811da1a5a71 - languageName: node - linkType: hard - "ansi-regex@npm:^5.0.1": version: 5.0.1 resolution: "ansi-regex@npm:5.0.1" @@ -1602,13 +1284,13 @@ __metadata: linkType: hard "ansi-regex@npm:^6.0.1": - version: 6.0.1 - resolution: "ansi-regex@npm:6.0.1" - checksum: 10c0/cbe16dbd2c6b2735d1df7976a7070dd277326434f0212f43abf6d87674095d247968209babdaad31bb00882fa68807256ba9be340eec2f1004de14ca75f52a08 + version: 6.1.0 + resolution: "ansi-regex@npm:6.1.0" + checksum: 10c0/a91daeddd54746338478eef88af3439a7edf30f8e23196e2d6ed182da9add559c601266dbef01c2efa46a958ad6f1f8b176799657616c702b5b02e799e7fd8dc languageName: node linkType: hard -"ansi-styles@npm:^4.0.0, ansi-styles@npm:^4.1.0": +"ansi-styles@npm:^4.0.0": version: 4.3.0 resolution: "ansi-styles@npm:4.3.0" dependencies: @@ -1641,98 +1323,6 @@ __metadata: languageName: node linkType: hard -"argparse@npm:^2.0.1": - version: 2.0.1 - resolution: "argparse@npm:2.0.1" - checksum: 10c0/c5640c2d89045371c7cedd6a70212a04e360fd34d6edeae32f6952c63949e3525ea77dbec0289d8213a99bbaeab5abfa860b5c12cf88a2e6cf8106e90dd27a7e - languageName: node - linkType: hard - -"array-buffer-byte-length@npm:^1.0.1": - version: 1.0.1 - resolution: "array-buffer-byte-length@npm:1.0.1" - dependencies: - call-bind: "npm:^1.0.5" - is-array-buffer: "npm:^3.0.4" - checksum: 10c0/f5cdf54527cd18a3d2852ddf73df79efec03829e7373a8322ef5df2b4ef546fb365c19c71d6b42d641cb6bfe0f1a2f19bc0ece5b533295f86d7c3d522f228917 - languageName: node - linkType: hard - -"array-includes@npm:^3.1.7": - version: 3.1.8 - resolution: "array-includes@npm:3.1.8" - dependencies: - call-bind: "npm:^1.0.7" - define-properties: "npm:^1.2.1" - es-abstract: "npm:^1.23.2" - es-object-atoms: "npm:^1.0.0" - get-intrinsic: "npm:^1.2.4" - is-string: "npm:^1.0.7" - checksum: 10c0/5b1004d203e85873b96ddc493f090c9672fd6c80d7a60b798da8a14bff8a670ff95db5aafc9abc14a211943f05220dacf8ea17638ae0af1a6a47b8c0b48ce370 - languageName: node - linkType: hard - -"array-union@npm:^2.1.0": - version: 2.1.0 - resolution: "array-union@npm:2.1.0" - checksum: 10c0/429897e68110374f39b771ec47a7161fc6a8fc33e196857c0a396dc75df0b5f65e4d046674db764330b6bb66b39ef48dd7c53b6a2ee75cfb0681e0c1a7033962 - languageName: node - linkType: hard - -"array.prototype.findlastindex@npm:^1.2.3": - version: 1.2.5 - resolution: "array.prototype.findlastindex@npm:1.2.5" - dependencies: - call-bind: "npm:^1.0.7" - define-properties: "npm:^1.2.1" - es-abstract: "npm:^1.23.2" - es-errors: "npm:^1.3.0" - es-object-atoms: "npm:^1.0.0" - es-shim-unscopables: "npm:^1.0.2" - checksum: 10c0/962189487728b034f3134802b421b5f39e42ee2356d13b42d2ddb0e52057ffdcc170b9524867f4f0611a6f638f4c19b31e14606e8bcbda67799e26685b195aa3 - languageName: node - linkType: hard - -"array.prototype.flat@npm:^1.3.2": - version: 1.3.2 - resolution: "array.prototype.flat@npm:1.3.2" - dependencies: - call-bind: "npm:^1.0.2" - define-properties: "npm:^1.2.0" - es-abstract: "npm:^1.22.1" - es-shim-unscopables: "npm:^1.0.0" - checksum: 10c0/a578ed836a786efbb6c2db0899ae80781b476200617f65a44846cb1ed8bd8b24c8821b83703375d8af639c689497b7b07277060024b9919db94ac3e10dc8a49b - languageName: node - linkType: hard - -"array.prototype.flatmap@npm:^1.3.2": - version: 1.3.2 - resolution: "array.prototype.flatmap@npm:1.3.2" - dependencies: - call-bind: "npm:^1.0.2" - define-properties: "npm:^1.2.0" - es-abstract: "npm:^1.22.1" - es-shim-unscopables: "npm:^1.0.0" - checksum: 10c0/67b3f1d602bb73713265145853128b1ad77cc0f9b833c7e1e056b323fbeac41a4ff1c9c99c7b9445903caea924d9ca2450578d9011913191aa88cc3c3a4b54f4 - languageName: node - linkType: hard - -"arraybuffer.prototype.slice@npm:^1.0.3": - version: 1.0.3 - resolution: "arraybuffer.prototype.slice@npm:1.0.3" - dependencies: - array-buffer-byte-length: "npm:^1.0.1" - call-bind: "npm:^1.0.5" - define-properties: "npm:^1.2.1" - es-abstract: "npm:^1.22.3" - es-errors: "npm:^1.2.1" - get-intrinsic: "npm:^1.2.3" - is-array-buffer: "npm:^3.0.4" - is-shared-array-buffer: "npm:^1.0.2" - checksum: 10c0/d32754045bcb2294ade881d45140a5e52bda2321b9e98fa514797b7f0d252c4c5ab0d1edb34112652c62fa6a9398def568da63a4d7544672229afea283358c36 - languageName: node - linkType: hard - "arrify@npm:^2.0.0": version: 2.0.1 resolution: "arrify@npm:2.0.1" @@ -1756,15 +1346,6 @@ __metadata: languageName: node linkType: hard -"available-typed-arrays@npm:^1.0.7": - version: 1.0.7 - resolution: "available-typed-arrays@npm:1.0.7" - dependencies: - possible-typed-array-names: "npm:^1.0.0" - checksum: 10c0/d07226ef4f87daa01bd0fe80f8f310982e345f372926da2e5296aecc25c41cab440916bbaa4c5e1034b453af3392f67df5961124e4b586df1e99793a1374bdb2 - languageName: node - linkType: hard - "balanced-match@npm:^1.0.0": version: 1.0.2 resolution: "balanced-match@npm:1.0.2" @@ -1812,7 +1393,7 @@ __metadata: languageName: node linkType: hard -"braces@npm:^3.0.3, braces@npm:~3.0.2": +"braces@npm:~3.0.2": version: 3.0.3 resolution: "braces@npm:3.0.3" dependencies: @@ -1829,8 +1410,8 @@ __metadata: linkType: hard "cacache@npm:^18.0.0": - version: 18.0.3 - resolution: "cacache@npm:18.0.3" + version: 18.0.4 + resolution: "cacache@npm:18.0.4" dependencies: "@npmcli/fs": "npm:^3.1.0" fs-minipass: "npm:^3.0.0" @@ -1844,37 +1425,7 @@ __metadata: ssri: "npm:^10.0.0" tar: "npm:^6.1.11" unique-filename: "npm:^3.0.0" - checksum: 10c0/dfda92840bb371fb66b88c087c61a74544363b37a265023223a99965b16a16bbb87661fe4948718d79df6e0cc04e85e62784fbcf1832b2a5e54ff4c46fbb45b7 - languageName: node - linkType: hard - -"call-bind@npm:^1.0.2, call-bind@npm:^1.0.5, call-bind@npm:^1.0.6, call-bind@npm:^1.0.7": - version: 1.0.7 - resolution: "call-bind@npm:1.0.7" - dependencies: - es-define-property: "npm:^1.0.0" - es-errors: "npm:^1.3.0" - function-bind: "npm:^1.1.2" - get-intrinsic: "npm:^1.2.4" - set-function-length: "npm:^1.2.1" - checksum: 10c0/a3ded2e423b8e2a265983dba81c27e125b48eefb2655e7dfab6be597088da3d47c47976c24bc51b8fd9af1061f8f87b4ab78a314f3c77784b2ae2ba535ad8b8d - languageName: node - linkType: hard - -"callsites@npm:^3.0.0": - version: 3.1.0 - resolution: "callsites@npm:3.1.0" - checksum: 10c0/fff92277400eb06c3079f9e74f3af120db9f8ea03bad0e84d9aede54bbe2d44a56cccb5f6cf12211f93f52306df87077ecec5b712794c5a9b5dac6d615a3f301 - languageName: node - linkType: hard - -"chalk@npm:^4.0.0": - version: 4.1.2 - resolution: "chalk@npm:4.1.2" - dependencies: - ansi-styles: "npm:^4.1.0" - supports-color: "npm:^7.1.0" - checksum: 10c0/4a3fef5cc34975c898ffe77141450f679721df9dde00f6c304353fa9c8b571929123b26a0e4617bde5018977eb655b31970c297b91b63ee83bb82aeb04666880 + checksum: 10c0/6c055bafed9de4f3dcc64ac3dc7dd24e863210902b7c470eb9ce55a806309b3efff78033e3d8b4f7dcc5d467f2db43c6a2857aaaf26f0094b8a351d44c42179f languageName: node linkType: hard @@ -1971,7 +1522,7 @@ __metadata: languageName: node linkType: hard -"cross-spawn@npm:^7.0.0, cross-spawn@npm:^7.0.2": +"cross-spawn@npm:^7.0.0": version: 7.0.3 resolution: "cross-spawn@npm:7.0.3" dependencies: @@ -1982,86 +1533,15 @@ __metadata: languageName: node linkType: hard -"data-view-buffer@npm:^1.0.1": - version: 1.0.1 - resolution: "data-view-buffer@npm:1.0.1" - dependencies: - call-bind: "npm:^1.0.6" - es-errors: "npm:^1.3.0" - is-data-view: "npm:^1.0.1" - checksum: 10c0/8984119e59dbed906a11fcfb417d7d861936f16697a0e7216fe2c6c810f6b5e8f4a5281e73f2c28e8e9259027190ac4a33e2a65fdd7fa86ac06b76e838918583 - languageName: node - linkType: hard - -"data-view-byte-length@npm:^1.0.1": - version: 1.0.1 - resolution: "data-view-byte-length@npm:1.0.1" - dependencies: - call-bind: "npm:^1.0.7" - es-errors: "npm:^1.3.0" - is-data-view: "npm:^1.0.1" - checksum: 10c0/b7d9e48a0cf5aefed9ab7d123559917b2d7e0d65531f43b2fd95b9d3a6b46042dd3fca597c42bba384e66b70d7ad66ff23932f8367b241f53d93af42cfe04ec2 - languageName: node - linkType: hard - -"data-view-byte-offset@npm:^1.0.0": - version: 1.0.0 - resolution: "data-view-byte-offset@npm:1.0.0" - dependencies: - call-bind: "npm:^1.0.6" - es-errors: "npm:^1.3.0" - is-data-view: "npm:^1.0.1" - checksum: 10c0/21b0d2e53fd6e20cc4257c873bf6d36d77bd6185624b84076c0a1ddaa757b49aaf076254006341d35568e89f52eecd1ccb1a502cfb620f2beca04f48a6a62a8f - languageName: node - linkType: hard - -"debug@npm:4, debug@npm:^4, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.4": - version: 4.3.5 - resolution: "debug@npm:4.3.5" +"debug@npm:4, debug@npm:^4, debug@npm:^4.3.4": + version: 4.3.7 + resolution: "debug@npm:4.3.7" dependencies: - ms: "npm:2.1.2" + ms: "npm:^2.1.3" peerDependenciesMeta: supports-color: optional: true - checksum: 10c0/082c375a2bdc4f4469c99f325ff458adad62a3fc2c482d59923c260cb08152f34e2659f72b3767db8bb2f21ca81a60a42d1019605a412132d7b9f59363a005cc - languageName: node - linkType: hard - -"debug@npm:^3.2.7": - version: 3.2.7 - resolution: "debug@npm:3.2.7" - dependencies: - ms: "npm:^2.1.1" - checksum: 10c0/37d96ae42cbc71c14844d2ae3ba55adf462ec89fd3a999459dec3833944cd999af6007ff29c780f1c61153bcaaf2c842d1e4ce1ec621e4fc4923244942e4a02a - languageName: node - linkType: hard - -"deep-is@npm:^0.1.3": - version: 0.1.4 - resolution: "deep-is@npm:0.1.4" - checksum: 10c0/7f0ee496e0dff14a573dc6127f14c95061b448b87b995fc96c017ce0a1e66af1675e73f1d6064407975bc4ea6ab679497a29fff7b5b9c4e99cb10797c1ad0b4c - languageName: node - linkType: hard - -"define-data-property@npm:^1.0.1, define-data-property@npm:^1.1.4": - version: 1.1.4 - resolution: "define-data-property@npm:1.1.4" - dependencies: - es-define-property: "npm:^1.0.0" - es-errors: "npm:^1.3.0" - gopd: "npm:^1.0.1" - checksum: 10c0/dea0606d1483eb9db8d930d4eac62ca0fa16738b0b3e07046cddfacf7d8c868bbe13fa0cb263eb91c7d0d527960dc3f2f2471a69ed7816210307f6744fe62e37 - languageName: node - linkType: hard - -"define-properties@npm:^1.2.0, define-properties@npm:^1.2.1": - version: 1.2.1 - resolution: "define-properties@npm:1.2.1" - dependencies: - define-data-property: "npm:^1.0.1" - has-property-descriptors: "npm:^1.0.0" - object-keys: "npm:^1.1.1" - checksum: 10c0/88a152319ffe1396ccc6ded510a3896e77efac7a1bfbaa174a7b00414a1747377e0bb525d303794a47cf30e805c2ec84e575758512c6e44a993076d29fd4e6c3 + checksum: 10c0/1471db19c3b06d485a622d62f65947a19a23fbd0dd73f7fd3eafb697eec5360cde447fb075919987899b1a2096e85d35d4eb5a4de09a57600ac9cf7e6c8e768b languageName: node linkType: hard @@ -2079,12 +1559,10 @@ __metadata: languageName: node linkType: hard -"dir-glob@npm:^3.0.1": - version: 3.0.1 - resolution: "dir-glob@npm:3.0.1" - dependencies: - path-type: "npm:^4.0.0" - checksum: 10c0/dcac00920a4d503e38bb64001acb19df4efc14536ada475725e12f52c16777afdee4db827f55f13a908ee7efc0cb282e2e3dbaeeb98c0993dd93d1802d3bf00c +"discord-api-types@npm:0.37.100": + version: 0.37.100 + resolution: "discord-api-types@npm:0.37.100" + checksum: 10c0/315cfbeb475a98ff711d44cb5dd2aa162730a904692775bf9429c384df597d9b950c20668a2177fd926aed52541d0915688e351906466111aae44d8c2063fb83 languageName: node linkType: hard @@ -2095,32 +1573,30 @@ __metadata: languageName: node linkType: hard +"discord-api-types@npm:0.37.97": + version: 0.37.97 + resolution: "discord-api-types@npm:0.37.97" + checksum: 10c0/1a08a0f44d3a7439fd1ac4128e4a853c498fa5477e40bc68f2c62d5b2abe8aad1d1d402d8a59a6ac55adf348354dc6c97865a11548b1a25bf2f0878cff3a54b0 + languageName: node + linkType: hard + "discord.js@npm:^14.15.3": - version: 14.15.3 - resolution: "discord.js@npm:14.15.3" + version: 14.16.3 + resolution: "discord.js@npm:14.16.3" dependencies: - "@discordjs/builders": "npm:^1.8.2" + "@discordjs/builders": "npm:^1.9.0" "@discordjs/collection": "npm:1.5.3" - "@discordjs/formatters": "npm:^0.4.0" - "@discordjs/rest": "npm:^2.3.0" - "@discordjs/util": "npm:^1.1.0" - "@discordjs/ws": "npm:^1.1.1" + "@discordjs/formatters": "npm:^0.5.0" + "@discordjs/rest": "npm:^2.4.0" + "@discordjs/util": "npm:^1.1.1" + "@discordjs/ws": "npm:1.1.1" "@sapphire/snowflake": "npm:3.5.3" - discord-api-types: "npm:0.37.83" + discord-api-types: "npm:0.37.100" fast-deep-equal: "npm:3.1.3" lodash.snakecase: "npm:4.1.1" - tslib: "npm:2.6.2" - undici: "npm:6.13.0" - checksum: 10c0/21a4e28541c29bf7170835f42cebc684e83615221f3c1262677e1f363e8fd28e7367e35bceabaea15873d965aecf0a832df6d572790ddec104bd0e025d11bdb8 - languageName: node - linkType: hard - -"doctrine@npm:^2.1.0": - version: 2.1.0 - resolution: "doctrine@npm:2.1.0" - dependencies: - esutils: "npm:^2.0.2" - checksum: 10c0/b6416aaff1f380bf56c3b552f31fdf7a69b45689368deca72d28636f41c16bb28ec3ebc40ace97db4c1afc0ceeb8120e8492fe0046841c94c2933b2e30a7d5ac + tslib: "npm:^2.6.3" + undici: "npm:6.19.8" + checksum: 10c0/d3cfcbad532bdb4414df9d12bb1a2f6ca18fa1113726b0e759d298e0e7fbcccf88ee485ada519b092f72d1004e9c4c792efbf3728a050bcd4202b6046161cc98 languageName: node linkType: hard @@ -2205,410 +1681,10 @@ __metadata: languageName: node linkType: hard -"es-abstract@npm:^1.22.1, es-abstract@npm:^1.22.3, es-abstract@npm:^1.23.0, es-abstract@npm:^1.23.2": - version: 1.23.3 - resolution: "es-abstract@npm:1.23.3" - dependencies: - array-buffer-byte-length: "npm:^1.0.1" - arraybuffer.prototype.slice: "npm:^1.0.3" - available-typed-arrays: "npm:^1.0.7" - call-bind: "npm:^1.0.7" - data-view-buffer: "npm:^1.0.1" - data-view-byte-length: "npm:^1.0.1" - data-view-byte-offset: "npm:^1.0.0" - es-define-property: "npm:^1.0.0" - es-errors: "npm:^1.3.0" - es-object-atoms: "npm:^1.0.0" - es-set-tostringtag: "npm:^2.0.3" - es-to-primitive: "npm:^1.2.1" - function.prototype.name: "npm:^1.1.6" - get-intrinsic: "npm:^1.2.4" - get-symbol-description: "npm:^1.0.2" - globalthis: "npm:^1.0.3" - gopd: "npm:^1.0.1" - has-property-descriptors: "npm:^1.0.2" - has-proto: "npm:^1.0.3" - has-symbols: "npm:^1.0.3" - hasown: "npm:^2.0.2" - internal-slot: "npm:^1.0.7" - is-array-buffer: "npm:^3.0.4" - is-callable: "npm:^1.2.7" - is-data-view: "npm:^1.0.1" - is-negative-zero: "npm:^2.0.3" - is-regex: "npm:^1.1.4" - is-shared-array-buffer: "npm:^1.0.3" - is-string: "npm:^1.0.7" - is-typed-array: "npm:^1.1.13" - is-weakref: "npm:^1.0.2" - object-inspect: "npm:^1.13.1" - object-keys: "npm:^1.1.1" - object.assign: "npm:^4.1.5" - regexp.prototype.flags: "npm:^1.5.2" - safe-array-concat: "npm:^1.1.2" - safe-regex-test: "npm:^1.0.3" - string.prototype.trim: "npm:^1.2.9" - string.prototype.trimend: "npm:^1.0.8" - string.prototype.trimstart: "npm:^1.0.8" - typed-array-buffer: "npm:^1.0.2" - typed-array-byte-length: "npm:^1.0.1" - typed-array-byte-offset: "npm:^1.0.2" - typed-array-length: "npm:^1.0.6" - unbox-primitive: "npm:^1.0.2" - which-typed-array: "npm:^1.1.15" - checksum: 10c0/d27e9afafb225c6924bee9971a7f25f20c314f2d6cb93a63cada4ac11dcf42040896a6c22e5fb8f2a10767055ed4ddf400be3b1eb12297d281726de470b75666 - languageName: node - linkType: hard - -"es-define-property@npm:^1.0.0": - version: 1.0.0 - resolution: "es-define-property@npm:1.0.0" - dependencies: - get-intrinsic: "npm:^1.2.4" - checksum: 10c0/6bf3191feb7ea2ebda48b577f69bdfac7a2b3c9bcf97307f55fd6ef1bbca0b49f0c219a935aca506c993d8c5d8bddd937766cb760cd5e5a1071351f2df9f9aa4 - languageName: node - linkType: hard - -"es-errors@npm:^1.2.1, es-errors@npm:^1.3.0": - version: 1.3.0 - resolution: "es-errors@npm:1.3.0" - checksum: 10c0/0a61325670072f98d8ae3b914edab3559b6caa980f08054a3b872052640d91da01d38df55df797fcc916389d77fc92b8d5906cf028f4db46d7e3003abecbca85 - languageName: node - linkType: hard - -"es-object-atoms@npm:^1.0.0": - version: 1.0.0 - resolution: "es-object-atoms@npm:1.0.0" - dependencies: - es-errors: "npm:^1.3.0" - checksum: 10c0/1fed3d102eb27ab8d983337bb7c8b159dd2a1e63ff833ec54eea1311c96d5b08223b433060ba240541ca8adba9eee6b0a60cdbf2f80634b784febc9cc8b687b4 - languageName: node - linkType: hard - -"es-set-tostringtag@npm:^2.0.3": - version: 2.0.3 - resolution: "es-set-tostringtag@npm:2.0.3" - dependencies: - get-intrinsic: "npm:^1.2.4" - has-tostringtag: "npm:^1.0.2" - hasown: "npm:^2.0.1" - checksum: 10c0/f22aff1585eb33569c326323f0b0d175844a1f11618b86e193b386f8be0ea9474cfbe46df39c45d959f7aa8f6c06985dc51dd6bce5401645ec5a74c4ceaa836a - languageName: node - linkType: hard - -"es-shim-unscopables@npm:^1.0.0, es-shim-unscopables@npm:^1.0.2": - version: 1.0.2 - resolution: "es-shim-unscopables@npm:1.0.2" - dependencies: - hasown: "npm:^2.0.0" - checksum: 10c0/f495af7b4b7601a4c0cfb893581c352636e5c08654d129590386a33a0432cf13a7bdc7b6493801cadd990d838e2839b9013d1de3b880440cb537825e834fe783 - languageName: node - linkType: hard - -"es-to-primitive@npm:^1.2.1": - version: 1.2.1 - resolution: "es-to-primitive@npm:1.2.1" - dependencies: - is-callable: "npm:^1.1.4" - is-date-object: "npm:^1.0.1" - is-symbol: "npm:^1.0.2" - checksum: 10c0/0886572b8dc075cb10e50c0af62a03d03a68e1e69c388bd4f10c0649ee41b1fbb24840a1b7e590b393011b5cdbe0144b776da316762653685432df37d6de60f1 - languageName: node - linkType: hard - "escalade@npm:^3.1.1": - version: 3.1.2 - resolution: "escalade@npm:3.1.2" - checksum: 10c0/6b4adafecd0682f3aa1cd1106b8fff30e492c7015b178bc81b2d2f75106dabea6c6d6e8508fc491bd58e597c74abb0e8e2368f943ecb9393d4162e3c2f3cf287 - languageName: node - linkType: hard - -"escape-string-regexp@npm:^4.0.0": - version: 4.0.0 - resolution: "escape-string-regexp@npm:4.0.0" - checksum: 10c0/9497d4dd307d845bd7f75180d8188bb17ea8c151c1edbf6b6717c100e104d629dc2dfb687686181b0f4b7d732c7dfdc4d5e7a8ff72de1b0ca283a75bbb3a9cd9 - languageName: node - linkType: hard - -"eslint-config-prettier@npm:^9.1.0": - version: 9.1.0 - resolution: "eslint-config-prettier@npm:9.1.0" - peerDependencies: - eslint: ">=7.0.0" - bin: - eslint-config-prettier: bin/cli.js - checksum: 10c0/6d332694b36bc9ac6fdb18d3ca2f6ac42afa2ad61f0493e89226950a7091e38981b66bac2b47ba39d15b73fff2cd32c78b850a9cf9eed9ca9a96bfb2f3a2f10d - languageName: node - linkType: hard - -"eslint-import-resolver-node@npm:^0.3.9": - version: 0.3.9 - resolution: "eslint-import-resolver-node@npm:0.3.9" - dependencies: - debug: "npm:^3.2.7" - is-core-module: "npm:^2.13.0" - resolve: "npm:^1.22.4" - checksum: 10c0/0ea8a24a72328a51fd95aa8f660dcca74c1429806737cf10261ab90cfcaaf62fd1eff664b76a44270868e0a932711a81b250053942595bcd00a93b1c1575dd61 - languageName: node - linkType: hard - -"eslint-module-utils@npm:^2.8.0": - version: 2.8.1 - resolution: "eslint-module-utils@npm:2.8.1" - dependencies: - debug: "npm:^3.2.7" - peerDependenciesMeta: - eslint: - optional: true - checksum: 10c0/1aeeb97bf4b688d28de136ee57c824480c37691b40fa825c711a4caf85954e94b99c06ac639d7f1f6c1d69223bd21bcb991155b3e589488e958d5b83dfd0f882 - languageName: node - linkType: hard - -"eslint-plugin-import@npm:^2.29.1": - version: 2.29.1 - resolution: "eslint-plugin-import@npm:2.29.1" - dependencies: - array-includes: "npm:^3.1.7" - array.prototype.findlastindex: "npm:^1.2.3" - array.prototype.flat: "npm:^1.3.2" - array.prototype.flatmap: "npm:^1.3.2" - debug: "npm:^3.2.7" - doctrine: "npm:^2.1.0" - eslint-import-resolver-node: "npm:^0.3.9" - eslint-module-utils: "npm:^2.8.0" - hasown: "npm:^2.0.0" - is-core-module: "npm:^2.13.1" - is-glob: "npm:^4.0.3" - minimatch: "npm:^3.1.2" - object.fromentries: "npm:^2.0.7" - object.groupby: "npm:^1.0.1" - object.values: "npm:^1.1.7" - semver: "npm:^6.3.1" - tsconfig-paths: "npm:^3.15.0" - peerDependencies: - eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 - checksum: 10c0/5f35dfbf4e8e67f741f396987de9504ad125c49f4144508a93282b4ea0127e052bde65ab6def1f31b6ace6d5d430be698333f75bdd7dca3bc14226c92a083196 - languageName: node - linkType: hard - -"eslint-plugin-prettier@npm:^5.2.1": - version: 5.2.1 - resolution: "eslint-plugin-prettier@npm:5.2.1" - dependencies: - prettier-linter-helpers: "npm:^1.0.0" - synckit: "npm:^0.9.1" - peerDependencies: - "@types/eslint": ">=8.0.0" - eslint: ">=8.0.0" - eslint-config-prettier: "*" - prettier: ">=3.0.0" - peerDependenciesMeta: - "@types/eslint": - optional: true - eslint-config-prettier: - optional: true - checksum: 10c0/4bc8bbaf5bb556c9c501dcdff369137763c49ccaf544f9fa91400360ed5e3a3f1234ab59690e06beca5b1b7e6f6356978cdd3b02af6aba3edea2ffe69ca6e8b2 - languageName: node - linkType: hard - -"eslint-plugin-sort-keys-fix@npm:^1.1.2": - version: 1.1.2 - resolution: "eslint-plugin-sort-keys-fix@npm:1.1.2" - dependencies: - espree: "npm:^6.1.2" - esutils: "npm:^2.0.2" - natural-compare: "npm:^1.4.0" - requireindex: "npm:~1.2.0" - checksum: 10c0/4b916168b1d295cc4eca37a0ede149534ce3a25df0501ef92fdbda3ea2c6e8bdd2c25a2d6bce7cdf31900f34edbde3c45b4062f5b4fcefa82ce9ac49f2958615 - languageName: node - linkType: hard - -"eslint-plugin-typescript-sort-keys@npm:^3.2.0": version: 3.2.0 - resolution: "eslint-plugin-typescript-sort-keys@npm:3.2.0" - dependencies: - "@typescript-eslint/experimental-utils": "npm:^5.0.0" - json-schema: "npm:^0.4.0" - natural-compare-lite: "npm:^1.4.0" - peerDependencies: - "@typescript-eslint/parser": ^6 || ^7 - eslint: ^7 || ^8 - typescript: ^3 || ^4 || ^5 - checksum: 10c0/c832d5a93cac4f955f05b126ad79d1df49f9f11402ab225b1835d42972291a3855e477d28b07696d2a65a511ccdcdf64001eeda216248da82a5187af6d03e70f - languageName: node - linkType: hard - -"eslint-plugin-unused-imports@npm:^4.1.3": - version: 4.1.3 - resolution: "eslint-plugin-unused-imports@npm:4.1.3" - peerDependencies: - "@typescript-eslint/eslint-plugin": ^8.0.0-0 || ^7.0.0 || ^6.0.0 || ^5.0.0 - eslint: ^9.0.0 || ^8.0.0 - peerDependenciesMeta: - "@typescript-eslint/eslint-plugin": - optional: true - checksum: 10c0/e30120e274554b99756fb4c2af123ca03f502fc55bc7e5b095fa9278b96cb32f1e405cf2e533aa8b0f8ca28c504ecf15daed9e4b5fccb172316e256a994fdebe - languageName: node - linkType: hard - -"eslint-scope@npm:^5.1.1": - version: 5.1.1 - resolution: "eslint-scope@npm:5.1.1" - dependencies: - esrecurse: "npm:^4.3.0" - estraverse: "npm:^4.1.1" - checksum: 10c0/d30ef9dc1c1cbdece34db1539a4933fe3f9b14e1ffb27ecc85987902ee663ad7c9473bbd49a9a03195a373741e62e2f807c4938992e019b511993d163450e70a - languageName: node - linkType: hard - -"eslint-scope@npm:^8.0.2": - version: 8.0.2 - resolution: "eslint-scope@npm:8.0.2" - dependencies: - esrecurse: "npm:^4.3.0" - estraverse: "npm:^5.2.0" - checksum: 10c0/477f820647c8755229da913025b4567347fd1f0bf7cbdf3a256efff26a7e2e130433df052bd9e3d014025423dc00489bea47eb341002b15553673379c1a7dc36 - languageName: node - linkType: hard - -"eslint-visitor-keys@npm:^1.1.0": - version: 1.3.0 - resolution: "eslint-visitor-keys@npm:1.3.0" - checksum: 10c0/10c91fdbbe36810dd4308e57f9a8bc7177188b2a70247e54e3af1fa05ebc66414ae6fd4ce3c6c6821591f43a556e9037bc6b071122e099b5f8b7d2f76df553e3 - languageName: node - linkType: hard - -"eslint-visitor-keys@npm:^3.3.0, eslint-visitor-keys@npm:^3.4.3": - version: 3.4.3 - resolution: "eslint-visitor-keys@npm:3.4.3" - checksum: 10c0/92708e882c0a5ffd88c23c0b404ac1628cf20104a108c745f240a13c332a11aac54f49a22d5762efbffc18ecbc9a580d1b7ad034bf5f3cc3307e5cbff2ec9820 - languageName: node - linkType: hard - -"eslint-visitor-keys@npm:^4.0.0": - version: 4.0.0 - resolution: "eslint-visitor-keys@npm:4.0.0" - checksum: 10c0/76619f42cf162705a1515a6868e6fc7567e185c7063a05621a8ac4c3b850d022661262c21d9f1fc1d144ecf0d5d64d70a3f43c15c3fc969a61ace0fb25698cf5 - languageName: node - linkType: hard - -"eslint@npm:^9.9.1": - version: 9.9.1 - resolution: "eslint@npm:9.9.1" - dependencies: - "@eslint-community/eslint-utils": "npm:^4.2.0" - "@eslint-community/regexpp": "npm:^4.11.0" - "@eslint/config-array": "npm:^0.18.0" - "@eslint/eslintrc": "npm:^3.1.0" - "@eslint/js": "npm:9.9.1" - "@humanwhocodes/module-importer": "npm:^1.0.1" - "@humanwhocodes/retry": "npm:^0.3.0" - "@nodelib/fs.walk": "npm:^1.2.8" - ajv: "npm:^6.12.4" - chalk: "npm:^4.0.0" - cross-spawn: "npm:^7.0.2" - debug: "npm:^4.3.2" - escape-string-regexp: "npm:^4.0.0" - eslint-scope: "npm:^8.0.2" - eslint-visitor-keys: "npm:^4.0.0" - espree: "npm:^10.1.0" - esquery: "npm:^1.5.0" - esutils: "npm:^2.0.2" - fast-deep-equal: "npm:^3.1.3" - file-entry-cache: "npm:^8.0.0" - find-up: "npm:^5.0.0" - glob-parent: "npm:^6.0.2" - ignore: "npm:^5.2.0" - imurmurhash: "npm:^0.1.4" - is-glob: "npm:^4.0.0" - is-path-inside: "npm:^3.0.3" - json-stable-stringify-without-jsonify: "npm:^1.0.1" - levn: "npm:^0.4.1" - lodash.merge: "npm:^4.6.2" - minimatch: "npm:^3.1.2" - natural-compare: "npm:^1.4.0" - optionator: "npm:^0.9.3" - strip-ansi: "npm:^6.0.1" - text-table: "npm:^0.2.0" - peerDependencies: - jiti: "*" - peerDependenciesMeta: - jiti: - optional: true - bin: - eslint: bin/eslint.js - checksum: 10c0/5e71efda7c0a14ee95436d5cdfed04ee61dfb1d89d7a32b50a424de2e680af82849628ea6581950c2e0726491f786a3cfd0032ce013c1c5093786e475cfdfb33 - languageName: node - linkType: hard - -"espree@npm:^10.0.1": - version: 10.0.1 - resolution: "espree@npm:10.0.1" - dependencies: - acorn: "npm:^8.11.3" - acorn-jsx: "npm:^5.3.2" - eslint-visitor-keys: "npm:^4.0.0" - checksum: 10c0/7c0f84afa0f9db7bb899619e6364ed832ef13fe8943691757ddde9a1805ae68b826ed66803323015f707a629a5507d0d290edda2276c25131fe0ad883b8b5636 - languageName: node - linkType: hard - -"espree@npm:^10.1.0": - version: 10.1.0 - resolution: "espree@npm:10.1.0" - dependencies: - acorn: "npm:^8.12.0" - acorn-jsx: "npm:^5.3.2" - eslint-visitor-keys: "npm:^4.0.0" - checksum: 10c0/52e6feaa77a31a6038f0c0e3fce93010a4625701925b0715cd54a2ae190b3275053a0717db698697b32653788ac04845e489d6773b508d6c2e8752f3c57470a0 - languageName: node - linkType: hard - -"espree@npm:^6.1.2": - version: 6.2.1 - resolution: "espree@npm:6.2.1" - dependencies: - acorn: "npm:^7.1.1" - acorn-jsx: "npm:^5.2.0" - eslint-visitor-keys: "npm:^1.1.0" - checksum: 10c0/499b47bc599ac3515598072ca787016bdaf0d463467ee1c7113061949359a26d74b8fb344afdad63e38b0e81c7b068013125f7a123d0776e0d75fffe2fc9cfac - languageName: node - linkType: hard - -"esquery@npm:^1.5.0": - version: 1.6.0 - resolution: "esquery@npm:1.6.0" - dependencies: - estraverse: "npm:^5.1.0" - checksum: 10c0/cb9065ec605f9da7a76ca6dadb0619dfb611e37a81e318732977d90fab50a256b95fee2d925fba7c2f3f0523aa16f91587246693bc09bc34d5a59575fe6e93d2 - languageName: node - linkType: hard - -"esrecurse@npm:^4.3.0": - version: 4.3.0 - resolution: "esrecurse@npm:4.3.0" - dependencies: - estraverse: "npm:^5.2.0" - checksum: 10c0/81a37116d1408ded88ada45b9fb16dbd26fba3aadc369ce50fcaf82a0bac12772ebd7b24cd7b91fc66786bf2c1ac7b5f196bc990a473efff972f5cb338877cf5 - languageName: node - linkType: hard - -"estraverse@npm:^4.1.1": - version: 4.3.0 - resolution: "estraverse@npm:4.3.0" - checksum: 10c0/9cb46463ef8a8a4905d3708a652d60122a0c20bb58dec7e0e12ab0e7235123d74214fc0141d743c381813e1b992767e2708194f6f6e0f9fd00c1b4e0887b8b6d - languageName: node - linkType: hard - -"estraverse@npm:^5.1.0, estraverse@npm:^5.2.0": - version: 5.3.0 - resolution: "estraverse@npm:5.3.0" - checksum: 10c0/1ff9447b96263dec95d6d67431c5e0771eb9776427421260a3e2f0fdd5d6bd4f8e37a7338f5ad2880c9f143450c9b1e4fc2069060724570a49cf9cf0312bd107 - languageName: node - linkType: hard - -"esutils@npm:^2.0.2": - version: 2.0.3 - resolution: "esutils@npm:2.0.3" - checksum: 10c0/9a2fe69a41bfdade834ba7c42de4723c97ec776e40656919c62cbd13607c45e127a003f05f724a1ea55e5029a4cf2de444b13009f2af71271e42d93a637137c7 + resolution: "escalade@npm:3.2.0" + checksum: 10c0/ced4dd3a78e15897ed3be74e635110bbf3b08877b0a41be50dcb325ee0e0b5f65fc2d50e9845194d7c4633f327e2e1c6cce00a71b617c5673df0374201d67f65 languageName: node linkType: hard @@ -2647,57 +1723,14 @@ __metadata: languageName: node linkType: hard -"fast-diff@npm:^1.1.2": - version: 1.3.0 - resolution: "fast-diff@npm:1.3.0" - checksum: 10c0/5c19af237edb5d5effda008c891a18a585f74bf12953be57923f17a3a4d0979565fc64dbc73b9e20926b9d895f5b690c618cbb969af0cf022e3222471220ad29 - languageName: node - linkType: hard - -"fast-glob@npm:^3.2.9": - version: 3.3.2 - resolution: "fast-glob@npm:3.3.2" - dependencies: - "@nodelib/fs.stat": "npm:^2.0.2" - "@nodelib/fs.walk": "npm:^1.2.3" - glob-parent: "npm:^5.1.2" - merge2: "npm:^1.3.0" - micromatch: "npm:^4.0.4" - checksum: 10c0/42baad7b9cd40b63e42039132bde27ca2cb3a4950d0a0f9abe4639ea1aa9d3e3b40f98b1fe31cbc0cc17b664c9ea7447d911a152fa34ec5b72977b125a6fc845 - languageName: node - linkType: hard - -"fast-json-stable-stringify@npm:^2.0.0": - version: 2.1.0 - resolution: "fast-json-stable-stringify@npm:2.1.0" - checksum: 10c0/7f081eb0b8a64e0057b3bb03f974b3ef00135fbf36c1c710895cd9300f13c94ba809bb3a81cf4e1b03f6e5285610a61abbd7602d0652de423144dfee5a389c9b - languageName: node - linkType: hard - -"fast-levenshtein@npm:^2.0.6": - version: 2.0.6 - resolution: "fast-levenshtein@npm:2.0.6" - checksum: 10c0/111972b37338bcb88f7d9e2c5907862c280ebf4234433b95bc611e518d192ccb2d38119c4ac86e26b668d75f7f3894f4ff5c4982899afced7ca78633b08287c4 - languageName: node - linkType: hard - -"fast-xml-parser@npm:^4.3.0": - version: 4.4.0 - resolution: "fast-xml-parser@npm:4.4.0" +"fast-xml-parser@npm:^4.4.1": + version: 4.5.0 + resolution: "fast-xml-parser@npm:4.5.0" dependencies: strnum: "npm:^1.0.5" bin: fxparser: src/cli/cli.js - checksum: 10c0/ce32fad713471a40bea67959894168f297a5dd0aba64b89a2abc71a4fec0b1ae1d49c2dd8d8719ca8beeedf477824358c8a486b360b9f3ef12abc2e355d11318 - languageName: node - linkType: hard - -"fastq@npm:^1.6.0": - version: 1.17.1 - resolution: "fastq@npm:1.17.1" - dependencies: - reusify: "npm:^1.0.4" - checksum: 10c0/1095f16cea45fb3beff558bb3afa74ca7a9250f5a670b65db7ed585f92b4b48381445cd328b3d87323da81e43232b5d5978a8201bde84e0cd514310f1ea6da34 + checksum: 10c0/71d206c9e137f5c26af88d27dde0108068a5d074401901d643c500c36e95dfd828333a98bda020846c41f5b9b364e2b0e9be5b19b0bdcab5cf31559c07b80a95 languageName: node linkType: hard @@ -2705,17 +1738,8 @@ __metadata: version: 0.11.4 resolution: "faye-websocket@npm:0.11.4" dependencies: - websocket-driver: "npm:>=0.5.1" - checksum: 10c0/c6052a0bb322778ce9f89af92890f6f4ce00d5ec92418a35e5f4c6864a4fe736fec0bcebd47eac7c0f0e979b01530746b1c85c83cb04bae789271abf19737420 - languageName: node - linkType: hard - -"file-entry-cache@npm:^8.0.0": - version: 8.0.0 - resolution: "file-entry-cache@npm:8.0.0" - dependencies: - flat-cache: "npm:^4.0.0" - checksum: 10c0/9e2b5938b1cd9b6d7e3612bdc533afd4ac17b2fc646569e9a8abbf2eb48e5eb8e316bc38815a3ef6a1b456f4107f0d0f055a614ca613e75db6bf9ff4d72c1638 + websocket-driver: "npm:>=0.5.1" + checksum: 10c0/c6052a0bb322778ce9f89af92890f6f4ce00d5ec92418a35e5f4c6864a4fe736fec0bcebd47eac7c0f0e979b01530746b1c85c83cb04bae789271abf19737420 languageName: node linkType: hard @@ -2728,19 +1752,9 @@ __metadata: languageName: node linkType: hard -"find-up@npm:^5.0.0": - version: 5.0.0 - resolution: "find-up@npm:5.0.0" - dependencies: - locate-path: "npm:^6.0.0" - path-exists: "npm:^4.0.0" - checksum: 10c0/062c5a83a9c02f53cdd6d175a37ecf8f87ea5bbff1fdfb828f04bfa021441bc7583e8ebc0872a4c1baab96221fb8a8a275a19809fb93fbc40bd69ec35634069a - languageName: node - linkType: hard - "firebase-admin@npm:^12.4.0": - version: 12.4.0 - resolution: "firebase-admin@npm:12.4.0" + version: 12.6.0 + resolution: "firebase-admin@npm:12.6.0" dependencies: "@fastify/busboy": "npm:^3.0.0" "@firebase/database-compat": "npm:^1.0.2" @@ -2758,78 +1772,53 @@ __metadata: optional: true "@google-cloud/storage": optional: true - checksum: 10c0/d6378201f60b2ab79c44b43bbe6441c88365860f14ed15d9e60e0867a8851fb5aebf3677f435cfdcfc3cbc26088431d86b6c9c3bc464a5c3ee04dbf1b586dcfe + checksum: 10c0/c96c2ea58646ad45934fa114b5dc228ce82f12e185eb5b2aee3eef66546df218d4338cb398b6792d268780fc25b55d808e8b93822665dd7a9162742f3ad65b8b languageName: node linkType: hard "firebase@npm:^10.13.1": - version: 10.13.1 - resolution: "firebase@npm:10.13.1" - dependencies: - "@firebase/analytics": "npm:0.10.7" - "@firebase/analytics-compat": "npm:0.2.13" - "@firebase/app": "npm:0.10.10" - "@firebase/app-check": "npm:0.8.7" - "@firebase/app-check-compat": "npm:0.3.14" - "@firebase/app-compat": "npm:0.2.40" + version: 10.14.0 + resolution: "firebase@npm:10.14.0" + dependencies: + "@firebase/analytics": "npm:0.10.8" + "@firebase/analytics-compat": "npm:0.2.14" + "@firebase/app": "npm:0.10.12" + "@firebase/app-check": "npm:0.8.8" + "@firebase/app-check-compat": "npm:0.3.15" + "@firebase/app-compat": "npm:0.2.42" "@firebase/app-types": "npm:0.9.2" - "@firebase/auth": "npm:1.7.8" - "@firebase/auth-compat": "npm:0.5.13" - "@firebase/database": "npm:1.0.7" - "@firebase/database-compat": "npm:1.0.7" - "@firebase/firestore": "npm:4.7.1" - "@firebase/firestore-compat": "npm:0.3.36" - "@firebase/functions": "npm:0.11.7" - "@firebase/functions-compat": "npm:0.3.13" - "@firebase/installations": "npm:0.6.8" - "@firebase/installations-compat": "npm:0.2.8" - "@firebase/messaging": "npm:0.12.10" - "@firebase/messaging-compat": "npm:0.2.10" - "@firebase/performance": "npm:0.6.8" - "@firebase/performance-compat": "npm:0.2.8" - "@firebase/remote-config": "npm:0.4.8" - "@firebase/remote-config-compat": "npm:0.2.8" - "@firebase/storage": "npm:0.13.1" - "@firebase/storage-compat": "npm:0.3.11" - "@firebase/util": "npm:1.9.7" - "@firebase/vertexai-preview": "npm:0.0.3" - checksum: 10c0/7d8b82ebf86f9b719255dfc199b4d981d1e0523b56f184d851031bba9fa816f1a37262dc82da832759f7d6004e1451b00aeb4370dc64698ee17dd8977db32d61 - languageName: node - linkType: hard - -"flat-cache@npm:^4.0.0": - version: 4.0.1 - resolution: "flat-cache@npm:4.0.1" - dependencies: - flatted: "npm:^3.2.9" - keyv: "npm:^4.5.4" - checksum: 10c0/2c59d93e9faa2523e4fda6b4ada749bed432cfa28c8e251f33b25795e426a1c6dbada777afb1f74fcfff33934fdbdea921ee738fcc33e71adc9d6eca984a1cfc - languageName: node - linkType: hard - -"flatted@npm:^3.2.9": - version: 3.3.1 - resolution: "flatted@npm:3.3.1" - checksum: 10c0/324166b125ee07d4ca9bcf3a5f98d915d5db4f39d711fba640a3178b959919aae1f7cfd8aabcfef5826ed8aa8a2aa14cc85b2d7d18ff638ddf4ae3df39573eaf - languageName: node - linkType: hard - -"for-each@npm:^0.3.3": - version: 0.3.3 - resolution: "for-each@npm:0.3.3" - dependencies: - is-callable: "npm:^1.1.3" - checksum: 10c0/22330d8a2db728dbf003ec9182c2d421fbcd2969b02b4f97ec288721cda63eb28f2c08585ddccd0f77cb2930af8d958005c9e72f47141dc51816127a118f39aa + "@firebase/auth": "npm:1.7.9" + "@firebase/auth-compat": "npm:0.5.14" + "@firebase/data-connect": "npm:0.1.0" + "@firebase/database": "npm:1.0.8" + "@firebase/database-compat": "npm:1.0.8" + "@firebase/firestore": "npm:4.7.3" + "@firebase/firestore-compat": "npm:0.3.38" + "@firebase/functions": "npm:0.11.8" + "@firebase/functions-compat": "npm:0.3.14" + "@firebase/installations": "npm:0.6.9" + "@firebase/installations-compat": "npm:0.2.9" + "@firebase/messaging": "npm:0.12.11" + "@firebase/messaging-compat": "npm:0.2.11" + "@firebase/performance": "npm:0.6.9" + "@firebase/performance-compat": "npm:0.2.9" + "@firebase/remote-config": "npm:0.4.9" + "@firebase/remote-config-compat": "npm:0.2.9" + "@firebase/storage": "npm:0.13.2" + "@firebase/storage-compat": "npm:0.3.12" + "@firebase/util": "npm:1.10.0" + "@firebase/vertexai-preview": "npm:0.0.4" + checksum: 10c0/43907fa09f9b0a99281e1c900f87c34d17fcb54b519035d49a7219984402ac544223c1db642ac0a08ee8555d3943cacac167fc03771b1f8d339353b71976003f languageName: node linkType: hard "foreground-child@npm:^3.1.0": - version: 3.1.1 - resolution: "foreground-child@npm:3.1.1" + version: 3.3.0 + resolution: "foreground-child@npm:3.3.0" dependencies: cross-spawn: "npm:^7.0.0" signal-exit: "npm:^4.0.1" - checksum: 10c0/9700a0285628abaeb37007c9a4d92bd49f67210f09067638774338e146c8e9c825c5c877f072b2f75f41dc6a2d0be8664f79ffc03f6576649f54a84fb9b47de0 + checksum: 10c0/028f1d41000553fcfa6c4bb5c372963bf3d9bf0b1f25a87d1a6253014343fb69dfb1b42d9625d7cf44c8ba429940f3d0ff718b62105d4d4a4f6ef8ca0a53faa2 languageName: node linkType: hard @@ -2881,25 +1870,6 @@ __metadata: languageName: node linkType: hard -"function-bind@npm:^1.1.2": - version: 1.1.2 - resolution: "function-bind@npm:1.1.2" - checksum: 10c0/d8680ee1e5fcd4c197e4ac33b2b4dce03c71f4d91717292785703db200f5c21f977c568d28061226f9b5900cbcd2c84463646134fd5337e7925e0942bc3f46d5 - languageName: node - linkType: hard - -"function.prototype.name@npm:^1.1.6": - version: 1.1.6 - resolution: "function.prototype.name@npm:1.1.6" - dependencies: - call-bind: "npm:^1.0.2" - define-properties: "npm:^1.2.0" - es-abstract: "npm:^1.22.1" - functions-have-names: "npm:^1.2.3" - checksum: 10c0/9eae11294905b62cb16874adb4fc687927cda3162285e0ad9612e6a1d04934005d46907362ea9cdb7428edce05a2f2c3dabc3b2d21e9fd343e9bb278230ad94b - languageName: node - linkType: hard - "functional-red-black-tree@npm:^1.0.1": version: 1.0.1 resolution: "functional-red-black-tree@npm:1.0.1" @@ -2907,23 +1877,16 @@ __metadata: languageName: node linkType: hard -"functions-have-names@npm:^1.2.3": - version: 1.2.3 - resolution: "functions-have-names@npm:1.2.3" - checksum: 10c0/33e77fd29bddc2d9bb78ab3eb854c165909201f88c75faa8272e35899e2d35a8a642a15e7420ef945e1f64a9670d6aa3ec744106b2aa42be68ca5114025954ca - languageName: node - linkType: hard - "gaxios@npm:^6.0.0, gaxios@npm:^6.0.2, gaxios@npm:^6.1.1": - version: 6.6.0 - resolution: "gaxios@npm:6.6.0" + version: 6.7.1 + resolution: "gaxios@npm:6.7.1" dependencies: extend: "npm:^3.0.2" https-proxy-agent: "npm:^7.0.1" is-stream: "npm:^2.0.0" node-fetch: "npm:^2.6.9" uuid: "npm:^9.0.1" - checksum: 10c0/45ddf2e3664eed37d62e9467bb3cf81519057797c3169c7762f1be2917019d7a53ce4ff2091266afd29d05cd56e0f507b6862214b51c3fbe7730b9a6b79cb6a2 + checksum: 10c0/53e92088470661c5bc493a1de29d05aff58b1f0009ec5e7903f730f892c3642a93e264e61904383741ccbab1ce6e519f12a985bba91e13527678b32ee6d7d3fd languageName: node linkType: hard @@ -2944,31 +1907,7 @@ __metadata: languageName: node linkType: hard -"get-intrinsic@npm:^1.1.3, get-intrinsic@npm:^1.2.1, get-intrinsic@npm:^1.2.3, get-intrinsic@npm:^1.2.4": - version: 1.2.4 - resolution: "get-intrinsic@npm:1.2.4" - dependencies: - es-errors: "npm:^1.3.0" - function-bind: "npm:^1.1.2" - has-proto: "npm:^1.0.1" - has-symbols: "npm:^1.0.3" - hasown: "npm:^2.0.0" - checksum: 10c0/0a9b82c16696ed6da5e39b1267104475c47e3a9bdbe8b509dfe1710946e38a87be70d759f4bb3cda042d76a41ef47fe769660f3b7c0d1f68750299344ffb15b7 - languageName: node - linkType: hard - -"get-symbol-description@npm:^1.0.2": - version: 1.0.2 - resolution: "get-symbol-description@npm:1.0.2" - dependencies: - call-bind: "npm:^1.0.5" - es-errors: "npm:^1.3.0" - get-intrinsic: "npm:^1.2.4" - checksum: 10c0/867be6d63f5e0eb026cb3b0ef695ec9ecf9310febb041072d2e142f260bd91ced9eeb426b3af98791d1064e324e653424afa6fd1af17dee373bea48ae03162bc - languageName: node - linkType: hard - -"glob-parent@npm:^5.1.2, glob-parent@npm:~5.1.2": +"glob-parent@npm:~5.1.2": version: 5.1.2 resolution: "glob-parent@npm:5.1.2" dependencies: @@ -2977,34 +1916,19 @@ __metadata: languageName: node linkType: hard -"glob-parent@npm:^6.0.2": - version: 6.0.2 - resolution: "glob-parent@npm:6.0.2" - dependencies: - is-glob: "npm:^4.0.3" - checksum: 10c0/317034d88654730230b3f43bb7ad4f7c90257a426e872ea0bf157473ac61c99bf5d205fad8f0185f989be8d2fa6d3c7dce1645d99d545b6ea9089c39f838e7f8 - languageName: node - linkType: hard - "glob@npm:^10.2.2, glob@npm:^10.3.10": - version: 10.4.1 - resolution: "glob@npm:10.4.1" + version: 10.4.5 + resolution: "glob@npm:10.4.5" dependencies: foreground-child: "npm:^3.1.0" jackspeak: "npm:^3.1.2" minimatch: "npm:^9.0.4" minipass: "npm:^7.1.2" + package-json-from-dist: "npm:^1.0.0" path-scurry: "npm:^1.11.1" bin: glob: dist/esm/bin.mjs - checksum: 10c0/77f2900ed98b9cc2a0e1901ee5e476d664dae3cd0f1b662b8bfd4ccf00d0edc31a11595807706a274ca10e1e251411bbf2e8e976c82bed0d879a9b89343ed379 - languageName: node - linkType: hard - -"globals@npm:^14.0.0": - version: 14.0.0 - resolution: "globals@npm:14.0.0" - checksum: 10c0/b96ff42620c9231ad468d4c58ff42afee7777ee1c963013ff8aabe095a451d0ceeb8dcd8ef4cbd64d2538cef45f787a78ba3a9574f4a634438963e334471302d + checksum: 10c0/19a9759ea77b8e3ca0a43c2f07ecddc2ad46216b786bb8f993c445aee80d345925a21e5280c7b7c6c59e860a0154b84e4b2b60321fea92cd3c56b4a7489f160e languageName: node linkType: hard @@ -3015,33 +1939,9 @@ __metadata: languageName: node linkType: hard -"globalthis@npm:^1.0.3": - version: 1.0.4 - resolution: "globalthis@npm:1.0.4" - dependencies: - define-properties: "npm:^1.2.1" - gopd: "npm:^1.0.1" - checksum: 10c0/9d156f313af79d80b1566b93e19285f481c591ad6d0d319b4be5e03750d004dde40a39a0f26f7e635f9007a3600802f53ecd85a759b86f109e80a5f705e01846 - languageName: node - linkType: hard - -"globby@npm:^11.1.0": - version: 11.1.0 - resolution: "globby@npm:11.1.0" - dependencies: - array-union: "npm:^2.1.0" - dir-glob: "npm:^3.0.1" - fast-glob: "npm:^3.2.9" - ignore: "npm:^5.2.0" - merge2: "npm:^1.4.1" - slash: "npm:^3.0.0" - checksum: 10c0/b39511b4afe4bd8a7aead3a27c4ade2b9968649abab0a6c28b1a90141b96ca68ca5db1302f7c7bd29eab66bf51e13916b8e0a3d0ac08f75e1e84a39b35691189 - languageName: node - linkType: hard - "google-auth-library@npm:^9.3.0, google-auth-library@npm:^9.6.3": - version: 9.10.0 - resolution: "google-auth-library@npm:9.10.0" + version: 9.14.1 + resolution: "google-auth-library@npm:9.14.1" dependencies: base64-js: "npm:^1.3.0" ecdsa-sig-formatter: "npm:^1.0.11" @@ -3049,36 +1949,27 @@ __metadata: gcp-metadata: "npm:^6.1.0" gtoken: "npm:^7.0.0" jws: "npm:^4.0.0" - checksum: 10c0/21acad6dc712a0a935c3608b92d9aab80b05f1d4e0be5fb7efe5b2069a6453f2cee12867b5fb0a724c01a167ed3f5e4280e30740d2c1bff86f153b187205d4ed + checksum: 10c0/050e16343d93768300a800bc69773d8c451c4e778b0e503fc9dcf72e40e9563c0877f7a79ed06dffad664b49fdd1183080c41f081034b86d54a6795475fb73d2 languageName: node linkType: hard "google-gax@npm:^4.3.3": - version: 4.3.5 - resolution: "google-gax@npm:4.3.5" + version: 4.4.1 + resolution: "google-gax@npm:4.4.1" dependencies: - "@grpc/grpc-js": "npm:~1.10.3" - "@grpc/proto-loader": "npm:^0.7.0" + "@grpc/grpc-js": "npm:^1.10.9" + "@grpc/proto-loader": "npm:^0.7.13" "@types/long": "npm:^4.0.0" abort-controller: "npm:^3.0.0" duplexify: "npm:^4.0.0" google-auth-library: "npm:^9.3.0" - node-fetch: "npm:^2.6.1" + node-fetch: "npm:^2.7.0" object-hash: "npm:^3.0.0" - proto3-json-serializer: "npm:^2.0.0" - protobufjs: "npm:7.3.0" + proto3-json-serializer: "npm:^2.0.2" + protobufjs: "npm:^7.3.2" retry-request: "npm:^7.0.0" uuid: "npm:^9.0.1" - checksum: 10c0/9dc532f7c76289df65834e956b9032de6d5b6b4a6d8f69b9c182239bfa954fe6aa5abd8734e9f4a36240eb17b56e91016f43078e4e9dd12684f73a9dfd0db2c6 - languageName: node - linkType: hard - -"gopd@npm:^1.0.1": - version: 1.0.1 - resolution: "gopd@npm:1.0.1" - dependencies: - get-intrinsic: "npm:^1.1.3" - checksum: 10c0/505c05487f7944c552cee72087bf1567debb470d4355b1335f2c262d218ebbff805cd3715448fe29b4b380bae6912561d0467233e4165830efd28da241418c63 + checksum: 10c0/ff27a5f045b84c50c7c539f45d36c4373c0cc58a39a46fb77976f456c4029238b8cc08f83368e4491c381a67774bc3d42534b68e8eda487c87efc22e84edf6d3 languageName: node linkType: hard @@ -3089,13 +1980,6 @@ __metadata: languageName: node linkType: hard -"graphemer@npm:^1.4.0": - version: 1.4.0 - resolution: "graphemer@npm:1.4.0" - checksum: 10c0/e951259d8cd2e0d196c72ec711add7115d42eb9a8146c8eeda5b8d3ac91e5dd816b9cd68920726d9fd4490368e7ed86e9c423f40db87e2d8dfafa00fa17c3a31 - languageName: node - linkType: hard - "gtoken@npm:^7.0.0": version: 7.1.0 resolution: "gtoken@npm:7.1.0" @@ -3106,13 +1990,6 @@ __metadata: languageName: node linkType: hard -"has-bigints@npm:^1.0.1, has-bigints@npm:^1.0.2": - version: 1.0.2 - resolution: "has-bigints@npm:1.0.2" - checksum: 10c0/724eb1485bfa3cdff6f18d95130aa190561f00b3fcf9f19dc640baf8176b5917c143b81ec2123f8cddb6c05164a198c94b13e1377c497705ccc8e1a80306e83b - languageName: node - linkType: hard - "has-flag@npm:^3.0.0": version: 3.0.0 resolution: "has-flag@npm:3.0.0" @@ -3120,54 +1997,6 @@ __metadata: languageName: node linkType: hard -"has-flag@npm:^4.0.0": - version: 4.0.0 - resolution: "has-flag@npm:4.0.0" - checksum: 10c0/2e789c61b7888d66993e14e8331449e525ef42aac53c627cc53d1c3334e768bcb6abdc4f5f0de1478a25beec6f0bd62c7549058b7ac53e924040d4f301f02fd1 - languageName: node - linkType: hard - -"has-property-descriptors@npm:^1.0.0, has-property-descriptors@npm:^1.0.2": - version: 1.0.2 - resolution: "has-property-descriptors@npm:1.0.2" - dependencies: - es-define-property: "npm:^1.0.0" - checksum: 10c0/253c1f59e80bb476cf0dde8ff5284505d90c3bdb762983c3514d36414290475fe3fd6f574929d84de2a8eec00d35cf07cb6776205ff32efd7c50719125f00236 - languageName: node - linkType: hard - -"has-proto@npm:^1.0.1, has-proto@npm:^1.0.3": - version: 1.0.3 - resolution: "has-proto@npm:1.0.3" - checksum: 10c0/35a6989f81e9f8022c2f4027f8b48a552de714938765d019dbea6bb547bd49ce5010a3c7c32ec6ddac6e48fc546166a3583b128f5a7add8b058a6d8b4afec205 - languageName: node - linkType: hard - -"has-symbols@npm:^1.0.2, has-symbols@npm:^1.0.3": - version: 1.0.3 - resolution: "has-symbols@npm:1.0.3" - checksum: 10c0/e6922b4345a3f37069cdfe8600febbca791c94988c01af3394d86ca3360b4b93928bbf395859158f88099cb10b19d98e3bbab7c9ff2c1bd09cf665ee90afa2c3 - languageName: node - linkType: hard - -"has-tostringtag@npm:^1.0.0, has-tostringtag@npm:^1.0.2": - version: 1.0.2 - resolution: "has-tostringtag@npm:1.0.2" - dependencies: - has-symbols: "npm:^1.0.3" - checksum: 10c0/a8b166462192bafe3d9b6e420a1d581d93dd867adb61be223a17a8d6dad147aa77a8be32c961bb2f27b3ef893cae8d36f564ab651f5e9b7938ae86f74027c48c - languageName: node - linkType: hard - -"hasown@npm:^2.0.0, hasown@npm:^2.0.1, hasown@npm:^2.0.2": - version: 2.0.2 - resolution: "hasown@npm:2.0.2" - dependencies: - function-bind: "npm:^1.1.2" - checksum: 10c0/3769d434703b8ac66b209a4cca0737519925bbdb61dd887f93a16372b14694c63ff4e797686d87c90f08168e81082248b9b028bad60d4da9e0d1148766f56eb9 - languageName: node - linkType: hard - "html-entities@npm:^2.5.2": version: 2.5.2 resolution: "html-entities@npm:2.5.2" @@ -3221,12 +2050,12 @@ __metadata: linkType: hard "https-proxy-agent@npm:^7.0.1": - version: 7.0.4 - resolution: "https-proxy-agent@npm:7.0.4" + version: 7.0.5 + resolution: "https-proxy-agent@npm:7.0.5" dependencies: agent-base: "npm:^7.0.2" debug: "npm:4" - checksum: 10c0/bc4f7c38da32a5fc622450b6cb49a24ff596f9bd48dcedb52d2da3fa1c1a80e100fb506bd59b326c012f21c863c69b275c23de1a01d0b84db396822fdf25e52b + checksum: 10c0/2490e3acec397abeb88807db52cac59102d5ed758feee6df6112ab3ccd8325e8a1ce8bce6f4b66e5470eca102d31e425ace904242e4fa28dbe0c59c4bafa7b2c languageName: node linkType: hard @@ -3253,23 +2082,6 @@ __metadata: languageName: node linkType: hard -"ignore@npm:^5.2.0, ignore@npm:^5.3.1": - version: 5.3.1 - resolution: "ignore@npm:5.3.1" - checksum: 10c0/703f7f45ffb2a27fb2c5a8db0c32e7dee66b33a225d28e8db4e1be6474795f606686a6e3bcc50e1aa12f2042db4c9d4a7d60af3250511de74620fbed052ea4cd - languageName: node - linkType: hard - -"import-fresh@npm:^3.2.1": - version: 3.3.0 - resolution: "import-fresh@npm:3.3.0" - dependencies: - parent-module: "npm:^1.0.0" - resolve-from: "npm:^4.0.0" - checksum: 10c0/7f882953aa6b740d1f0e384d0547158bc86efbf2eea0f1483b8900a6f65c5a5123c2cf09b0d542cc419d0b98a759ecaeb394237e97ea427f2da221dc3cd80cc3 - languageName: node - linkType: hard - "imurmurhash@npm:^0.1.4": version: 0.1.4 resolution: "imurmurhash@npm:0.1.4" @@ -3291,17 +2103,6 @@ __metadata: languageName: node linkType: hard -"internal-slot@npm:^1.0.7": - version: 1.0.7 - resolution: "internal-slot@npm:1.0.7" - dependencies: - es-errors: "npm:^1.3.0" - hasown: "npm:^2.0.0" - side-channel: "npm:^1.0.4" - checksum: 10c0/f8b294a4e6ea3855fc59551bbf35f2b832cf01fd5e6e2a97f5c201a071cc09b49048f856e484b67a6c721da5e55736c5b6ddafaf19e2dbeb4a3ff1821680de6c - languageName: node - linkType: hard - "ip-address@npm:^9.0.5": version: 9.0.5 resolution: "ip-address@npm:9.0.5" @@ -3312,25 +2113,6 @@ __metadata: languageName: node linkType: hard -"is-array-buffer@npm:^3.0.4": - version: 3.0.4 - resolution: "is-array-buffer@npm:3.0.4" - dependencies: - call-bind: "npm:^1.0.2" - get-intrinsic: "npm:^1.2.1" - checksum: 10c0/42a49d006cc6130bc5424eae113e948c146f31f9d24460fc0958f855d9d810e6fd2e4519bf19aab75179af9c298ea6092459d8cafdec523cd19e529b26eab860 - languageName: node - linkType: hard - -"is-bigint@npm:^1.0.1": - version: 1.0.4 - resolution: "is-bigint@npm:1.0.4" - dependencies: - has-bigints: "npm:^1.0.1" - checksum: 10c0/eb9c88e418a0d195ca545aff2b715c9903d9b0a5033bc5922fec600eb0c3d7b1ee7f882dbf2e0d5a6e694e42391be3683e4368737bd3c4a77f8ac293e7773696 - languageName: node - linkType: hard - "is-binary-path@npm:~2.1.0": version: 2.1.0 resolution: "is-binary-path@npm:2.1.0" @@ -3340,50 +2122,6 @@ __metadata: languageName: node linkType: hard -"is-boolean-object@npm:^1.1.0": - version: 1.1.2 - resolution: "is-boolean-object@npm:1.1.2" - dependencies: - call-bind: "npm:^1.0.2" - has-tostringtag: "npm:^1.0.0" - checksum: 10c0/6090587f8a8a8534c0f816da868bc94f32810f08807aa72fa7e79f7e11c466d281486ffe7a788178809c2aa71fe3e700b167fe80dd96dad68026bfff8ebf39f7 - languageName: node - linkType: hard - -"is-callable@npm:^1.1.3, is-callable@npm:^1.1.4, is-callable@npm:^1.2.7": - version: 1.2.7 - resolution: "is-callable@npm:1.2.7" - checksum: 10c0/ceebaeb9d92e8adee604076971dd6000d38d6afc40bb843ea8e45c5579b57671c3f3b50d7f04869618242c6cee08d1b67806a8cb8edaaaf7c0748b3720d6066f - languageName: node - linkType: hard - -"is-core-module@npm:^2.13.0, is-core-module@npm:^2.13.1": - version: 2.13.1 - resolution: "is-core-module@npm:2.13.1" - dependencies: - hasown: "npm:^2.0.0" - checksum: 10c0/2cba9903aaa52718f11c4896dabc189bab980870aae86a62dc0d5cedb546896770ee946fb14c84b7adf0735f5eaea4277243f1b95f5cefa90054f92fbcac2518 - languageName: node - linkType: hard - -"is-data-view@npm:^1.0.1": - version: 1.0.1 - resolution: "is-data-view@npm:1.0.1" - dependencies: - is-typed-array: "npm:^1.1.13" - checksum: 10c0/a3e6ec84efe303da859107aed9b970e018e2bee7ffcb48e2f8096921a493608134240e672a2072577e5f23a729846241d9634806e8a0e51d9129c56d5f65442d - languageName: node - linkType: hard - -"is-date-object@npm:^1.0.1": - version: 1.0.5 - resolution: "is-date-object@npm:1.0.5" - dependencies: - has-tostringtag: "npm:^1.0.0" - checksum: 10c0/eed21e5dcc619c48ccef804dfc83a739dbb2abee6ca202838ee1bd5f760fe8d8a93444f0d49012ad19bb7c006186e2884a1b92f6e1c056da7fd23d0a9ad5992e - languageName: node - linkType: hard - "is-extglob@npm:^2.1.1": version: 2.1.1 resolution: "is-extglob@npm:2.1.1" @@ -3398,7 +2136,7 @@ __metadata: languageName: node linkType: hard -"is-glob@npm:^4.0.0, is-glob@npm:^4.0.1, is-glob@npm:^4.0.3, is-glob@npm:~4.0.1": +"is-glob@npm:^4.0.1, is-glob@npm:~4.0.1": version: 4.0.3 resolution: "is-glob@npm:4.0.3" dependencies: @@ -3414,22 +2152,6 @@ __metadata: languageName: node linkType: hard -"is-negative-zero@npm:^2.0.3": - version: 2.0.3 - resolution: "is-negative-zero@npm:2.0.3" - checksum: 10c0/bcdcf6b8b9714063ffcfa9929c575ac69bfdabb8f4574ff557dfc086df2836cf07e3906f5bbc4f2a5c12f8f3ba56af640c843cdfc74da8caed86c7c7d66fd08e - languageName: node - linkType: hard - -"is-number-object@npm:^1.0.4": - version: 1.0.7 - resolution: "is-number-object@npm:1.0.7" - dependencies: - has-tostringtag: "npm:^1.0.0" - checksum: 10c0/aad266da1e530f1804a2b7bd2e874b4869f71c98590b3964f9d06cc9869b18f8d1f4778f838ecd2a11011bce20aeecb53cb269ba916209b79c24580416b74b1b - languageName: node - linkType: hard - "is-number@npm:^7.0.0": version: 7.0.0 resolution: "is-number@npm:7.0.0" @@ -3437,32 +2159,6 @@ __metadata: languageName: node linkType: hard -"is-path-inside@npm:^3.0.3": - version: 3.0.3 - resolution: "is-path-inside@npm:3.0.3" - checksum: 10c0/cf7d4ac35fb96bab6a1d2c3598fe5ebb29aafb52c0aaa482b5a3ed9d8ba3edc11631e3ec2637660c44b3ce0e61a08d54946e8af30dec0b60a7c27296c68ffd05 - languageName: node - linkType: hard - -"is-regex@npm:^1.1.4": - version: 1.1.4 - resolution: "is-regex@npm:1.1.4" - dependencies: - call-bind: "npm:^1.0.2" - has-tostringtag: "npm:^1.0.0" - checksum: 10c0/bb72aae604a69eafd4a82a93002058c416ace8cde95873589a97fc5dac96a6c6c78a9977d487b7b95426a8f5073969124dd228f043f9f604f041f32fcc465fc1 - languageName: node - linkType: hard - -"is-shared-array-buffer@npm:^1.0.2, is-shared-array-buffer@npm:^1.0.3": - version: 1.0.3 - resolution: "is-shared-array-buffer@npm:1.0.3" - dependencies: - call-bind: "npm:^1.0.7" - checksum: 10c0/adc11ab0acbc934a7b9e5e9d6c588d4ec6682f6fea8cda5180721704fa32927582ede5b123349e32517fdadd07958973d24716c80e7ab198970c47acc09e59c7 - languageName: node - linkType: hard - "is-stream@npm:^2.0.0": version: 2.0.1 resolution: "is-stream@npm:2.0.1" @@ -3470,49 +2166,6 @@ __metadata: languageName: node linkType: hard -"is-string@npm:^1.0.5, is-string@npm:^1.0.7": - version: 1.0.7 - resolution: "is-string@npm:1.0.7" - dependencies: - has-tostringtag: "npm:^1.0.0" - checksum: 10c0/905f805cbc6eedfa678aaa103ab7f626aac9ebbdc8737abb5243acaa61d9820f8edc5819106b8fcd1839e33db21de9f0116ae20de380c8382d16dc2a601921f6 - languageName: node - linkType: hard - -"is-symbol@npm:^1.0.2, is-symbol@npm:^1.0.3": - version: 1.0.4 - resolution: "is-symbol@npm:1.0.4" - dependencies: - has-symbols: "npm:^1.0.2" - checksum: 10c0/9381dd015f7c8906154dbcbf93fad769de16b4b961edc94f88d26eb8c555935caa23af88bda0c93a18e65560f6d7cca0fd5a3f8a8e1df6f1abbb9bead4502ef7 - languageName: node - linkType: hard - -"is-typed-array@npm:^1.1.13": - version: 1.1.13 - resolution: "is-typed-array@npm:1.1.13" - dependencies: - which-typed-array: "npm:^1.1.14" - checksum: 10c0/fa5cb97d4a80e52c2cc8ed3778e39f175a1a2ae4ddf3adae3187d69586a1fd57cfa0b095db31f66aa90331e9e3da79184cea9c6abdcd1abc722dc3c3edd51cca - languageName: node - linkType: hard - -"is-weakref@npm:^1.0.2": - version: 1.0.2 - resolution: "is-weakref@npm:1.0.2" - dependencies: - call-bind: "npm:^1.0.2" - checksum: 10c0/1545c5d172cb690c392f2136c23eec07d8d78a7f57d0e41f10078aa4f5daf5d7f57b6513a67514ab4f073275ad00c9822fc8935e00229d0a2089e1c02685d4b1 - languageName: node - linkType: hard - -"isarray@npm:^2.0.5": - version: 2.0.5 - resolution: "isarray@npm:2.0.5" - checksum: 10c0/4199f14a7a13da2177c66c31080008b7124331956f47bca57dd0b6ea9f11687aa25e565a2c7a2b519bc86988d10398e3049a1f5df13c9f6b7664154690ae79fd - languageName: node - linkType: hard - "isexe@npm:^2.0.0": version: 2.0.0 resolution: "isexe@npm:2.0.0" @@ -3531,60 +2184,38 @@ __metadata: version: 0.0.0-use.local resolution: "its-discord-auth@workspace:." dependencies: - "@eslint/js": "npm:^9.9.1" + "@biomejs/biome": "npm:1.9.2" "@types/uuid": "npm:^10.0.0" - "@typescript-eslint/eslint-plugin": "npm:^7.18.0" - "@typescript-eslint/parser": "npm:^7.18.0" cron: "npm:^3.1.7" discord.js: "npm:^14.15.3" dotenv: "npm:^16.4.5" - eslint: "npm:^9.9.1" - eslint-config-prettier: "npm:^9.1.0" - eslint-plugin-import: "npm:^2.29.1" - eslint-plugin-prettier: "npm:^5.2.1" - eslint-plugin-sort-keys-fix: "npm:^1.1.2" - eslint-plugin-typescript-sort-keys: "npm:^3.2.0" - eslint-plugin-unused-imports: "npm:^4.1.3" firebase: "npm:^10.13.1" firebase-admin: "npm:^12.4.0" globals: "npm:^15.9.0" nodemon: "npm:^3.1.4" - prettier: "npm:^3.3.3" ts-node: "npm:^10.9.2" typescript: "npm:^5.5.4" - typescript-eslint: "npm:^7.18.0" uuid: "npm:^10.0.0" languageName: unknown linkType: soft "jackspeak@npm:^3.1.2": - version: 3.3.0 - resolution: "jackspeak@npm:3.3.0" + version: 3.4.3 + resolution: "jackspeak@npm:3.4.3" dependencies: "@isaacs/cliui": "npm:^8.0.2" "@pkgjs/parseargs": "npm:^0.11.0" dependenciesMeta: "@pkgjs/parseargs": optional: true - checksum: 10c0/e0d604cd9f360f0589149be3392a4815a78316bd57136339ffe3c430aa011a2cc92647f824a521366dd15482833c6ce4f32c232f0a919187a58ced820a23c1ee + checksum: 10c0/6acc10d139eaefdbe04d2f679e6191b3abf073f111edf10b1de5302c97ec93fffeb2fdd8681ed17f16268aa9dd4f8c588ed9d1d3bffbbfa6e8bf897cbb3149b9 languageName: node linkType: hard "jose@npm:^4.14.6": - version: 4.15.5 - resolution: "jose@npm:4.15.5" - checksum: 10c0/9f208492f55ae9c547fd407c36f67ec3385051b5ca390e24f5449740f17359640b3f96fabfd38bc132cc4292b964c31b921bf356253373b1bd3eb6df799b7433 - languageName: node - linkType: hard - -"js-yaml@npm:^4.1.0": - version: 4.1.0 - resolution: "js-yaml@npm:4.1.0" - dependencies: - argparse: "npm:^2.0.1" - bin: - js-yaml: bin/js-yaml.js - checksum: 10c0/184a24b4eaacfce40ad9074c64fd42ac83cf74d8c8cd137718d456ced75051229e5061b8633c3366b8aada17945a7a356b337828c19da92b51ae62126575018f + version: 4.15.9 + resolution: "jose@npm:4.15.9" + checksum: 10c0/4ed4ddf4a029db04bd167f2215f65d7245e4dc5f36d7ac3c0126aab38d66309a9e692f52df88975d99429e357e5fd8bab340ff20baab544d17684dd1d940a0f4 languageName: node linkType: hard @@ -3604,45 +2235,6 @@ __metadata: languageName: node linkType: hard -"json-buffer@npm:3.0.1": - version: 3.0.1 - resolution: "json-buffer@npm:3.0.1" - checksum: 10c0/0d1c91569d9588e7eef2b49b59851f297f3ab93c7b35c7c221e288099322be6b562767d11e4821da500f3219542b9afd2e54c5dc573107c1126ed1080f8e96d7 - languageName: node - linkType: hard - -"json-schema-traverse@npm:^0.4.1": - version: 0.4.1 - resolution: "json-schema-traverse@npm:0.4.1" - checksum: 10c0/108fa90d4cc6f08243aedc6da16c408daf81793bf903e9fd5ab21983cda433d5d2da49e40711da016289465ec2e62e0324dcdfbc06275a607fe3233fde4942ce - languageName: node - linkType: hard - -"json-schema@npm:^0.4.0": - version: 0.4.0 - resolution: "json-schema@npm:0.4.0" - checksum: 10c0/d4a637ec1d83544857c1c163232f3da46912e971d5bf054ba44fdb88f07d8d359a462b4aec46f2745efbc57053365608d88bc1d7b1729f7b4fc3369765639ed3 - languageName: node - linkType: hard - -"json-stable-stringify-without-jsonify@npm:^1.0.1": - version: 1.0.1 - resolution: "json-stable-stringify-without-jsonify@npm:1.0.1" - checksum: 10c0/cb168b61fd4de83e58d09aaa6425ef71001bae30d260e2c57e7d09a5fd82223e2f22a042dedaab8db23b7d9ae46854b08bb1f91675a8be11c5cffebef5fb66a5 - languageName: node - linkType: hard - -"json5@npm:^1.0.2": - version: 1.0.2 - resolution: "json5@npm:1.0.2" - dependencies: - minimist: "npm:^1.2.0" - bin: - json5: lib/cli.js - checksum: 10c0/9ee316bf21f000b00752e6c2a3b79ecf5324515a5c60ee88983a1910a45426b643a4f3461657586e8aeca87aaf96f0a519b0516d2ae527a6c3e7eed80f68717f - languageName: node - linkType: hard - "jsonwebtoken@npm:^9.0.0": version: 9.0.2 resolution: "jsonwebtoken@npm:9.0.2" @@ -3717,25 +2309,6 @@ __metadata: languageName: node linkType: hard -"keyv@npm:^4.5.4": - version: 4.5.4 - resolution: "keyv@npm:4.5.4" - dependencies: - json-buffer: "npm:3.0.1" - checksum: 10c0/aa52f3c5e18e16bb6324876bb8b59dd02acf782a4b789c7b2ae21107fab95fab3890ed448d4f8dba80ce05391eeac4bfabb4f02a20221342982f806fa2cf271e - languageName: node - linkType: hard - -"levn@npm:^0.4.1": - version: 0.4.1 - resolution: "levn@npm:0.4.1" - dependencies: - prelude-ls: "npm:^1.2.1" - type-check: "npm:~0.4.0" - checksum: 10c0/effb03cad7c89dfa5bd4f6989364bfc79994c2042ec5966cb9b95990e2edee5cd8969ddf42616a0373ac49fac1403437deaf6e9050fbbaa3546093a59b9ac94e - languageName: node - linkType: hard - "limiter@npm:^1.1.5": version: 1.1.5 resolution: "limiter@npm:1.1.5" @@ -3743,15 +2316,6 @@ __metadata: languageName: node linkType: hard -"locate-path@npm:^6.0.0": - version: 6.0.0 - resolution: "locate-path@npm:6.0.0" - dependencies: - p-locate: "npm:^5.0.0" - checksum: 10c0/d3972ab70dfe58ce620e64265f90162d247e87159b6126b01314dd67be43d50e96a50b517bce2d9452a79409c7614054c277b5232377de50416564a77ac7aad3 - languageName: node - linkType: hard - "lodash.camelcase@npm:^4.3.0": version: 4.3.0 resolution: "lodash.camelcase@npm:4.3.0" @@ -3808,13 +2372,6 @@ __metadata: languageName: node linkType: hard -"lodash.merge@npm:^4.6.2": - version: 4.6.2 - resolution: "lodash.merge@npm:4.6.2" - checksum: 10c0/402fa16a1edd7538de5b5903a90228aa48eb5533986ba7fa26606a49db2572bf414ff73a2c9f5d5fd36b31c46a5d5c7e1527749c07cbcf965ccff5fbdf32c506 - languageName: node - linkType: hard - "lodash.once@npm:^4.0.0": version: 4.1.1 resolution: "lodash.once@npm:4.1.1" @@ -3853,9 +2410,9 @@ __metadata: linkType: hard "lru-cache@npm:^10.0.1, lru-cache@npm:^10.2.0": - version: 10.2.2 - resolution: "lru-cache@npm:10.2.2" - checksum: 10c0/402d31094335851220d0b00985084288136136992979d0e015f0f1697e15d1c86052d7d53ae86b614e5b058425606efffc6969a31a091085d7a2b80a8a1e26d6 + version: 10.4.3 + resolution: "lru-cache@npm:10.4.3" + checksum: 10c0/ebd04fbca961e6c1d6c0af3799adcc966a1babe798f685bb84e6599266599cd95d94630b10262f5424539bc4640107e8a33aa28585374abf561d30d16f4b39fb languageName: node linkType: hard @@ -3910,23 +2467,6 @@ __metadata: languageName: node linkType: hard -"merge2@npm:^1.3.0, merge2@npm:^1.4.1": - version: 1.4.1 - resolution: "merge2@npm:1.4.1" - checksum: 10c0/254a8a4605b58f450308fc474c82ac9a094848081bf4c06778200207820e5193726dc563a0d2c16468810516a5c97d9d3ea0ca6585d23c58ccfff2403e8dbbeb - languageName: node - linkType: hard - -"micromatch@npm:^4.0.4": - version: 4.0.7 - resolution: "micromatch@npm:4.0.7" - dependencies: - braces: "npm:^3.0.3" - picomatch: "npm:^2.3.1" - checksum: 10c0/58fa99bc5265edec206e9163a1d2cec5fabc46a5b473c45f4a700adce88c2520456ae35f2b301e4410fb3afb27e9521fb2813f6fc96be0a48a89430e0916a772 - languageName: node - linkType: hard - "mime-db@npm:1.52.0": version: 1.52.0 resolution: "mime-db@npm:1.52.0" @@ -3962,18 +2502,11 @@ __metadata: linkType: hard "minimatch@npm:^9.0.4": - version: 9.0.4 - resolution: "minimatch@npm:9.0.4" + version: 9.0.5 + resolution: "minimatch@npm:9.0.5" dependencies: brace-expansion: "npm:^2.0.1" - checksum: 10c0/2c16f21f50e64922864e560ff97c587d15fd491f65d92a677a344e970fe62aafdbeafe648965fa96d33c061b4d0eabfe0213466203dd793367e7f28658cf6414 - languageName: node - linkType: hard - -"minimist@npm:^1.2.0, minimist@npm:^1.2.6": - version: 1.2.8 - resolution: "minimist@npm:1.2.8" - checksum: 10c0/19d3fcdca050087b84c2029841a093691a91259a47def2f18222f41e7645a0b7c44ef4b40e88a1e58a40c84d2ef0ee6047c55594d298146d0eb3f6b737c20ce6 + checksum: 10c0/de96cf5e35bdf0eab3e2c853522f98ffbe9a36c37797778d2665231ec1f20a9447a7e567cb640901f89e4daaa95ae5d70c65a9e8aa2bb0019b6facbc3c0575ed languageName: node linkType: hard @@ -4070,34 +2603,13 @@ __metadata: languageName: node linkType: hard -"ms@npm:2.1.2": - version: 2.1.2 - resolution: "ms@npm:2.1.2" - checksum: 10c0/a437714e2f90dbf881b5191d35a6db792efbca5badf112f87b9e1c712aace4b4b9b742dd6537f3edf90fd6f684de897cec230abde57e87883766712ddda297cc - languageName: node - linkType: hard - -"ms@npm:^2.1.1": +"ms@npm:^2.1.1, ms@npm:^2.1.3": version: 2.1.3 resolution: "ms@npm:2.1.3" checksum: 10c0/d924b57e7312b3b63ad21fc5b3dc0af5e78d61a1fc7cfb5457edaf26326bf62be5307cc87ffb6862ef1c2b33b0233cdb5d4f01c4c958cc0d660948b65a287a48 languageName: node linkType: hard -"natural-compare-lite@npm:^1.4.0": - version: 1.4.0 - resolution: "natural-compare-lite@npm:1.4.0" - checksum: 10c0/f6cef26f5044515754802c0fc475d81426f3b90fe88c20fabe08771ce1f736ce46e0397c10acb569a4dd0acb84c7f1ee70676122f95d5bfdd747af3a6c6bbaa8 - languageName: node - linkType: hard - -"natural-compare@npm:^1.4.0": - version: 1.4.0 - resolution: "natural-compare@npm:1.4.0" - checksum: 10c0/f5f9a7974bfb28a91afafa254b197f0f22c684d4a1731763dda960d2c8e375b36c7d690e0d9dc8fba774c537af14a7e979129bca23d88d052fbeb9466955e447 - languageName: node - linkType: hard - "negotiator@npm:^0.6.3": version: 0.6.3 resolution: "negotiator@npm:0.6.3" @@ -4105,7 +2617,7 @@ __metadata: languageName: node linkType: hard -"node-fetch@npm:^2.6.1, node-fetch@npm:^2.6.9": +"node-fetch@npm:^2.6.9, node-fetch@npm:^2.7.0": version: 2.7.0 resolution: "node-fetch@npm:2.7.0" dependencies: @@ -4127,8 +2639,8 @@ __metadata: linkType: hard "node-gyp@npm:latest": - version: 10.1.0 - resolution: "node-gyp@npm:10.1.0" + version: 10.2.0 + resolution: "node-gyp@npm:10.2.0" dependencies: env-paths: "npm:^2.2.0" exponential-backoff: "npm:^3.1.1" @@ -4136,19 +2648,19 @@ __metadata: graceful-fs: "npm:^4.2.6" make-fetch-happen: "npm:^13.0.0" nopt: "npm:^7.0.0" - proc-log: "npm:^3.0.0" + proc-log: "npm:^4.1.0" semver: "npm:^7.3.5" - tar: "npm:^6.1.2" + tar: "npm:^6.2.1" which: "npm:^4.0.0" bin: node-gyp: bin/node-gyp.js - checksum: 10c0/9cc821111ca244a01fb7f054db7523ab0a0cd837f665267eb962eb87695d71fb1e681f9e21464cc2fd7c05530dc4c81b810bca1a88f7d7186909b74477491a3c + checksum: 10c0/00630d67dbd09a45aee0a5d55c05e3916ca9e6d427ee4f7bc392d2d3dc5fad7449b21fc098dd38260a53d9dcc9c879b36704a1994235d4707e7271af7e9a835b languageName: node linkType: hard "nodemon@npm:^3.1.4": - version: 3.1.4 - resolution: "nodemon@npm:3.1.4" + version: 3.1.7 + resolution: "nodemon@npm:3.1.7" dependencies: chokidar: "npm:^3.5.2" debug: "npm:^4" @@ -4162,7 +2674,7 @@ __metadata: undefsafe: "npm:^2.0.5" bin: nodemon: bin/nodemon.js - checksum: 10c0/be2335396a4c25549f86e9c69bb57e6a21758a9649d74182a359d88b80afbe84f67a1651e293a08c6d77ecdf5c6224d02990de9de225f70d7c659021206c877f + checksum: 10c0/e0b46939abdbce251b1d6281005a5763cee57db295bb00bc4a753b0f5320dac00fe53547fb6764c70a086cf6d1238875cccb800fbc71544b3ecbd3ef71183c87 languageName: node linkType: hard @@ -4191,66 +2703,6 @@ __metadata: languageName: node linkType: hard -"object-inspect@npm:^1.13.1": - version: 1.13.1 - resolution: "object-inspect@npm:1.13.1" - checksum: 10c0/fad603f408e345c82e946abdf4bfd774260a5ed3e5997a0b057c44153ac32c7271ff19e3a5ae39c858da683ba045ccac2f65245c12763ce4e8594f818f4a648d - languageName: node - linkType: hard - -"object-keys@npm:^1.1.1": - version: 1.1.1 - resolution: "object-keys@npm:1.1.1" - checksum: 10c0/b11f7ccdbc6d406d1f186cdadb9d54738e347b2692a14439ca5ac70c225fa6db46db809711b78589866d47b25fc3e8dee0b4c722ac751e11180f9380e3d8601d - languageName: node - linkType: hard - -"object.assign@npm:^4.1.5": - version: 4.1.5 - resolution: "object.assign@npm:4.1.5" - dependencies: - call-bind: "npm:^1.0.5" - define-properties: "npm:^1.2.1" - has-symbols: "npm:^1.0.3" - object-keys: "npm:^1.1.1" - checksum: 10c0/60108e1fa2706f22554a4648299b0955236c62b3685c52abf4988d14fffb0e7731e00aa8c6448397e3eb63d087dcc124a9f21e1980f36d0b2667f3c18bacd469 - languageName: node - linkType: hard - -"object.fromentries@npm:^2.0.7": - version: 2.0.8 - resolution: "object.fromentries@npm:2.0.8" - dependencies: - call-bind: "npm:^1.0.7" - define-properties: "npm:^1.2.1" - es-abstract: "npm:^1.23.2" - es-object-atoms: "npm:^1.0.0" - checksum: 10c0/cd4327e6c3369cfa805deb4cbbe919bfb7d3aeebf0bcaba291bb568ea7169f8f8cdbcabe2f00b40db0c20cd20f08e11b5f3a5a36fb7dd3fe04850c50db3bf83b - languageName: node - linkType: hard - -"object.groupby@npm:^1.0.1": - version: 1.0.3 - resolution: "object.groupby@npm:1.0.3" - dependencies: - call-bind: "npm:^1.0.7" - define-properties: "npm:^1.2.1" - es-abstract: "npm:^1.23.2" - checksum: 10c0/60d0455c85c736fbfeda0217d1a77525956f76f7b2495edeca9e9bbf8168a45783199e77b894d30638837c654d0cc410e0e02cbfcf445bc8de71c3da1ede6a9c - languageName: node - linkType: hard - -"object.values@npm:^1.1.7": - version: 1.2.0 - resolution: "object.values@npm:1.2.0" - dependencies: - call-bind: "npm:^1.0.7" - define-properties: "npm:^1.2.1" - es-object-atoms: "npm:^1.0.0" - checksum: 10c0/15809dc40fd6c5529501324fec5ff08570b7d70fb5ebbe8e2b3901afec35cf2b3dc484d1210c6c642cd3e7e0a5e18dd1d6850115337fef46bdae14ab0cb18ac3 - languageName: node - linkType: hard - "once@npm:^1.4.0": version: 1.4.0 resolution: "once@npm:1.4.0" @@ -4260,21 +2712,7 @@ __metadata: languageName: node linkType: hard -"optionator@npm:^0.9.3": - version: 0.9.4 - resolution: "optionator@npm:0.9.4" - dependencies: - deep-is: "npm:^0.1.3" - fast-levenshtein: "npm:^2.0.6" - levn: "npm:^0.4.1" - prelude-ls: "npm:^1.2.1" - type-check: "npm:^0.4.0" - word-wrap: "npm:^1.2.5" - checksum: 10c0/4afb687a059ee65b61df74dfe87d8d6815cd6883cb8b3d5883a910df72d0f5d029821f37025e4bccf4048873dbdb09acc6d303d27b8f76b1a80dd5a7d5334675 - languageName: node - linkType: hard - -"p-limit@npm:^3.0.1, p-limit@npm:^3.0.2": +"p-limit@npm:^3.0.1": version: 3.1.0 resolution: "p-limit@npm:3.1.0" dependencies: @@ -4283,15 +2721,6 @@ __metadata: languageName: node linkType: hard -"p-locate@npm:^5.0.0": - version: 5.0.0 - resolution: "p-locate@npm:5.0.0" - dependencies: - p-limit: "npm:^3.0.2" - checksum: 10c0/2290d627ab7903b8b70d11d384fee714b797f6040d9278932754a6860845c4d3190603a0772a663c8cb5a7b21d1b16acb3a6487ebcafa9773094edc3dfe6009a - languageName: node - linkType: hard - "p-map@npm:^4.0.0": version: 4.0.0 resolution: "p-map@npm:4.0.0" @@ -4301,19 +2730,10 @@ __metadata: languageName: node linkType: hard -"parent-module@npm:^1.0.0": +"package-json-from-dist@npm:^1.0.0": version: 1.0.1 - resolution: "parent-module@npm:1.0.1" - dependencies: - callsites: "npm:^3.0.0" - checksum: 10c0/c63d6e80000d4babd11978e0d3fee386ca7752a02b035fd2435960ffaa7219dc42146f07069fb65e6e8bf1caef89daf9af7535a39bddf354d78bf50d8294f556 - languageName: node - linkType: hard - -"path-exists@npm:^4.0.0": - version: 4.0.0 - resolution: "path-exists@npm:4.0.0" - checksum: 10c0/8c0bd3f5238188197dc78dced15207a4716c51cc4e3624c44fc97acf69558f5ebb9a2afff486fe1b4ee148e0c133e96c5e11a9aa5c48a3006e3467da070e5e1b + resolution: "package-json-from-dist@npm:1.0.1" + checksum: 10c0/62ba2785eb655fec084a257af34dbe24292ab74516d6aecef97ef72d4897310bc6898f6c85b5cd22770eaa1ce60d55a0230e150fb6a966e3ecd6c511e23d164b languageName: node linkType: hard @@ -4324,13 +2744,6 @@ __metadata: languageName: node linkType: hard -"path-parse@npm:^1.0.7": - version: 1.0.7 - resolution: "path-parse@npm:1.0.7" - checksum: 10c0/11ce261f9d294cc7a58d6a574b7f1b935842355ec66fba3c3fd79e0f036462eaf07d0aa95bb74ff432f9afef97ce1926c720988c6a7451d8a584930ae7de86e1 - languageName: node - linkType: hard - "path-scurry@npm:^1.11.1": version: 1.11.1 resolution: "path-scurry@npm:1.11.1" @@ -4341,60 +2754,14 @@ __metadata: languageName: node linkType: hard -"path-type@npm:^4.0.0": - version: 4.0.0 - resolution: "path-type@npm:4.0.0" - checksum: 10c0/666f6973f332f27581371efaf303fd6c272cc43c2057b37aa99e3643158c7e4b2626549555d88626e99ea9e046f82f32e41bbde5f1508547e9a11b149b52387c - languageName: node - linkType: hard - -"picomatch@npm:^2.0.4, picomatch@npm:^2.2.1, picomatch@npm:^2.3.1": +"picomatch@npm:^2.0.4, picomatch@npm:^2.2.1": version: 2.3.1 resolution: "picomatch@npm:2.3.1" checksum: 10c0/26c02b8d06f03206fc2ab8d16f19960f2ff9e81a658f831ecb656d8f17d9edc799e8364b1f4a7873e89d9702dff96204be0fa26fe4181f6843f040f819dac4be languageName: node linkType: hard -"possible-typed-array-names@npm:^1.0.0": - version: 1.0.0 - resolution: "possible-typed-array-names@npm:1.0.0" - checksum: 10c0/d9aa22d31f4f7680e20269db76791b41c3a32c01a373e25f8a4813b4d45f7456bfc2b6d68f752dc4aab0e0bb0721cb3d76fb678c9101cb7a16316664bc2c73fd - languageName: node - linkType: hard - -"prelude-ls@npm:^1.2.1": - version: 1.2.1 - resolution: "prelude-ls@npm:1.2.1" - checksum: 10c0/b00d617431e7886c520a6f498a2e14c75ec58f6d93ba48c3b639cf241b54232d90daa05d83a9e9b9fef6baa63cb7e1e4602c2372fea5bc169668401eb127d0cd - languageName: node - linkType: hard - -"prettier-linter-helpers@npm:^1.0.0": - version: 1.0.0 - resolution: "prettier-linter-helpers@npm:1.0.0" - dependencies: - fast-diff: "npm:^1.1.2" - checksum: 10c0/81e0027d731b7b3697ccd2129470ed9913ecb111e4ec175a12f0fcfab0096516373bf0af2fef132af50cafb0a905b74ff57996d615f59512bb9ac7378fcc64ab - languageName: node - linkType: hard - -"prettier@npm:^3.3.3": - version: 3.3.3 - resolution: "prettier@npm:3.3.3" - bin: - prettier: bin/prettier.cjs - checksum: 10c0/b85828b08e7505716324e4245549b9205c0cacb25342a030ba8885aba2039a115dbcf75a0b7ca3b37bc9d101ee61fab8113fc69ca3359f2a226f1ecc07ad2e26 - languageName: node - linkType: hard - -"proc-log@npm:^3.0.0": - version: 3.0.0 - resolution: "proc-log@npm:3.0.0" - checksum: 10c0/f66430e4ff947dbb996058f6fd22de2c66612ae1a89b097744e17fb18a4e8e7a86db99eda52ccf15e53f00b63f4ec0b0911581ff2aac0355b625c8eac509b0dc - languageName: node - linkType: hard - -"proc-log@npm:^4.2.0": +"proc-log@npm:^4.1.0, proc-log@npm:^4.2.0": version: 4.2.0 resolution: "proc-log@npm:4.2.0" checksum: 10c0/17db4757c2a5c44c1e545170e6c70a26f7de58feb985091fb1763f5081cab3d01b181fb2dd240c9f4a4255a1d9227d163d5771b7e69c9e49a561692db865efb9 @@ -4411,7 +2778,7 @@ __metadata: languageName: node linkType: hard -"proto3-json-serializer@npm:^2.0.0": +"proto3-json-serializer@npm:^2.0.2": version: 2.0.2 resolution: "proto3-json-serializer@npm:2.0.2" dependencies: @@ -4420,9 +2787,9 @@ __metadata: languageName: node linkType: hard -"protobufjs@npm:7.3.0, protobufjs@npm:^7.2.5, protobufjs@npm:^7.2.6": - version: 7.3.0 - resolution: "protobufjs@npm:7.3.0" +"protobufjs@npm:^7.2.5, protobufjs@npm:^7.2.6, protobufjs@npm:^7.3.2": + version: 7.4.0 + resolution: "protobufjs@npm:7.4.0" dependencies: "@protobufjs/aspromise": "npm:^1.1.2" "@protobufjs/base64": "npm:^1.1.2" @@ -4436,7 +2803,7 @@ __metadata: "@protobufjs/utf8": "npm:^1.1.0" "@types/node": "npm:>=13.7.0" long: "npm:^5.0.0" - checksum: 10c0/fdcd17a783a4d71dd46463419cdfb5a5e3ad07cf4d9460abb5bdeb2547b0fa77c55955ac26c38e5557f5169dc3909456c675a08c56268c0e79b34d348c05dcab + checksum: 10c0/a5460a63fe596523b9a067cbce39a6b310d1a71750fda261f076535662aada97c24450e18c5bc98a27784f70500615904ff1227e1742183509f0db4fdede669b languageName: node linkType: hard @@ -4447,20 +2814,6 @@ __metadata: languageName: node linkType: hard -"punycode@npm:^2.1.0": - version: 2.3.1 - resolution: "punycode@npm:2.3.1" - checksum: 10c0/14f76a8206bc3464f794fb2e3d3cc665ae416c01893ad7a02b23766eb07159144ee612ad67af5e84fa4479ccfe67678c4feb126b0485651b302babf66f04f9e9 - languageName: node - linkType: hard - -"queue-microtask@npm:^1.2.2": - version: 1.2.3 - resolution: "queue-microtask@npm:1.2.3" - checksum: 10c0/900a93d3cdae3acd7d16f642c29a642aea32c2026446151f0778c62ac089d4b8e6c986811076e1ae180a694cedf077d453a11b58ff0a865629a4f82ab558e102 - languageName: node - linkType: hard - "readable-stream@npm:^3.1.1": version: 3.6.2 resolution: "readable-stream@npm:3.6.2" @@ -4481,18 +2834,6 @@ __metadata: languageName: node linkType: hard -"regexp.prototype.flags@npm:^1.5.2": - version: 1.5.2 - resolution: "regexp.prototype.flags@npm:1.5.2" - dependencies: - call-bind: "npm:^1.0.6" - define-properties: "npm:^1.2.1" - es-errors: "npm:^1.3.0" - set-function-name: "npm:^2.0.1" - checksum: 10c0/0f3fc4f580d9c349f8b560b012725eb9c002f36daa0041b3fbf6f4238cb05932191a4d7d5db3b5e2caa336d5150ad0402ed2be81f711f9308fe7e1a9bf9bd552 - languageName: node - linkType: hard - "require-directory@npm:^2.1.1": version: 2.1.1 resolution: "require-directory@npm:2.1.1" @@ -4500,46 +2841,6 @@ __metadata: languageName: node linkType: hard -"requireindex@npm:~1.2.0": - version: 1.2.0 - resolution: "requireindex@npm:1.2.0" - checksum: 10c0/7fb42aed73bf8de9acc4d6716cf07acc7fbe180e58729433bafcf702e76e7bb10e54f8266c06bfec62d752e0ac14d50e8758833de539e6f4e2cd642077866153 - languageName: node - linkType: hard - -"resolve-from@npm:^4.0.0": - version: 4.0.0 - resolution: "resolve-from@npm:4.0.0" - checksum: 10c0/8408eec31a3112ef96e3746c37be7d64020cda07c03a920f5024e77290a218ea758b26ca9529fd7b1ad283947f34b2291c1c0f6aa0ed34acfdda9c6014c8d190 - languageName: node - linkType: hard - -"resolve@npm:^1.22.4": - version: 1.22.8 - resolution: "resolve@npm:1.22.8" - dependencies: - is-core-module: "npm:^2.13.0" - path-parse: "npm:^1.0.7" - supports-preserve-symlinks-flag: "npm:^1.0.0" - bin: - resolve: bin/resolve - checksum: 10c0/07e179f4375e1fd072cfb72ad66d78547f86e6196c4014b31cb0b8bb1db5f7ca871f922d08da0fbc05b94e9fd42206f819648fa3b5b873ebbc8e1dc68fec433a - languageName: node - linkType: hard - -"resolve@patch:resolve@npm%3A^1.22.4#optional!builtin": - version: 1.22.8 - resolution: "resolve@patch:resolve@npm%3A1.22.8#optional!builtin::version=1.22.8&hash=c3c19d" - dependencies: - is-core-module: "npm:^2.13.0" - path-parse: "npm:^1.0.7" - supports-preserve-symlinks-flag: "npm:^1.0.0" - bin: - resolve: bin/resolve - checksum: 10c0/0446f024439cd2e50c6c8fa8ba77eaa8370b4180f401a96abf3d1ebc770ac51c1955e12764cde449fde3fff480a61f84388e3505ecdbab778f4bef5f8212c729 - languageName: node - linkType: hard - "retry-request@npm:^7.0.0": version: 7.0.2 resolution: "retry-request@npm:7.0.2" @@ -4565,34 +2866,6 @@ __metadata: languageName: node linkType: hard -"reusify@npm:^1.0.4": - version: 1.0.4 - resolution: "reusify@npm:1.0.4" - checksum: 10c0/c19ef26e4e188f408922c46f7ff480d38e8dfc55d448310dfb518736b23ed2c4f547fb64a6ed5bdba92cd7e7ddc889d36ff78f794816d5e71498d645ef476107 - languageName: node - linkType: hard - -"run-parallel@npm:^1.1.9": - version: 1.2.0 - resolution: "run-parallel@npm:1.2.0" - dependencies: - queue-microtask: "npm:^1.2.2" - checksum: 10c0/200b5ab25b5b8b7113f9901bfe3afc347e19bb7475b267d55ad0eb86a62a46d77510cb0f232507c9e5d497ebda569a08a9867d0d14f57a82ad5564d991588b39 - languageName: node - linkType: hard - -"safe-array-concat@npm:^1.1.2": - version: 1.1.2 - resolution: "safe-array-concat@npm:1.1.2" - dependencies: - call-bind: "npm:^1.0.7" - get-intrinsic: "npm:^1.2.4" - has-symbols: "npm:^1.0.3" - isarray: "npm:^2.0.5" - checksum: 10c0/12f9fdb01c8585e199a347eacc3bae7b5164ae805cdc8c6707199dbad5b9e30001a50a43c4ee24dc9ea32dbb7279397850e9208a7e217f4d8b1cf5d90129dec9 - languageName: node - linkType: hard - "safe-buffer@npm:>=5.1.0, safe-buffer@npm:^5.0.1, safe-buffer@npm:~5.2.0": version: 5.2.1 resolution: "safe-buffer@npm:5.2.1" @@ -4600,17 +2873,6 @@ __metadata: languageName: node linkType: hard -"safe-regex-test@npm:^1.0.3": - version: 1.0.3 - resolution: "safe-regex-test@npm:1.0.3" - dependencies: - call-bind: "npm:^1.0.6" - es-errors: "npm:^1.3.0" - is-regex: "npm:^1.1.4" - checksum: 10c0/900bf7c98dc58f08d8523b7012b468e4eb757afa624f198902c0643d7008ba777b0bdc35810ba0b758671ce887617295fb742b3f3968991b178ceca54cb07603 - languageName: node - linkType: hard - "safer-buffer@npm:>= 2.1.2 < 3.0.0": version: 2.1.2 resolution: "safer-buffer@npm:2.1.2" @@ -4618,47 +2880,12 @@ __metadata: languageName: node linkType: hard -"semver@npm:^6.3.1": - version: 6.3.1 - resolution: "semver@npm:6.3.1" - bin: - semver: bin/semver.js - checksum: 10c0/e3d79b609071caa78bcb6ce2ad81c7966a46a7431d9d58b8800cfa9cb6a63699b3899a0e4bcce36167a284578212d9ae6942b6929ba4aa5015c079a67751d42d - languageName: node - linkType: hard - -"semver@npm:^7.3.5, semver@npm:^7.3.7, semver@npm:^7.5.3, semver@npm:^7.5.4, semver@npm:^7.6.0": - version: 7.6.2 - resolution: "semver@npm:7.6.2" +"semver@npm:^7.3.5, semver@npm:^7.5.3, semver@npm:^7.5.4": + version: 7.6.3 + resolution: "semver@npm:7.6.3" bin: semver: bin/semver.js - checksum: 10c0/97d3441e97ace8be4b1976433d1c32658f6afaff09f143e52c593bae7eef33de19e3e369c88bd985ce1042c6f441c80c6803078d1de2a9988080b66684cbb30c - languageName: node - linkType: hard - -"set-function-length@npm:^1.2.1": - version: 1.2.2 - resolution: "set-function-length@npm:1.2.2" - dependencies: - define-data-property: "npm:^1.1.4" - es-errors: "npm:^1.3.0" - function-bind: "npm:^1.1.2" - get-intrinsic: "npm:^1.2.4" - gopd: "npm:^1.0.1" - has-property-descriptors: "npm:^1.0.2" - checksum: 10c0/82850e62f412a258b71e123d4ed3873fa9377c216809551192bb6769329340176f109c2eeae8c22a8d386c76739855f78e8716515c818bcaef384b51110f0f3c - languageName: node - linkType: hard - -"set-function-name@npm:^2.0.1": - version: 2.0.2 - resolution: "set-function-name@npm:2.0.2" - dependencies: - define-data-property: "npm:^1.1.4" - es-errors: "npm:^1.3.0" - functions-have-names: "npm:^1.2.3" - has-property-descriptors: "npm:^1.0.2" - checksum: 10c0/fce59f90696c450a8523e754abb305e2b8c73586452619c2bad5f7bf38c7b6b4651895c9db895679c5bef9554339cf3ef1c329b66ece3eda7255785fbe299316 + checksum: 10c0/88f33e148b210c153873cb08cfe1e281d518aaa9a666d4d148add6560db5cd3c582f3a08ccb91f38d5f379ead256da9931234ed122057f40bb5766e65e58adaf languageName: node linkType: hard @@ -4678,18 +2905,6 @@ __metadata: languageName: node linkType: hard -"side-channel@npm:^1.0.4": - version: 1.0.6 - resolution: "side-channel@npm:1.0.6" - dependencies: - call-bind: "npm:^1.0.7" - es-errors: "npm:^1.3.0" - get-intrinsic: "npm:^1.2.4" - object-inspect: "npm:^1.13.1" - checksum: 10c0/d2afd163dc733cc0a39aa6f7e39bf0c436293510dbccbff446733daeaf295857dbccf94297092ec8c53e2503acac30f0b78830876f0485991d62a90e9cad305f - languageName: node - linkType: hard - "signal-exit@npm:^4.0.1": version: 4.1.0 resolution: "signal-exit@npm:4.1.0" @@ -4706,13 +2921,6 @@ __metadata: languageName: node linkType: hard -"slash@npm:^3.0.0": - version: 3.0.0 - resolution: "slash@npm:3.0.0" - checksum: 10c0/e18488c6a42bdfd4ac5be85b2ced3ccd0224773baae6ad42cfbb9ec74fc07f9fa8396bd35ee638084ead7a2a0818eb5e7151111544d4731ce843019dab4be47b - languageName: node - linkType: hard - "smart-buffer@npm:^4.2.0": version: 4.2.0 resolution: "smart-buffer@npm:4.2.0" @@ -4721,17 +2929,17 @@ __metadata: linkType: hard "socks-proxy-agent@npm:^8.0.3": - version: 8.0.3 - resolution: "socks-proxy-agent@npm:8.0.3" + version: 8.0.4 + resolution: "socks-proxy-agent@npm:8.0.4" dependencies: agent-base: "npm:^7.1.1" debug: "npm:^4.3.4" - socks: "npm:^2.7.1" - checksum: 10c0/4950529affd8ccd6951575e21c1b7be8531b24d924aa4df3ee32df506af34b618c4e50d261f4cc603f1bfd8d426915b7d629966c8ce45b05fb5ad8c8b9a6459d + socks: "npm:^2.8.3" + checksum: 10c0/345593bb21b95b0508e63e703c84da11549f0a2657d6b4e3ee3612c312cb3a907eac10e53b23ede3557c6601d63252103494caa306b66560f43af7b98f53957a languageName: node linkType: hard -"socks@npm:^2.7.1": +"socks@npm:^2.8.3": version: 2.8.3 resolution: "socks@npm:2.8.3" dependencies: @@ -4795,40 +3003,6 @@ __metadata: languageName: node linkType: hard -"string.prototype.trim@npm:^1.2.9": - version: 1.2.9 - resolution: "string.prototype.trim@npm:1.2.9" - dependencies: - call-bind: "npm:^1.0.7" - define-properties: "npm:^1.2.1" - es-abstract: "npm:^1.23.0" - es-object-atoms: "npm:^1.0.0" - checksum: 10c0/dcef1a0fb61d255778155006b372dff8cc6c4394bc39869117e4241f41a2c52899c0d263ffc7738a1f9e61488c490b05c0427faa15151efad721e1a9fb2663c2 - languageName: node - linkType: hard - -"string.prototype.trimend@npm:^1.0.8": - version: 1.0.8 - resolution: "string.prototype.trimend@npm:1.0.8" - dependencies: - call-bind: "npm:^1.0.7" - define-properties: "npm:^1.2.1" - es-object-atoms: "npm:^1.0.0" - checksum: 10c0/0a0b54c17c070551b38e756ae271865ac6cc5f60dabf2e7e343cceae7d9b02e1a1120a824e090e79da1b041a74464e8477e2da43e2775c85392be30a6f60963c - languageName: node - linkType: hard - -"string.prototype.trimstart@npm:^1.0.8": - version: 1.0.8 - resolution: "string.prototype.trimstart@npm:1.0.8" - dependencies: - call-bind: "npm:^1.0.7" - define-properties: "npm:^1.2.1" - es-object-atoms: "npm:^1.0.0" - checksum: 10c0/d53af1899959e53c83b64a5fd120be93e067da740e7e75acb433849aa640782fb6c7d4cd5b84c954c84413745a3764df135a8afeb22908b86a835290788d8366 - languageName: node - linkType: hard - "string_decoder@npm:^1.1.1": version: 1.3.0 resolution: "string_decoder@npm:1.3.0" @@ -4856,20 +3030,6 @@ __metadata: languageName: node linkType: hard -"strip-bom@npm:^3.0.0": - version: 3.0.0 - resolution: "strip-bom@npm:3.0.0" - checksum: 10c0/51201f50e021ef16672593d7434ca239441b7b760e905d9f33df6e4f3954ff54ec0e0a06f100d028af0982d6f25c35cd5cda2ce34eaebccd0250b8befb90d8f1 - languageName: node - linkType: hard - -"strip-json-comments@npm:^3.1.1": - version: 3.1.1 - resolution: "strip-json-comments@npm:3.1.1" - checksum: 10c0/9681a6257b925a7fa0f285851c0e613cc934a50661fa7bb41ca9cbbff89686bb4a0ee366e6ecedc4daafd01e83eee0720111ab294366fe7c185e935475ebcecd - languageName: node - linkType: hard - "strnum@npm:^1.0.5": version: 1.0.5 resolution: "strnum@npm:1.0.5" @@ -4893,33 +3053,7 @@ __metadata: languageName: node linkType: hard -"supports-color@npm:^7.1.0": - version: 7.2.0 - resolution: "supports-color@npm:7.2.0" - dependencies: - has-flag: "npm:^4.0.0" - checksum: 10c0/afb4c88521b8b136b5f5f95160c98dee7243dc79d5432db7efc27efb219385bbc7d9427398e43dd6cc730a0f87d5085ce1652af7efbe391327bc0a7d0f7fc124 - languageName: node - linkType: hard - -"supports-preserve-symlinks-flag@npm:^1.0.0": - version: 1.0.0 - resolution: "supports-preserve-symlinks-flag@npm:1.0.0" - checksum: 10c0/6c4032340701a9950865f7ae8ef38578d8d7053f5e10518076e6554a9381fa91bd9c6850193695c141f32b21f979c985db07265a758867bac95de05f7d8aeb39 - languageName: node - linkType: hard - -"synckit@npm:^0.9.1": - version: 0.9.1 - resolution: "synckit@npm:0.9.1" - dependencies: - "@pkgr/core": "npm:^0.1.0" - tslib: "npm:^2.6.2" - checksum: 10c0/d8b89e1bf30ba3ffb469d8418c836ad9c0c062bf47028406b4d06548bc66af97155ea2303b96c93bf5c7c0f0d66153a6fbd6924c76521b434e6a9898982abc2e - languageName: node - linkType: hard - -"tar@npm:^6.1.11, tar@npm:^6.1.2": +"tar@npm:^6.1.11, tar@npm:^6.2.1": version: 6.2.1 resolution: "tar@npm:6.2.1" dependencies: @@ -4946,13 +3080,6 @@ __metadata: languageName: node linkType: hard -"text-table@npm:^0.2.0": - version: 0.2.0 - resolution: "text-table@npm:0.2.0" - checksum: 10c0/02805740c12851ea5982686810702e2f14369a5f4c5c40a836821e3eefc65ffeec3131ba324692a37608294b0fd8c1e55a2dd571ffed4909822787668ddbee5c - languageName: node - linkType: hard - "to-regex-range@npm:^5.0.1": version: 5.0.1 resolution: "to-regex-range@npm:5.0.1" @@ -4978,15 +3105,6 @@ __metadata: languageName: node linkType: hard -"ts-api-utils@npm:^1.3.0": - version: 1.3.0 - resolution: "ts-api-utils@npm:1.3.0" - peerDependencies: - typescript: ">=4.2.0" - checksum: 10c0/f54a0ba9ed56ce66baea90a3fa087a484002e807f28a8ccb2d070c75e76bde64bd0f6dce98b3802834156306050871b67eec325cb4e918015a360a3f0868c77c - languageName: node - linkType: hard - "ts-mixer@npm:^6.0.4": version: 6.0.4 resolution: "ts-mixer@npm:6.0.4" @@ -5032,156 +3150,30 @@ __metadata: languageName: node linkType: hard -"tsconfig-paths@npm:^3.15.0": - version: 3.15.0 - resolution: "tsconfig-paths@npm:3.15.0" - dependencies: - "@types/json5": "npm:^0.0.29" - json5: "npm:^1.0.2" - minimist: "npm:^1.2.6" - strip-bom: "npm:^3.0.0" - checksum: 10c0/5b4f301a2b7a3766a986baf8fc0e177eb80bdba6e396792ff92dc23b5bca8bb279fc96517dcaaef63a3b49bebc6c4c833653ec58155780bc906bdbcf7dda0ef5 - languageName: node - linkType: hard - -"tslib@npm:2.6.2": - version: 2.6.2 - resolution: "tslib@npm:2.6.2" - checksum: 10c0/e03a8a4271152c8b26604ed45535954c0a45296e32445b4b87f8a5abdb2421f40b59b4ca437c4346af0f28179780d604094eb64546bee2019d903d01c6c19bdb - languageName: node - linkType: hard - -"tslib@npm:^1.8.1": - version: 1.14.1 - resolution: "tslib@npm:1.14.1" - checksum: 10c0/69ae09c49eea644bc5ebe1bca4fa4cc2c82b7b3e02f43b84bd891504edf66dbc6b2ec0eef31a957042de2269139e4acff911e6d186a258fb14069cd7f6febce2 - languageName: node - linkType: hard - -"tslib@npm:^2.1.0, tslib@npm:^2.6.2": - version: 2.6.3 - resolution: "tslib@npm:2.6.3" - checksum: 10c0/2598aef53d9dbe711af75522464b2104724d6467b26a60f2bdac8297d2b5f1f6b86a71f61717384aa8fd897240467aaa7bcc36a0700a0faf751293d1331db39a - languageName: node - linkType: hard - -"tsutils@npm:^3.21.0": - version: 3.21.0 - resolution: "tsutils@npm:3.21.0" - dependencies: - tslib: "npm:^1.8.1" - peerDependencies: - typescript: ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" - checksum: 10c0/02f19e458ec78ead8fffbf711f834ad8ecd2cc6ade4ec0320790713dccc0a412b99e7fd907c4cda2a1dc602c75db6f12e0108e87a5afad4b2f9e90a24cabd5a2 - languageName: node - linkType: hard - -"type-check@npm:^0.4.0, type-check@npm:~0.4.0": - version: 0.4.0 - resolution: "type-check@npm:0.4.0" - dependencies: - prelude-ls: "npm:^1.2.1" - checksum: 10c0/7b3fd0ed43891e2080bf0c5c504b418fbb3e5c7b9708d3d015037ba2e6323a28152ec163bcb65212741fa5d2022e3075ac3c76440dbd344c9035f818e8ecee58 - languageName: node - linkType: hard - -"typed-array-buffer@npm:^1.0.2": - version: 1.0.2 - resolution: "typed-array-buffer@npm:1.0.2" - dependencies: - call-bind: "npm:^1.0.7" - es-errors: "npm:^1.3.0" - is-typed-array: "npm:^1.1.13" - checksum: 10c0/9e043eb38e1b4df4ddf9dde1aa64919ae8bb909571c1cc4490ba777d55d23a0c74c7d73afcdd29ec98616d91bb3ae0f705fad4421ea147e1daf9528200b562da - languageName: node - linkType: hard - -"typed-array-byte-length@npm:^1.0.1": - version: 1.0.1 - resolution: "typed-array-byte-length@npm:1.0.1" - dependencies: - call-bind: "npm:^1.0.7" - for-each: "npm:^0.3.3" - gopd: "npm:^1.0.1" - has-proto: "npm:^1.0.3" - is-typed-array: "npm:^1.1.13" - checksum: 10c0/fcebeffb2436c9f355e91bd19e2368273b88c11d1acc0948a2a306792f1ab672bce4cfe524ab9f51a0505c9d7cd1c98eff4235c4f6bfef6a198f6cfc4ff3d4f3 - languageName: node - linkType: hard - -"typed-array-byte-offset@npm:^1.0.2": - version: 1.0.2 - resolution: "typed-array-byte-offset@npm:1.0.2" - dependencies: - available-typed-arrays: "npm:^1.0.7" - call-bind: "npm:^1.0.7" - for-each: "npm:^0.3.3" - gopd: "npm:^1.0.1" - has-proto: "npm:^1.0.3" - is-typed-array: "npm:^1.1.13" - checksum: 10c0/d2628bc739732072e39269389a758025f75339de2ed40c4f91357023c5512d237f255b633e3106c461ced41907c1bf9a533c7e8578066b0163690ca8bc61b22f - languageName: node - linkType: hard - -"typed-array-length@npm:^1.0.6": - version: 1.0.6 - resolution: "typed-array-length@npm:1.0.6" - dependencies: - call-bind: "npm:^1.0.7" - for-each: "npm:^0.3.3" - gopd: "npm:^1.0.1" - has-proto: "npm:^1.0.3" - is-typed-array: "npm:^1.1.13" - possible-typed-array-names: "npm:^1.0.0" - checksum: 10c0/74253d7dc488eb28b6b2711cf31f5a9dcefc9c41b0681fd1c178ed0a1681b4468581a3626d39cd4df7aee3d3927ab62be06aa9ca74e5baf81827f61641445b77 - languageName: node - linkType: hard - -"typescript-eslint@npm:^7.18.0": - version: 7.18.0 - resolution: "typescript-eslint@npm:7.18.0" - dependencies: - "@typescript-eslint/eslint-plugin": "npm:7.18.0" - "@typescript-eslint/parser": "npm:7.18.0" - "@typescript-eslint/utils": "npm:7.18.0" - peerDependencies: - eslint: ^8.56.0 - peerDependenciesMeta: - typescript: - optional: true - checksum: 10c0/610c0faa70b9be89255086378c7ef69e979115c89be69851fb4d69e76907b3520450b162a8adee56b32dbf368f8c14c1fac88065539012140c1319851f2676da +"tslib@npm:^2.1.0, tslib@npm:^2.6.2, tslib@npm:^2.6.3": + version: 2.7.0 + resolution: "tslib@npm:2.7.0" + checksum: 10c0/469e1d5bf1af585742128827000711efa61010b699cb040ab1800bcd3ccdd37f63ec30642c9e07c4439c1db6e46345582614275daca3e0f4abae29b0083f04a6 languageName: node linkType: hard "typescript@npm:^5.5.4": - version: 5.5.4 - resolution: "typescript@npm:5.5.4" + version: 5.6.2 + resolution: "typescript@npm:5.6.2" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 10c0/422be60f89e661eab29ac488c974b6cc0a660fb2228003b297c3d10c32c90f3bcffc1009b43876a082515a3c376b1eefcce823d6e78982e6878408b9a923199c + checksum: 10c0/3ed8297a8c7c56b7fec282532503d1ac795239d06e7c4966b42d4330c6cf433a170b53bcf93a130a7f14ccc5235de5560df4f1045eb7f3550b46ebed16d3c5e5 languageName: node linkType: hard "typescript@patch:typescript@npm%3A^5.5.4#optional!builtin": - version: 5.5.4 - resolution: "typescript@patch:typescript@npm%3A5.5.4#optional!builtin::version=5.5.4&hash=b45daf" + version: 5.6.2 + resolution: "typescript@patch:typescript@npm%3A5.6.2#optional!builtin::version=5.6.2&hash=b45daf" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 10c0/10dd9881baba22763de859e8050d6cb6e2db854197495c6f1929b08d1eb2b2b00d0b5d9b0bcee8472f1c3f4a7ef6a5d7ebe0cfd703f853aa5ae465b8404bc1ba - languageName: node - linkType: hard - -"unbox-primitive@npm:^1.0.2": - version: 1.0.2 - resolution: "unbox-primitive@npm:1.0.2" - dependencies: - call-bind: "npm:^1.0.2" - has-bigints: "npm:^1.0.2" - has-symbols: "npm:^1.0.3" - which-boxed-primitive: "npm:^1.0.2" - checksum: 10c0/81ca2e81134167cc8f75fa79fbcc8a94379d6c61de67090986a2273850989dd3bae8440c163121b77434b68263e34787a675cbdcb34bb2f764c6b9c843a11b66 + checksum: 10c0/e6c1662e4852e22fe4bbdca471dca3e3edc74f6f1df043135c44a18a7902037023ccb0abdfb754595ca9028df8920f2f8492c00fc3cbb4309079aae8b7de71cd languageName: node linkType: hard @@ -5192,13 +3184,6 @@ __metadata: languageName: node linkType: hard -"undici-types@npm:~5.26.4": - version: 5.26.5 - resolution: "undici-types@npm:5.26.5" - checksum: 10c0/bb673d7876c2d411b6eb6c560e0c571eef4a01c1c19925175d16e3a30c4c428181fb8d7ae802a261f283e4166a0ac435e2f505743aa9e45d893f9a3df017b501 - languageName: node - linkType: hard - "undici-types@npm:~6.19.2": version: 6.19.8 resolution: "undici-types@npm:6.19.8" @@ -5206,13 +3191,6 @@ __metadata: languageName: node linkType: hard -"undici@npm:6.13.0": - version: 6.13.0 - resolution: "undici@npm:6.13.0" - checksum: 10c0/b1b0456e7d4e87fd4f71a2a0716d8ea826f024fbcf16b7c6185194ca138cb822c20db509ed18c837fffcd9ffc3d74004ad6f950ebc895ff81ebb5ca6bf001cb2 - languageName: node - linkType: hard - "undici@npm:6.19.7": version: 6.19.7 resolution: "undici@npm:6.19.7" @@ -5220,6 +3198,13 @@ __metadata: languageName: node linkType: hard +"undici@npm:6.19.8": + version: 6.19.8 + resolution: "undici@npm:6.19.8" + checksum: 10c0/07fd8520bce7e34ea29c07ef0de27b734183042cdb4e2f1262cd1fb9b755a6b04ff2471040395dfb1770fb7786069a97c5178bcf706b80a34075994f46feb37c + languageName: node + linkType: hard + "unique-filename@npm:^3.0.0": version: 3.0.0 resolution: "unique-filename@npm:3.0.0" @@ -5238,15 +3223,6 @@ __metadata: languageName: node linkType: hard -"uri-js@npm:^4.2.2": - version: 4.4.1 - resolution: "uri-js@npm:4.4.1" - dependencies: - punycode: "npm:^2.1.0" - checksum: 10c0/4ef57b45aa820d7ac6496e9208559986c665e49447cb072744c13b66925a362d96dd5a46c4530a6b8e203e5db5fe849369444440cb22ecfc26c679359e5dfa3c - languageName: node - linkType: hard - "util-deprecate@npm:^1.0.1": version: 1.0.2 resolution: "util-deprecate@npm:1.0.2" @@ -5323,32 +3299,6 @@ __metadata: languageName: node linkType: hard -"which-boxed-primitive@npm:^1.0.2": - version: 1.0.2 - resolution: "which-boxed-primitive@npm:1.0.2" - dependencies: - is-bigint: "npm:^1.0.1" - is-boolean-object: "npm:^1.1.0" - is-number-object: "npm:^1.0.4" - is-string: "npm:^1.0.5" - is-symbol: "npm:^1.0.3" - checksum: 10c0/0a62a03c00c91dd4fb1035b2f0733c341d805753b027eebd3a304b9cb70e8ce33e25317add2fe9b5fea6f53a175c0633ae701ff812e604410ddd049777cd435e - languageName: node - linkType: hard - -"which-typed-array@npm:^1.1.14, which-typed-array@npm:^1.1.15": - version: 1.1.15 - resolution: "which-typed-array@npm:1.1.15" - dependencies: - available-typed-arrays: "npm:^1.0.7" - call-bind: "npm:^1.0.7" - for-each: "npm:^0.3.3" - gopd: "npm:^1.0.1" - has-tostringtag: "npm:^1.0.2" - checksum: 10c0/4465d5348c044032032251be54d8988270e69c6b7154f8fcb2a47ff706fe36f7624b3a24246b8d9089435a8f4ec48c1c1025c5d6b499456b9e5eff4f48212983 - languageName: node - linkType: hard - "which@npm:^2.0.1": version: 2.0.2 resolution: "which@npm:2.0.2" @@ -5371,13 +3321,6 @@ __metadata: languageName: node linkType: hard -"word-wrap@npm:^1.2.5": - version: 1.2.5 - resolution: "word-wrap@npm:1.2.5" - checksum: 10c0/e0e4a1ca27599c92a6ca4c32260e8a92e8a44f4ef6ef93f803f8ed823f486e0889fc0b93be4db59c8d51b3064951d25e43d434e95dc8c960cc3a63d65d00ba20 - languageName: node - linkType: hard - "wrap-ansi-cjs@npm:wrap-ansi@^7.0.0, wrap-ansi@npm:^7.0.0": version: 7.0.0 resolution: "wrap-ansi@npm:7.0.0" @@ -5408,8 +3351,8 @@ __metadata: linkType: hard "ws@npm:^8.16.0": - version: 8.17.0 - resolution: "ws@npm:8.17.0" + version: 8.18.0 + resolution: "ws@npm:8.18.0" peerDependencies: bufferutil: ^4.0.1 utf-8-validate: ">=5.0.2" @@ -5418,7 +3361,7 @@ __metadata: optional: true utf-8-validate: optional: true - checksum: 10c0/55241ec93a66fdfc4bf4f8bc66c8eb038fda2c7a4ee8f6f157f2ca7dc7aa76aea0c0da0bf3adb2af390074a70a0e45456a2eaf80e581e630b75df10a64b0a990 + checksum: 10c0/25eb33aff17edcb90721ed6b0eb250976328533ad3cd1a28a274bd263682e7296a6591ff1436d6cbc50fa67463158b062f9d1122013b361cec99a05f84680e06 languageName: node linkType: hard From 564ec77fa3dfdd6ea8b42f190f49b7943ad8d812 Mon Sep 17 00:00:00 2001 From: KinjiKawaguchi Date: Tue, 1 Oct 2024 09:33:11 +0900 Subject: [PATCH 03/12] refactor --- src/commands/auth.ts | 1 - src/controllers/authController.ts | 3 ++- src/deployCommands.ts | 4 ++-- src/events/clientReady.ts | 9 ++++----- src/loadCommands.ts | 4 ++-- src/main.ts | 4 ++-- src/usecases/sendAuthMail.ts | 11 ++++++++--- src/utils/authMember.ts | 2 +- src/utils/initializeRoles.ts | 11 +++-------- src/utils/makeDepartmentRole.ts | 4 ++-- 10 files changed, 26 insertions(+), 27 deletions(-) diff --git a/src/commands/auth.ts b/src/commands/auth.ts index d96af03..72dea77 100644 --- a/src/commands/auth.ts +++ b/src/commands/auth.ts @@ -115,7 +115,6 @@ async function giveDepartmentRole( const member: Member | undefined = await getMemberByEmail(userAccount.email!); if (!member) { throw new Error("Member not found"); - return; } //TODO: 要リファクタリング diff --git a/src/controllers/authController.ts b/src/controllers/authController.ts index 33d8fd7..75028a5 100644 --- a/src/controllers/authController.ts +++ b/src/controllers/authController.ts @@ -36,7 +36,8 @@ function checkAuthData(userInfo: AuthData): boolean { function checkMember(member: Member | undefined): void { if (!member) { throw new Error("Member not found"); - } else if (!member.id) { + } + if (!member.id) { throw new Error("Member id is not provided"); } } diff --git a/src/deployCommands.ts b/src/deployCommands.ts index a254205..0290b41 100644 --- a/src/deployCommands.ts +++ b/src/deployCommands.ts @@ -1,6 +1,6 @@ import { type SlashCommandBuilder, REST, Routes } from "discord.js"; -import fs from "fs"; -import path from "path"; +import fs from "node:fs"; +import path from "node:path"; import type { Command } from "./types/command"; import dotenv from "dotenv"; diff --git a/src/events/clientReady.ts b/src/events/clientReady.ts index 6ed7a94..b409152 100644 --- a/src/events/clientReady.ts +++ b/src/events/clientReady.ts @@ -10,13 +10,12 @@ export function setupClientReadyHandler(client: CustomClient) { //guildのリストを取得 const guilds = client.guilds.cache; - if (guilds.size == 0) { + if (guilds.size === 0) { console.error("No guild found."); throw new Error("No guild found."); - } else { - for (const [, guild] of guilds) { - initializeRoles(guild); - } + } + for (const [, guild] of guilds) { + initializeRoles(guild); } } }); diff --git a/src/loadCommands.ts b/src/loadCommands.ts index a4449cb..93ad620 100644 --- a/src/loadCommands.ts +++ b/src/loadCommands.ts @@ -1,5 +1,5 @@ -import fs from "fs/promises"; -import path from "path"; +import fs from "node:fs/promises"; +import path from "node:path"; import type { CustomClient } from "./types/customClient"; export async function loadCommands(client: CustomClient) { diff --git a/src/main.ts b/src/main.ts index abc9c77..2246ab2 100644 --- a/src/main.ts +++ b/src/main.ts @@ -14,14 +14,14 @@ const horChannelId = process.env.HOT_CHANNEL_ID; const postHotChannelTime = process.env.POST_HOT_CHANNEL_TIME; async function main() { - if (!token) { + if (!token || !horChannelId || !postHotChannelTime) { console.error("Missing environment variables."); process.exit(1); } await loadCommands(client); setupEventHandlers(client, userStates); - scheduleHotChannels(client, horChannelId!, postHotChannelTime!); + scheduleHotChannels(client, horChannelId, postHotChannelTime); await client.login(token); console.log("Bot is running..."); diff --git a/src/usecases/sendAuthMail.ts b/src/usecases/sendAuthMail.ts index 57183a8..8cf0a5f 100644 --- a/src/usecases/sendAuthMail.ts +++ b/src/usecases/sendAuthMail.ts @@ -3,6 +3,7 @@ import { type ActionCodeSettings, createUserWithEmailAndPassword, sendEmailVerification, + type UserCredential, } from "firebase/auth"; async function sendAuthMail( @@ -16,14 +17,18 @@ async function sendAuthMail( }; try { - const user = await createUserWithEmailAndPassword( + const userCredential: UserCredential = await createUserWithEmailAndPassword( auth, mail, student_number + department, ); - await sendEmailVerification(user.user!, actionCodeSettings); - console.log("Send mail to " + mail + " successfully"); + if (userCredential.user) { + await sendEmailVerification(userCredential.user, actionCodeSettings); + console.log(`Send mail to ${mail} successfully`); + } else { + console.error("User object is null after creation"); + } } catch (e) { console.error(e); } diff --git a/src/utils/authMember.ts b/src/utils/authMember.ts index 80774e8..a1a58b9 100644 --- a/src/utils/authMember.ts +++ b/src/utils/authMember.ts @@ -14,7 +14,7 @@ async function authMember(authData: AuthData): Promise { ); }); - return authMember ? true : false; + return !!authMember; } export default authMember; diff --git a/src/utils/initializeRoles.ts b/src/utils/initializeRoles.ts index 4ed3f57..018cae3 100644 --- a/src/utils/initializeRoles.ts +++ b/src/utils/initializeRoles.ts @@ -1,5 +1,5 @@ -import { readdirSync, statSync } from "fs"; -import { join, resolve } from "path"; +import { readdirSync, statSync } from "node:fs"; +import { join, resolve } from "node:path"; import createRoleIfNotFound from "./createRoleNotFound"; import type CustomRole from "../types/customRole"; import type { Guild } from "discord.js"; @@ -14,12 +14,7 @@ async function readRolesFromDirectory(directoryPath: string, guild: Guild) { try { const module = await import(fullPath); const roleConfig = module.default || module; - if ( - roleConfig && - roleConfig.roleName && - roleConfig.color && - roleConfig.reason - ) { + if (roleConfig?.roleName && roleConfig.color && roleConfig.reason) { await initializeRole(roleConfig, guild); } else { console.error(`Failed to load a valid role config from ${fullPath}`); diff --git a/src/utils/makeDepartmentRole.ts b/src/utils/makeDepartmentRole.ts index 8329f6a..da4d78f 100644 --- a/src/utils/makeDepartmentRole.ts +++ b/src/utils/makeDepartmentRole.ts @@ -13,9 +13,9 @@ function makeDepartmentRole({ reason, }: makeDepartmentRoleProps): CustomRole { const role: CustomRole = { - roleName: "DP:" + department, + roleName: `DP:${department}`, color: color, - reason: reason ? reason : department + "Department Role", + reason: reason ? reason : `${department}Department Role`, }; return role; From cc6ef3ccdb7aa3ce000d3a5b9f76b56cb87a4b6f Mon Sep 17 00:00:00 2001 From: KinjiKawaguchi Date: Tue, 1 Oct 2024 09:33:19 +0900 Subject: [PATCH 04/12] refactor --- src/commands/rename_all.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/rename_all.ts b/src/commands/rename_all.ts index 4d8aee8..b2149b6 100644 --- a/src/commands/rename_all.ts +++ b/src/commands/rename_all.ts @@ -40,7 +40,7 @@ async function renameALLHandler(interaction: CommandInteraction) { await Promise.all(renamePromises); await interaction.followUp("ニックネームの変更が完了しました。"); - console.log(`[NOTE] Completed changing nicknames`); + console.log("[NOTE] Completed changing nicknames"); } export default renameALL; From 56f56dd1f028ccbad153cbd4287f3bcc0e69fa1d Mon Sep 17 00:00:00 2001 From: KinjiKawaguchi Date: Tue, 1 Oct 2024 09:48:05 +0900 Subject: [PATCH 05/12] format:Forbidden non-null assertion. --- README.md | 1 - docs/getting-started.md | 2 + src/commands/auth.ts | 200 +++++++++++++--------------- src/commands/hotChannel.ts | 32 +++-- src/commands/who.ts | 34 +++-- src/controllers/MemberController.ts | 31 +++-- src/controllers/authController.ts | 27 +++- src/events/messageCreate.ts | 12 +- src/usecases/getHotChannels.ts | 4 +- src/utils/checkMemberRole.ts | 7 +- 10 files changed, 192 insertions(+), 158 deletions(-) diff --git a/README.md b/README.md index 1a92831..af2d63a 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,6 @@ ITSのディスコードサーバーで使用するbotです 開発前に管理者からクレデンシャルを受け取ってください - # Getting started ```bash diff --git a/docs/getting-started.md b/docs/getting-started.md index 5e80f77..2792114 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -8,8 +8,10 @@ yarn start ``` ## コマンドのデプロイ + discord botは新たに作成したコマンドは、それ単体でデプロイされる必要があります。 以下のコマンドを実行することで、更新した/新たに作成されたコマンドをデプロイすることができます。 + ``` yarn run deploy-commands ``` diff --git a/src/commands/auth.ts b/src/commands/auth.ts index 72dea77..91b8069 100644 --- a/src/commands/auth.ts +++ b/src/commands/auth.ts @@ -1,16 +1,7 @@ -import { - SlashCommandBuilder, - type CommandInteraction, - type Guild, - type Role, - type GuildMember, -} from "discord.js"; +import { SlashCommandBuilder, type CommandInteraction, type Guild, type Role, type GuildMember } from "discord.js"; import type { Command } from "../types/command"; import { adminAuth } from "../infra/firebase"; -import { - getMemberByDiscordId, - getMemberByEmail, -} from "../controllers/MemberController"; +import { getMemberByDiscordId, getMemberByEmail } from "../controllers/MemberController"; import type { UserRecord } from "firebase-admin/lib/auth/user-record"; import createRoleIfNotFound from "../utils/createRoleNotFound"; import addRoleToMember from "../utils/addRoleToMember"; @@ -20,6 +11,7 @@ import Department from "../entities/department"; import biRole from "../roles/departments/bi"; import graduateRole from "../roles/departments/graduate"; import othersRole from "../roles/departments/others"; +import obogRole from "../roles/departments/obog"; import csRole from "../roles/departments/cs"; import iaRole from "../roles/departments/ia"; import authorizedRoleProperty from "../roles/authorized"; @@ -27,116 +19,108 @@ import unAuthorizedRoleProperty from "../roles/unAuthorized"; import type Member from "../entities/member"; const authCommand: Command = { - data: new SlashCommandBuilder() - .setName("auth") - .setDescription("認証コマンド"), - execute: authCommandHandler, + data: new SlashCommandBuilder().setName("auth").setDescription("認証コマンド"), + execute: authCommandHandler, }; async function authCommandHandler(interaction: CommandInteraction) { - //DMでは実行できないようにする - if (!interaction.guild) - return await interaction.reply("このコマンドはサーバーでのみ実行可能です"); - - // Firestoreからメンバー情報を取得 - const member = await getMemberByDiscordId(interaction.user.id); - if (!member) { - await interaction.reply("メンバー情報が見つかりませんでした"); - return; - } - - // メール認証が完了しているか確認 - const user: UserRecord = await adminAuth.getUserByEmail(member.mail); - if (user.emailVerified) { - try { - await changeNickName(interaction, member); - await giveRoles(interaction); - } catch (error) { - console.error("Failed to auth", error); - await interaction.reply("認証に失敗しました"); - } - } else { - await interaction.reply("メール認証が完了していません"); - } + //DMでは実行できないようにする + if (!interaction.guild) return await interaction.reply("このコマンドはサーバーでのみ実行可能です"); + + // Firestoreからメンバー情報を取得 + const member = await getMemberByDiscordId(interaction.user.id); + if (!member) { + await interaction.reply("メンバー情報が見つかりませんでした"); + return; + } + + // メール認証が完了しているか確認 + const user: UserRecord = await adminAuth.getUserByEmail(member.mail); + if (user.emailVerified) { + try { + await changeNickName(interaction, member); + await giveRoles(interaction); + } catch (error) { + console.error("Failed to auth", error); + await interaction.reply("認証に失敗しました"); + } + } else { + await interaction.reply("メール認証が完了していません"); + } } async function changeNickName(interaction: CommandInteraction, member: Member) { - const guild: Guild = interaction.guild!; - const guildMember: GuildMember = await guild.members.fetch( - interaction.user.id, - ); - const realName: string = member.name; - await guildMember.setNickname(realName); + const guild = interaction.guild; + if (!guild) { + throw new Error("This command can only be used in a guild."); + } + const guildMember = await guild.members.fetch(interaction.user.id); + const realName = member.name; + await guildMember.setNickname(realName); } async function giveRoles(interaction: CommandInteraction) { - const user = await adminAuth.getUserByEmail(interaction.user.tag); - const guild: Guild = interaction.guild!; - const guildMember: GuildMember = await guild.members.fetch( - interaction.user.id, - ); - - await giveAuthorizedRole(interaction, guild, guildMember); - await giveDepartmentRole(interaction, user, guildMember); + const user = await adminAuth.getUserByEmail(interaction.user.tag); + const guild = interaction.guild; + if (!guild) { + throw new Error("This command can only be used in a guild."); + } + const guildMember = await guild.members.fetch(interaction.user.id); + await giveAuthorizedRole(interaction, guild, guildMember); + await giveDepartmentRole(interaction, user, guildMember); } -async function giveAuthorizedRole( - interaction: CommandInteraction, - guild: Guild, - guildMember: GuildMember, -) { - try { - const authorizedRole: Role = await createRoleIfNotFound({ - guild, - customRole: authorizedRoleProperty, - }); - const unAuthorizedRole: Role = await createRoleIfNotFound({ - guild, - customRole: unAuthorizedRoleProperty, - }); - - await guildMember.roles.add(authorizedRole); - await guildMember.roles.remove(unAuthorizedRole); - - await interaction.reply("認証しました!"); - } catch (error) { - console.error("Failed to give Authorized Role"); - } +async function giveAuthorizedRole(interaction: CommandInteraction, guild: Guild, guildMember: GuildMember) { + try { + const authorizedRole: Role = await createRoleIfNotFound({ + guild, + customRole: authorizedRoleProperty, + }); + const unAuthorizedRole: Role = await createRoleIfNotFound({ + guild, + customRole: unAuthorizedRoleProperty, + }); + + await guildMember.roles.add(authorizedRole); + await guildMember.roles.remove(unAuthorizedRole); + + await interaction.reply("認証しました!"); + } catch (error) { + console.error("Failed to give Authorized Role"); + } } -async function giveDepartmentRole( - interaction: CommandInteraction, - userAccount: UserRecord, - guildMember: GuildMember, -) { - const guild: Guild = interaction.guild!; - - //認証用のアカウントから、メンバー情報を取得 - const member: Member | undefined = await getMemberByEmail(userAccount.email!); - if (!member) { - throw new Error("Member not found"); - } - - //TODO: 要リファクタリング - switch (member.department) { - case Department.CS: - await addRoleToMember(guild, guildMember, csRole); - break; - case Department.IA: - await addRoleToMember(guild, guildMember, iaRole); - break; - case Department.BI: - await addRoleToMember(guild, guildMember, biRole); - break; - case Department.GRADUATE: - await addRoleToMember(guild, guildMember, graduateRole); - break; - case Department.OTHERS: - await addRoleToMember(guild, guildMember, othersRole); - break; - default: - throw new Error("Department not found"); - } +async function giveDepartmentRole(interaction: CommandInteraction, userAccount: UserRecord, guildMember: GuildMember) { + const guild = interaction.guild; + if (!guild) { + throw new Error("Guild not found"); + } + + if (!userAccount.email) { + throw new Error("User email not found"); + } + + // 認証用のアカウントから、メンバー情報を取得 + const member = await getMemberByEmail(userAccount.email); + if (!member) { + throw new Error("Member not found"); + } + + const departmentRoleMap = { + [Department.CS]: csRole, + [Department.IA]: iaRole, + [Department.BI]: biRole, + [Department.GRADUATE]: graduateRole, + [Department.OTHERS]: othersRole, + [Department.OBOG]: obogRole, // OBOGロールを追加 + }; + + const role = departmentRoleMap[member.department]; + if (!role) { + throw new Error("Department not found"); + } + + await addRoleToMember(guild, guildMember, role); } export default authCommand; diff --git a/src/commands/hotChannel.ts b/src/commands/hotChannel.ts index 432f33b..23d3d01 100644 --- a/src/commands/hotChannel.ts +++ b/src/commands/hotChannel.ts @@ -1,4 +1,8 @@ -import { SlashCommandBuilder, type CommandInteraction } from "discord.js"; +import { + SlashCommandBuilder, + type CommandInteraction, + Guild, +} from "discord.js"; import type { Command } from "../types/command"; import { generateChannelActivityRanking } from "../usecases/getHotChannels"; import checkIsAdmin from "../utils/checkMemberRole"; @@ -7,16 +11,26 @@ const hotChannelsCommand: Command = { data: new SlashCommandBuilder() .setName("hot_channels") .setDescription("Show hot channels ranking"), + async execute(interaction: CommandInteraction) { - if (!interaction.guild) - return await interaction.reply( - "このコマンドはサーバーでのみ実行可能です", - ); + if (!interaction.guild) { + await interaction.reply("このコマンドはサーバーでのみ実行可能です"); + return; + } + const isAdmin: boolean = await checkIsAdmin(interaction); - if (!isAdmin) - return await interaction.reply("このコマンドは管理者のみ使用可能です"); - const ranking = await generateChannelActivityRanking(interaction.guild!); - await interaction.reply({ embeds: [ranking] }); + if (!isAdmin) { + await interaction.reply("このコマンドは管理者のみ使用可能です"); + return; + } + + try { + const ranking = await generateChannelActivityRanking(interaction.guild); + await interaction.reply({ embeds: [ranking] }); + } catch (error) { + console.error("Error generating channel activity ranking:", error); + await interaction.reply("ランキングの生成中にエラーが発生しました。"); + } }, }; diff --git a/src/commands/who.ts b/src/commands/who.ts index 0149cab..a3c4f28 100644 --- a/src/commands/who.ts +++ b/src/commands/who.ts @@ -1,4 +1,8 @@ -import { type CommandInteraction, SlashCommandBuilder } from "discord.js"; +import { + type CommandInteraction, + SlashCommandBuilder, + type User, +} from "discord.js"; import { getMemberByDiscordId } from "../controllers/MemberController"; import type CommandWithArgs from "../types/commandWithArgs"; @@ -16,22 +20,26 @@ const whoCommand: CommandWithArgs = { }; async function whoCommandHandler(interaction: CommandInteraction) { - if (!interaction.guild) - return await interaction.reply( - "このコマンドはサーバー内でのみ使用可能です。", - ); + if (!interaction.guild) { + await interaction.reply("このコマンドはサーバー内でのみ使用可能です。"); + return; + } - //ログを出力 printLog(interaction); - // メンションされたユーザーの情報を取得 - const user = interaction.options.get("user"); - if (!user) return await interaction.reply("ユーザーを指定してください。"); - if (!user.user) return await interaction.reply("ユーザーが見つかりません。"); + const userOption = interaction.options.get("user"); + if (!userOption || !userOption.user) { + await interaction.reply("ユーザーを指定してください。"); + return; + } - const member = await getMemberByDiscordId(user.user.id!); - if (!member) - return await interaction.reply("メンバー情報が見つかりませんでした。"); + const user: User = userOption.user; + const member = await getMemberByDiscordId(user.id); + + if (!member) { + await interaction.reply("メンバー情報が見つかりませんでした。"); + return; + } await interaction.reply( `名前: ${member.name}\n学部: ${member.department}\n学籍番号: ${member.student_number}\nメールアドレス: ${member.mail}`, diff --git a/src/controllers/MemberController.ts b/src/controllers/MemberController.ts index 654c776..dfa8281 100644 --- a/src/controllers/MemberController.ts +++ b/src/controllers/MemberController.ts @@ -3,25 +3,24 @@ import type Member from "../entities/member"; import getMembers from "../usecases/getMembers"; import setDiscordId from "../usecases/setDiscordId"; -export async function getAllMembers() { +export async function getAllMembers(): Promise { try { - const members = await getMembers(); - return members; + return await getMembers(); } catch (error) { console.error("Error getting members:", error); + return undefined; } } -// Emailでメンバーを取得する 見つからなければundefinedを返す export async function getMemberByEmail( email: string, ): Promise { try { const members = await getMembers(); - const member = members.find((m) => m.mail === email); - return member ? member : undefined; + return members.find((m) => m.mail === email); } catch (error) { console.error("Error getting member by email:", error); + return undefined; } } @@ -30,30 +29,38 @@ export async function getMemberByDiscordId( ): Promise { try { const members = await getMembers(); - const member = members.find((m) => m.discordId === discordId); - return member ? member : undefined; + return members.find((m) => m.discordId === discordId); } catch (error) { console.error("Error getting member by discord id:", error); + return undefined; } } -// memberにdiscordIdを追加する export async function addDiscordId( member: Member, discordId: string, -): Promise { +): Promise { + if (!member.id) { + console.error("Member ID is undefined"); + return false; + } + try { - await setDiscordId(member.id!, discordId); + await setDiscordId(member.id, discordId); + return true; } catch (error) { console.error("Error adding discord id:", error); + return false; } } -export async function addMember(memberData: Member): Promise { +export async function addMember(memberData: Member): Promise { try { await insertMember(memberData); console.log("Member successfully added"); + return true; } catch (error) { console.error("Error adding member:", error); + return false; } } diff --git a/src/controllers/authController.ts b/src/controllers/authController.ts index 75028a5..302eac8 100644 --- a/src/controllers/authController.ts +++ b/src/controllers/authController.ts @@ -9,18 +9,31 @@ async function sendAuthMailController(userInfo: AuthData) { if (!checkAuthData(userInfo)) { throw new Error("Invalid AuthData"); } - await sendAuthMail( - userInfo.mail!, - userInfo.student_number!, - userInfo.department!, - ); - const member = await getMemberByEmail(userInfo.mail!); + const { mail, student_number, department, discordId } = userInfo; + + if (!mail || !student_number || !department || !discordId) { + throw new Error("Missing required fields in AuthData"); + } + + await sendAuthMail(mail, student_number, department); + + const member = await getMemberByEmail(mail); + + if (!member) { + throw new Error("Member not found"); + } + checkMember(member); - await setDiscordId(member!.id!, userInfo.discordId!); + if (!member.id) { + throw new Error("Member ID is missing"); + } + + await setDiscordId(member.id, discordId); } catch (e) { console.error(e); + throw e; // エラーを上位に伝播させる } } diff --git a/src/events/messageCreate.ts b/src/events/messageCreate.ts index 9e0cc9d..56c2aed 100644 --- a/src/events/messageCreate.ts +++ b/src/events/messageCreate.ts @@ -117,24 +117,24 @@ async function validateAndRegisterUser( ) { const mail = message.content; if (mail.endsWith("@shizuoka.ac.jp")) { - userInfo.mail = mail; - if (await authMember(userInfo)) { + const updatedUserInfo = { ...userInfo, mail }; + if (await authMember(updatedUserInfo)) { try { - userInfo.discordId = message.author.id; - await sendAuthMailController(userInfo); + updatedUserInfo.discordId = message.author.id; + await sendAuthMailController(updatedUserInfo); } catch (e) { - userInfo = clearAuthData(); await reply("認証に失敗しました。もう一度やり直してください"); await reply("名前(フルネーム)を教えてください"); + userStates.set(userId, clearAuthData()); return; } await reply( "認証メールを送信しました。静大メールから認証を行い、Discordサーバーで`/auth`コマンドを実行してください", ); } else { - userInfo = clearAuthData(); await reply("認証に失敗しました。もう一度やり直してください"); await reply("名前(フルネーム)を教えてください"); + userStates.set(userId, clearAuthData()); } userStates.delete(userId); // 登録後は状態をクリア } else { diff --git a/src/usecases/getHotChannels.ts b/src/usecases/getHotChannels.ts index 15e13eb..4620767 100644 --- a/src/usecases/getHotChannels.ts +++ b/src/usecases/getHotChannels.ts @@ -32,7 +32,9 @@ export async function generateChannelActivityRanking(guild: Guild) { if (messages.size === 0) break; totalMessages += messages.size; lastId = messages.last()?.id; - if (messages.last()!.createdTimestamp < oneDayAgoSnowflake) break; + const lastMessage = messages.last(); + if (lastMessage && lastMessage.createdTimestamp < oneDayAgoSnowflake) + break; } return { id: channel.id, diff --git a/src/utils/checkMemberRole.ts b/src/utils/checkMemberRole.ts index 61bb611..39e2b6b 100644 --- a/src/utils/checkMemberRole.ts +++ b/src/utils/checkMemberRole.ts @@ -2,7 +2,12 @@ import type { CommandInteraction } from "discord.js"; import administratorRoleProperty from "../roles/administrator"; async function checkIsAdmin(interaction: CommandInteraction): Promise { - const member = await interaction.guild!.members.fetch(interaction.user.id); + const guild = interaction.guild; + if (!guild) { + return false; + } + + const member = await guild.members.fetch(interaction.user.id); const isAdmin: boolean = member.roles.cache.some( (role) => role.name === administratorRoleProperty.roleName, ); From a13ac7ce6f11dad052e016b0dc92cefa61ee2bd9 Mon Sep 17 00:00:00 2001 From: KinjiKawaguchi Date: Tue, 1 Oct 2024 09:48:55 +0900 Subject: [PATCH 06/12] format: formatter --- src/commands/auth.ts | 202 ++++++++++++++++++++++++------------------- 1 file changed, 111 insertions(+), 91 deletions(-) diff --git a/src/commands/auth.ts b/src/commands/auth.ts index 91b8069..0e110c0 100644 --- a/src/commands/auth.ts +++ b/src/commands/auth.ts @@ -1,7 +1,16 @@ -import { SlashCommandBuilder, type CommandInteraction, type Guild, type Role, type GuildMember } from "discord.js"; +import { + SlashCommandBuilder, + type CommandInteraction, + type Guild, + type Role, + type GuildMember, +} from "discord.js"; import type { Command } from "../types/command"; import { adminAuth } from "../infra/firebase"; -import { getMemberByDiscordId, getMemberByEmail } from "../controllers/MemberController"; +import { + getMemberByDiscordId, + getMemberByEmail, +} from "../controllers/MemberController"; import type { UserRecord } from "firebase-admin/lib/auth/user-record"; import createRoleIfNotFound from "../utils/createRoleNotFound"; import addRoleToMember from "../utils/addRoleToMember"; @@ -19,108 +28,119 @@ import unAuthorizedRoleProperty from "../roles/unAuthorized"; import type Member from "../entities/member"; const authCommand: Command = { - data: new SlashCommandBuilder().setName("auth").setDescription("認証コマンド"), - execute: authCommandHandler, + data: new SlashCommandBuilder() + .setName("auth") + .setDescription("認証コマンド"), + execute: authCommandHandler, }; async function authCommandHandler(interaction: CommandInteraction) { - //DMでは実行できないようにする - if (!interaction.guild) return await interaction.reply("このコマンドはサーバーでのみ実行可能です"); - - // Firestoreからメンバー情報を取得 - const member = await getMemberByDiscordId(interaction.user.id); - if (!member) { - await interaction.reply("メンバー情報が見つかりませんでした"); - return; - } - - // メール認証が完了しているか確認 - const user: UserRecord = await adminAuth.getUserByEmail(member.mail); - if (user.emailVerified) { - try { - await changeNickName(interaction, member); - await giveRoles(interaction); - } catch (error) { - console.error("Failed to auth", error); - await interaction.reply("認証に失敗しました"); - } - } else { - await interaction.reply("メール認証が完了していません"); - } + //DMでは実行できないようにする + if (!interaction.guild) + return await interaction.reply("このコマンドはサーバーでのみ実行可能です"); + + // Firestoreからメンバー情報を取得 + const member = await getMemberByDiscordId(interaction.user.id); + if (!member) { + await interaction.reply("メンバー情報が見つかりませんでした"); + return; + } + + // メール認証が完了しているか確認 + const user: UserRecord = await adminAuth.getUserByEmail(member.mail); + if (user.emailVerified) { + try { + await changeNickName(interaction, member); + await giveRoles(interaction); + } catch (error) { + console.error("Failed to auth", error); + await interaction.reply("認証に失敗しました"); + } + } else { + await interaction.reply("メール認証が完了していません"); + } } async function changeNickName(interaction: CommandInteraction, member: Member) { - const guild = interaction.guild; - if (!guild) { - throw new Error("This command can only be used in a guild."); - } - const guildMember = await guild.members.fetch(interaction.user.id); - const realName = member.name; - await guildMember.setNickname(realName); + const guild = interaction.guild; + if (!guild) { + throw new Error("This command can only be used in a guild."); + } + const guildMember = await guild.members.fetch(interaction.user.id); + const realName = member.name; + await guildMember.setNickname(realName); } async function giveRoles(interaction: CommandInteraction) { - const user = await adminAuth.getUserByEmail(interaction.user.tag); - const guild = interaction.guild; - if (!guild) { - throw new Error("This command can only be used in a guild."); - } - const guildMember = await guild.members.fetch(interaction.user.id); - await giveAuthorizedRole(interaction, guild, guildMember); - await giveDepartmentRole(interaction, user, guildMember); + const user = await adminAuth.getUserByEmail(interaction.user.tag); + const guild = interaction.guild; + if (!guild) { + throw new Error("This command can only be used in a guild."); + } + const guildMember = await guild.members.fetch(interaction.user.id); + await giveAuthorizedRole(interaction, guild, guildMember); + await giveDepartmentRole(interaction, user, guildMember); } -async function giveAuthorizedRole(interaction: CommandInteraction, guild: Guild, guildMember: GuildMember) { - try { - const authorizedRole: Role = await createRoleIfNotFound({ - guild, - customRole: authorizedRoleProperty, - }); - const unAuthorizedRole: Role = await createRoleIfNotFound({ - guild, - customRole: unAuthorizedRoleProperty, - }); - - await guildMember.roles.add(authorizedRole); - await guildMember.roles.remove(unAuthorizedRole); - - await interaction.reply("認証しました!"); - } catch (error) { - console.error("Failed to give Authorized Role"); - } +async function giveAuthorizedRole( + interaction: CommandInteraction, + guild: Guild, + guildMember: GuildMember, +) { + try { + const authorizedRole: Role = await createRoleIfNotFound({ + guild, + customRole: authorizedRoleProperty, + }); + const unAuthorizedRole: Role = await createRoleIfNotFound({ + guild, + customRole: unAuthorizedRoleProperty, + }); + + await guildMember.roles.add(authorizedRole); + await guildMember.roles.remove(unAuthorizedRole); + + await interaction.reply("認証しました!"); + } catch (error) { + console.error("Failed to give Authorized Role"); + } } -async function giveDepartmentRole(interaction: CommandInteraction, userAccount: UserRecord, guildMember: GuildMember) { - const guild = interaction.guild; - if (!guild) { - throw new Error("Guild not found"); - } - - if (!userAccount.email) { - throw new Error("User email not found"); - } - - // 認証用のアカウントから、メンバー情報を取得 - const member = await getMemberByEmail(userAccount.email); - if (!member) { - throw new Error("Member not found"); - } - - const departmentRoleMap = { - [Department.CS]: csRole, - [Department.IA]: iaRole, - [Department.BI]: biRole, - [Department.GRADUATE]: graduateRole, - [Department.OTHERS]: othersRole, - [Department.OBOG]: obogRole, // OBOGロールを追加 - }; - - const role = departmentRoleMap[member.department]; - if (!role) { - throw new Error("Department not found"); - } - - await addRoleToMember(guild, guildMember, role); +async function giveDepartmentRole( + interaction: CommandInteraction, + userAccount: UserRecord, + guildMember: GuildMember, +) { + const guild = interaction.guild; + if (!guild) { + throw new Error("Guild not found"); + } + + if (!userAccount.email) { + throw new Error("User email not found"); + } + + // 認証用のアカウントから、メンバー情報を取得 + const member = await getMemberByEmail(userAccount.email); + if (!member) { + throw new Error("Member not found"); + } + + const departmentRoleMap = { + [Department.CS]: csRole, + [Department.IA]: iaRole, + [Department.BI]: biRole, + [Department.GRADUATE]: graduateRole, + [Department.OTHERS]: othersRole, + [Department.OBOG]: obogRole, // OBOGロールを追加 + }; + + const role = departmentRoleMap[member.department]; + if (!role) { + throw new Error("Department not found"); + } + + await addRoleToMember(guild, guildMember, role); } export default authCommand; From b1ddd05e8e84c6a2b32c062b6f26e7fc52d2d0eb Mon Sep 17 00:00:00 2001 From: KinjiKawaguchi Date: Tue, 1 Oct 2024 09:56:23 +0900 Subject: [PATCH 07/12] Update biome.json and package.json --- biome.json | 3 ++- package.json | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/biome.json b/biome.json index da2af85..8b24b4f 100644 --- a/biome.json +++ b/biome.json @@ -11,7 +11,8 @@ }, "formatter": { "enabled": true, - "indentStyle": "tab" + "indentStyle": "tab", + "indentWidth": 2 }, "organizeImports": { "enabled": true diff --git a/package.json b/package.json index bccc0f2..dc97d08 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "deploy-commands": "ts-node src/deployCommands.ts", "format": "biome format --write", "lint": "biome lint --write", - "lint:fix": "eslint --ignore-pattern .gitignore './**/*.{js,ts}' --fix" + "lint:fix": "eslint --ignore-pattern .gitignore './**/*.{js,ts}' --fix", + "check": "biome check --write" }, "keywords": [], "author": "", From 1168466c90f98c270cfc92e3743453f39037737d Mon Sep 17 00:00:00 2001 From: KinjiKawaguchi Date: Tue, 1 Oct 2024 09:56:35 +0900 Subject: [PATCH 08/12] Refactor command imports and organize imports --- src/commands/auth.ts | 24 ++++++++++++------------ src/commands/health_check.ts | 2 +- src/commands/hotChannel.ts | 6 +----- src/commands/register.ts | 4 ++-- src/commands/rename_all.ts | 2 +- src/controllers/MemberController.ts | 2 +- src/controllers/authController.ts | 4 ++-- src/deployCommands.ts | 4 ++-- src/events/eventHandler.ts | 4 ++-- src/events/guildMemberAdd.ts | 2 +- src/events/messageCreate.ts | 8 ++++---- src/infra/firebase.ts | 4 ++-- src/main.ts | 6 +++--- src/tasks/scheduleHotChannels.ts | 2 +- src/types/customClient.ts | 2 +- src/usecases/getHotChannels.ts | 6 +++--- src/usecases/insertMember.ts | 2 +- src/usecases/sendAuthMail.ts | 4 ++-- src/utils/initializeRoles.ts | 4 ++-- 19 files changed, 44 insertions(+), 48 deletions(-) diff --git a/src/commands/auth.ts b/src/commands/auth.ts index 0e110c0..44fe1f7 100644 --- a/src/commands/auth.ts +++ b/src/commands/auth.ts @@ -1,31 +1,31 @@ import { - SlashCommandBuilder, type CommandInteraction, type Guild, - type Role, type GuildMember, + type Role, + SlashCommandBuilder, } from "discord.js"; -import type { Command } from "../types/command"; -import { adminAuth } from "../infra/firebase"; +import type { UserRecord } from "firebase-admin/lib/auth/user-record"; import { getMemberByDiscordId, getMemberByEmail, } from "../controllers/MemberController"; -import type { UserRecord } from "firebase-admin/lib/auth/user-record"; -import createRoleIfNotFound from "../utils/createRoleNotFound"; -import addRoleToMember from "../utils/addRoleToMember"; import Department from "../entities/department"; +import { adminAuth } from "../infra/firebase"; +import type { Command } from "../types/command"; +import addRoleToMember from "../utils/addRoleToMember"; +import createRoleIfNotFound from "../utils/createRoleNotFound"; +import type Member from "../entities/member"; +import authorizedRoleProperty from "../roles/authorized"; //以下は、ロールのimport import biRole from "../roles/departments/bi"; -import graduateRole from "../roles/departments/graduate"; -import othersRole from "../roles/departments/others"; -import obogRole from "../roles/departments/obog"; import csRole from "../roles/departments/cs"; +import graduateRole from "../roles/departments/graduate"; import iaRole from "../roles/departments/ia"; -import authorizedRoleProperty from "../roles/authorized"; +import obogRole from "../roles/departments/obog"; +import othersRole from "../roles/departments/others"; import unAuthorizedRoleProperty from "../roles/unAuthorized"; -import type Member from "../entities/member"; const authCommand: Command = { data: new SlashCommandBuilder() diff --git a/src/commands/health_check.ts b/src/commands/health_check.ts index b5d3747..cfd229b 100644 --- a/src/commands/health_check.ts +++ b/src/commands/health_check.ts @@ -1,4 +1,4 @@ -import { SlashCommandBuilder, type CommandInteraction } from "discord.js"; +import { type CommandInteraction, SlashCommandBuilder } from "discord.js"; import type { Command } from "../types/command"; const healthCheckCommand: Command = { diff --git a/src/commands/hotChannel.ts b/src/commands/hotChannel.ts index 23d3d01..859c4ea 100644 --- a/src/commands/hotChannel.ts +++ b/src/commands/hotChannel.ts @@ -1,8 +1,4 @@ -import { - SlashCommandBuilder, - type CommandInteraction, - Guild, -} from "discord.js"; +import { type CommandInteraction, SlashCommandBuilder } from "discord.js"; import type { Command } from "../types/command"; import { generateChannelActivityRanking } from "../usecases/getHotChannels"; import checkIsAdmin from "../utils/checkMemberRole"; diff --git a/src/commands/register.ts b/src/commands/register.ts index 2bed693..7e55fb6 100644 --- a/src/commands/register.ts +++ b/src/commands/register.ts @@ -1,8 +1,8 @@ import { type CommandInteraction, SlashCommandBuilder } from "discord.js"; -import type CommandWithArgs from "../types/commandWithArgs"; -import type Member from "../entities/member"; import { addMember } from "../controllers/MemberController"; import Department from "../entities/department"; +import type Member from "../entities/member"; +import type CommandWithArgs from "../types/commandWithArgs"; import checkIsAdmin from "../utils/checkMemberRole"; const registerCommand: CommandWithArgs = { diff --git a/src/commands/rename_all.ts b/src/commands/rename_all.ts index b2149b6..1d6a9f2 100644 --- a/src/commands/rename_all.ts +++ b/src/commands/rename_all.ts @@ -1,7 +1,7 @@ import { type CommandInteraction, SlashCommandBuilder } from "discord.js"; +import { getMemberByDiscordId } from "../controllers/MemberController"; import type { Command } from "../types/command"; import checkIsAdmin from "../utils/checkMemberRole"; -import { getMemberByDiscordId } from "../controllers/MemberController"; const renameALL: Command = { data: new SlashCommandBuilder() diff --git a/src/controllers/MemberController.ts b/src/controllers/MemberController.ts index dfa8281..2e28ffb 100644 --- a/src/controllers/MemberController.ts +++ b/src/controllers/MemberController.ts @@ -1,6 +1,6 @@ -import insertMember from "../usecases/insertMember"; import type Member from "../entities/member"; import getMembers from "../usecases/getMembers"; +import insertMember from "../usecases/insertMember"; import setDiscordId from "../usecases/setDiscordId"; export async function getAllMembers(): Promise { diff --git a/src/controllers/authController.ts b/src/controllers/authController.ts index 302eac8..9d67ade 100644 --- a/src/controllers/authController.ts +++ b/src/controllers/authController.ts @@ -1,8 +1,8 @@ +import type Member from "../entities/member"; import type AuthData from "../types/authData"; import sendAuthMail from "../usecases/sendAuthMail"; -import { getMemberByEmail } from "./MemberController"; import setDiscordId from "../usecases/setDiscordId"; -import type Member from "../entities/member"; +import { getMemberByEmail } from "./MemberController"; async function sendAuthMailController(userInfo: AuthData) { try { diff --git a/src/deployCommands.ts b/src/deployCommands.ts index 0290b41..9e3d843 100644 --- a/src/deployCommands.ts +++ b/src/deployCommands.ts @@ -1,8 +1,8 @@ -import { type SlashCommandBuilder, REST, Routes } from "discord.js"; import fs from "node:fs"; import path from "node:path"; -import type { Command } from "./types/command"; +import { REST, Routes, type SlashCommandBuilder } from "discord.js"; import dotenv from "dotenv"; +import type { Command } from "./types/command"; const commandHandlers: Command[] = []; diff --git a/src/events/eventHandler.ts b/src/events/eventHandler.ts index 0a87a02..d9f65cd 100644 --- a/src/events/eventHandler.ts +++ b/src/events/eventHandler.ts @@ -1,9 +1,9 @@ +import type AuthData from "../types/authData"; import type { CustomClient } from "../types/customClient"; import { setupClientReadyHandler } from "./clientReady"; -import { setupInteractionCreateHandler } from "./interactionCreate"; import { setupGuildMemberAddHandler } from "./guildMemberAdd"; +import { setupInteractionCreateHandler } from "./interactionCreate"; import { setupMessageCreate } from "./messageCreate"; -import type AuthData from "../types/authData"; export function setupEventHandlers( client: CustomClient, diff --git a/src/events/guildMemberAdd.ts b/src/events/guildMemberAdd.ts index 975be5f..1521faa 100644 --- a/src/events/guildMemberAdd.ts +++ b/src/events/guildMemberAdd.ts @@ -1,7 +1,7 @@ import { Events, type Guild, type GuildMember, type Role } from "discord.js"; +import unAuthorizedRoleProperty from "../roles/unAuthorized"; import type { CustomClient } from "../types/customClient"; import createRoleIfNotFound from "../utils/createRoleNotFound"; -import unAuthorizedRoleProperty from "../roles/unAuthorized"; export function setupGuildMemberAddHandler(client: CustomClient) { client.on(Events.GuildMemberAdd, async (member: GuildMember) => { diff --git a/src/events/messageCreate.ts b/src/events/messageCreate.ts index 56c2aed..efd1764 100644 --- a/src/events/messageCreate.ts +++ b/src/events/messageCreate.ts @@ -1,10 +1,10 @@ import { ChannelType, Events, type Message } from "discord.js"; -import type { CustomClient } from "../types/customClient"; -import clearAuthData from "../utils/clearAuthData"; -import type AuthData from "../types/authData"; +import sendAuthMailController from "../controllers/authController"; import Department from "../entities/department"; +import type AuthData from "../types/authData"; +import type { CustomClient } from "../types/customClient"; import authMember from "../utils/authMember"; -import sendAuthMailController from "../controllers/authController"; +import clearAuthData from "../utils/clearAuthData"; export function setupMessageCreate( client: CustomClient, diff --git a/src/infra/firebase.ts b/src/infra/firebase.ts index 7cf7e1d..80f6193 100644 --- a/src/infra/firebase.ts +++ b/src/infra/firebase.ts @@ -1,9 +1,9 @@ +import dotenv from "dotenv"; import * as admin from "firebase-admin"; -import { initializeApp, type FirebaseApp } from "firebase/app"; +import { type FirebaseApp, initializeApp } from "firebase/app"; import { getAuth } from "firebase/auth"; //TODO: コンフィグの読み込みを分離 import serviceAccount from "../../its-discord-auth-firebase-adminsdk-wn2uo-ac781d8325.json"; -import dotenv from "dotenv"; admin.initializeApp({ credential: admin.credential.cert(serviceAccount as admin.ServiceAccount), diff --git a/src/main.ts b/src/main.ts index 2246ab2..ca5dc8d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,9 +1,9 @@ -import { CustomClient } from "./types/customClient"; import dotenv from "dotenv"; -import { loadCommands } from "./loadCommands"; import { setupEventHandlers } from "./events/eventHandler"; -import type AuthData from "./types/authData"; +import { loadCommands } from "./loadCommands"; import { scheduleHotChannels } from "./tasks/scheduleHotChannels"; +import type AuthData from "./types/authData"; +import { CustomClient } from "./types/customClient"; dotenv.config(); diff --git a/src/tasks/scheduleHotChannels.ts b/src/tasks/scheduleHotChannels.ts index 7279a9b..5f9bdca 100644 --- a/src/tasks/scheduleHotChannels.ts +++ b/src/tasks/scheduleHotChannels.ts @@ -1,7 +1,7 @@ import { CronJob } from "cron"; +import type { TextChannel } from "discord.js"; import type { CustomClient } from "../types/customClient"; import { generateChannelActivityRanking } from "../usecases/getHotChannels"; -import type { TextChannel } from "discord.js"; export function scheduleHotChannels( client: CustomClient, diff --git a/src/types/customClient.ts b/src/types/customClient.ts index cd75f3d..7c8db60 100644 --- a/src/types/customClient.ts +++ b/src/types/customClient.ts @@ -1,4 +1,4 @@ -import { GatewayIntentBits, Client, Partials, Collection } from "discord.js"; +import { Client, Collection, GatewayIntentBits, Partials } from "discord.js"; import type { Command } from "./command"; export class CustomClient extends Client { diff --git a/src/usecases/getHotChannels.ts b/src/usecases/getHotChannels.ts index 4620767..e44c067 100644 --- a/src/usecases/getHotChannels.ts +++ b/src/usecases/getHotChannels.ts @@ -1,10 +1,10 @@ import { + type APIEmbedField, ChannelType, + EmbedBuilder, type Guild, - type TextChannel, SnowflakeUtil, - EmbedBuilder, - type APIEmbedField, + type TextChannel, } from "discord.js"; export async function generateChannelActivityRanking(guild: Guild) { diff --git a/src/usecases/insertMember.ts b/src/usecases/insertMember.ts index 41fb0c3..f7a2036 100644 --- a/src/usecases/insertMember.ts +++ b/src/usecases/insertMember.ts @@ -1,5 +1,5 @@ -import type Member from "../entities/member"; import { v4 as uuidv4 } from "uuid"; +import type Member from "../entities/member"; import { db } from "../infra/firebase"; async function insertMember(member: Member) { diff --git a/src/usecases/sendAuthMail.ts b/src/usecases/sendAuthMail.ts index 8cf0a5f..303d09d 100644 --- a/src/usecases/sendAuthMail.ts +++ b/src/usecases/sendAuthMail.ts @@ -1,10 +1,10 @@ -import { auth } from "../infra/firebase"; import { type ActionCodeSettings, + type UserCredential, createUserWithEmailAndPassword, sendEmailVerification, - type UserCredential, } from "firebase/auth"; +import { auth } from "../infra/firebase"; async function sendAuthMail( mail: string, diff --git a/src/utils/initializeRoles.ts b/src/utils/initializeRoles.ts index 018cae3..dd3d846 100644 --- a/src/utils/initializeRoles.ts +++ b/src/utils/initializeRoles.ts @@ -1,8 +1,8 @@ import { readdirSync, statSync } from "node:fs"; import { join, resolve } from "node:path"; -import createRoleIfNotFound from "./createRoleNotFound"; -import type CustomRole from "../types/customRole"; import type { Guild } from "discord.js"; +import type CustomRole from "../types/customRole"; +import createRoleIfNotFound from "./createRoleNotFound"; async function readRolesFromDirectory(directoryPath: string, guild: Guild) { const files = readdirSync(directoryPath); From 173e1bd94bd02b57e369dbd06e8e10e1efb284e3 Mon Sep 17 00:00:00 2001 From: KinjiKawaguchi Date: Tue, 1 Oct 2024 09:58:11 +0900 Subject: [PATCH 09/12] Update dependencies in package.json and yarn.lock --- package.json | 10 +++++----- yarn.lock | 22 +++++++++++----------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index dc97d08..c2a226a 100644 --- a/package.json +++ b/package.json @@ -19,16 +19,16 @@ "@biomejs/biome": "1.9.2", "@types/uuid": "^10.0.0", "globals": "^15.9.0", - "nodemon": "^3.1.4", + "nodemon": "^3.1.7", "ts-node": "^10.9.2", - "typescript": "^5.5.4" + "typescript": "^5.6.2" }, "dependencies": { "cron": "^3.1.7", - "discord.js": "^14.15.3", + "discord.js": "^14.16.3", "dotenv": "^16.4.5", - "firebase": "^10.13.1", - "firebase-admin": "^12.4.0", + "firebase": "^10.14.0", + "firebase-admin": "^12.6.0", "uuid": "^10.0.0" }, "packageManager": "yarn@4.2.2" diff --git a/yarn.lock b/yarn.lock index 1f4cde7..25b7bdc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1580,7 +1580,7 @@ __metadata: languageName: node linkType: hard -"discord.js@npm:^14.15.3": +"discord.js@npm:^14.16.3": version: 14.16.3 resolution: "discord.js@npm:14.16.3" dependencies: @@ -1752,7 +1752,7 @@ __metadata: languageName: node linkType: hard -"firebase-admin@npm:^12.4.0": +"firebase-admin@npm:^12.6.0": version: 12.6.0 resolution: "firebase-admin@npm:12.6.0" dependencies: @@ -1776,7 +1776,7 @@ __metadata: languageName: node linkType: hard -"firebase@npm:^10.13.1": +"firebase@npm:^10.14.0": version: 10.14.0 resolution: "firebase@npm:10.14.0" dependencies: @@ -2187,14 +2187,14 @@ __metadata: "@biomejs/biome": "npm:1.9.2" "@types/uuid": "npm:^10.0.0" cron: "npm:^3.1.7" - discord.js: "npm:^14.15.3" + discord.js: "npm:^14.16.3" dotenv: "npm:^16.4.5" - firebase: "npm:^10.13.1" - firebase-admin: "npm:^12.4.0" + firebase: "npm:^10.14.0" + firebase-admin: "npm:^12.6.0" globals: "npm:^15.9.0" - nodemon: "npm:^3.1.4" + nodemon: "npm:^3.1.7" ts-node: "npm:^10.9.2" - typescript: "npm:^5.5.4" + typescript: "npm:^5.6.2" uuid: "npm:^10.0.0" languageName: unknown linkType: soft @@ -2658,7 +2658,7 @@ __metadata: languageName: node linkType: hard -"nodemon@npm:^3.1.4": +"nodemon@npm:^3.1.7": version: 3.1.7 resolution: "nodemon@npm:3.1.7" dependencies: @@ -3157,7 +3157,7 @@ __metadata: languageName: node linkType: hard -"typescript@npm:^5.5.4": +"typescript@npm:^5.6.2": version: 5.6.2 resolution: "typescript@npm:5.6.2" bin: @@ -3167,7 +3167,7 @@ __metadata: languageName: node linkType: hard -"typescript@patch:typescript@npm%3A^5.5.4#optional!builtin": +"typescript@patch:typescript@npm%3A^5.6.2#optional!builtin": version: 5.6.2 resolution: "typescript@patch:typescript@npm%3A5.6.2#optional!builtin::version=5.6.2&hash=b45daf" bin: From 50855f26a757b389635d22d34dfa104c9bf29f25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=8B=E3=82=8F=E3=81=8D=E3=82=93?= Date: Tue, 1 Oct 2024 22:35:08 +0900 Subject: [PATCH 10/12] ci: change indent type tab -> space --- biome.json | 58 +++---- package.json | 66 ++++---- src/commands/auth.ts | 206 ++++++++++++------------- src/commands/health_check.ts | 12 +- src/commands/hotChannel.ts | 42 +++--- src/commands/register.ts | 112 +++++++------- src/commands/rename_all.ts | 68 ++++----- src/commands/who.ts | 76 +++++----- src/controllers/MemberController.ts | 86 +++++------ src/controllers/authController.ts | 68 ++++----- src/deployCommands.ts | 98 ++++++------ src/entities/department.ts | 12 +- src/entities/member.ts | 12 +- src/events/clientReady.ts | 30 ++-- src/events/eventHandler.ts | 12 +- src/events/guildMemberAdd.ts | 52 +++---- src/events/interactionCreate.ts | 44 +++--- src/events/messageCreate.ts | 224 ++++++++++++++-------------- src/infra/firebase.ts | 20 +-- src/loadCommands.ts | 30 ++-- src/main.ts | 18 +-- src/roles/administrator.ts | 6 +- src/roles/authorized.ts | 6 +- src/roles/departments/bi.ts | 6 +- src/roles/departments/cs.ts | 6 +- src/roles/departments/graduate.ts | 6 +- src/roles/departments/ia.ts | 6 +- src/roles/departments/obog.ts | 6 +- src/roles/departments/others.ts | 6 +- src/roles/unAuthorized.ts | 6 +- src/tasks/scheduleHotChannels.ts | 64 ++++---- src/types/authData.ts | 10 +- src/types/command.ts | 4 +- src/types/commandWithArgs.ts | 8 +- src/types/customClient.ts | 26 ++-- src/types/customRole.ts | 6 +- src/usecases/getHotChannels.ts | 148 +++++++++--------- src/usecases/getMembers.ts | 32 ++-- src/usecases/insertMember.ts | 18 +-- src/usecases/sendAuthMail.ts | 52 +++---- src/usecases/setDiscordId.ts | 8 +- src/utils/addRoleToMember.ts | 18 +-- src/utils/authMember.ts | 22 +-- src/utils/checkMemberRole.ts | 18 +-- src/utils/clearAuthData.ts | 14 +- src/utils/createRoleNotFound.ts | 44 +++--- src/utils/initializeRoles.ts | 44 +++--- src/utils/makeDepartmentRole.ts | 24 +-- tsconfig.json | 200 ++++++++++++------------- 49 files changed, 1080 insertions(+), 1080 deletions(-) diff --git a/biome.json b/biome.json index 8b24b4f..b158ab6 100644 --- a/biome.json +++ b/biome.json @@ -1,31 +1,31 @@ { - "$schema": "https://biomejs.dev/schemas/1.9.2/schema.json", - "vcs": { - "enabled": false, - "clientKind": "git", - "useIgnoreFile": false - }, - "files": { - "ignoreUnknown": false, - "ignore": [] - }, - "formatter": { - "enabled": true, - "indentStyle": "tab", - "indentWidth": 2 - }, - "organizeImports": { - "enabled": true - }, - "linter": { - "enabled": true, - "rules": { - "recommended": true - } - }, - "javascript": { - "formatter": { - "quoteStyle": "double" - } - } + "$schema": "https://biomejs.dev/schemas/1.9.2/schema.json", + "vcs": { + "enabled": false, + "clientKind": "git", + "useIgnoreFile": false + }, + "files": { + "ignoreUnknown": false, + "ignore": [] + }, + "formatter": { + "enabled": true, + "indentStyle": "space", + "indentWidth": 2 + }, + "organizeImports": { + "enabled": true + }, + "linter": { + "enabled": true, + "rules": { + "recommended": true + } + }, + "javascript": { + "formatter": { + "quoteStyle": "double" + } + } } diff --git a/package.json b/package.json index c2a226a..37390a5 100644 --- a/package.json +++ b/package.json @@ -1,35 +1,35 @@ { - "name": "its-discord-auth", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "start": "nodemon --exec ts-node src/main.ts", - "test": "ts-node src/main.ts", - "deploy-commands": "ts-node src/deployCommands.ts", - "format": "biome format --write", - "lint": "biome lint --write", - "lint:fix": "eslint --ignore-pattern .gitignore './**/*.{js,ts}' --fix", - "check": "biome check --write" - }, - "keywords": [], - "author": "", - "license": "ISC", - "devDependencies": { - "@biomejs/biome": "1.9.2", - "@types/uuid": "^10.0.0", - "globals": "^15.9.0", - "nodemon": "^3.1.7", - "ts-node": "^10.9.2", - "typescript": "^5.6.2" - }, - "dependencies": { - "cron": "^3.1.7", - "discord.js": "^14.16.3", - "dotenv": "^16.4.5", - "firebase": "^10.14.0", - "firebase-admin": "^12.6.0", - "uuid": "^10.0.0" - }, - "packageManager": "yarn@4.2.2" + "name": "its-discord-auth", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "start": "nodemon --exec ts-node src/main.ts", + "test": "ts-node src/main.ts", + "deploy-commands": "ts-node src/deployCommands.ts", + "format": "biome format --write", + "lint": "biome lint --write", + "lint:fix": "eslint --ignore-pattern .gitignore './**/*.{js,ts}' --fix", + "check": "biome check --write" + }, + "keywords": [], + "author": "", + "license": "ISC", + "devDependencies": { + "@biomejs/biome": "1.9.2", + "@types/uuid": "^10.0.0", + "globals": "^15.9.0", + "nodemon": "^3.1.7", + "ts-node": "^10.9.2", + "typescript": "^5.6.2" + }, + "dependencies": { + "cron": "^3.1.7", + "discord.js": "^14.16.3", + "dotenv": "^16.4.5", + "firebase": "^10.14.0", + "firebase-admin": "^12.6.0", + "uuid": "^10.0.0" + }, + "packageManager": "yarn@4.2.2" } diff --git a/src/commands/auth.ts b/src/commands/auth.ts index 44fe1f7..ba23046 100644 --- a/src/commands/auth.ts +++ b/src/commands/auth.ts @@ -1,14 +1,14 @@ import { - type CommandInteraction, - type Guild, - type GuildMember, - type Role, - SlashCommandBuilder, + type CommandInteraction, + type Guild, + type GuildMember, + type Role, + SlashCommandBuilder, } from "discord.js"; import type { UserRecord } from "firebase-admin/lib/auth/user-record"; import { - getMemberByDiscordId, - getMemberByEmail, + getMemberByDiscordId, + getMemberByEmail, } from "../controllers/MemberController"; import Department from "../entities/department"; import { adminAuth } from "../infra/firebase"; @@ -28,119 +28,119 @@ import othersRole from "../roles/departments/others"; import unAuthorizedRoleProperty from "../roles/unAuthorized"; const authCommand: Command = { - data: new SlashCommandBuilder() - .setName("auth") - .setDescription("認証コマンド"), - execute: authCommandHandler, + data: new SlashCommandBuilder() + .setName("auth") + .setDescription("認証コマンド"), + execute: authCommandHandler, }; async function authCommandHandler(interaction: CommandInteraction) { - //DMでは実行できないようにする - if (!interaction.guild) - return await interaction.reply("このコマンドはサーバーでのみ実行可能です"); - - // Firestoreからメンバー情報を取得 - const member = await getMemberByDiscordId(interaction.user.id); - if (!member) { - await interaction.reply("メンバー情報が見つかりませんでした"); - return; - } - - // メール認証が完了しているか確認 - const user: UserRecord = await adminAuth.getUserByEmail(member.mail); - if (user.emailVerified) { - try { - await changeNickName(interaction, member); - await giveRoles(interaction); - } catch (error) { - console.error("Failed to auth", error); - await interaction.reply("認証に失敗しました"); - } - } else { - await interaction.reply("メール認証が完了していません"); - } + //DMでは実行できないようにする + if (!interaction.guild) + return await interaction.reply("このコマンドはサーバーでのみ実行可能です"); + + // Firestoreからメンバー情報を取得 + const member = await getMemberByDiscordId(interaction.user.id); + if (!member) { + await interaction.reply("メンバー情報が見つかりませんでした"); + return; + } + + // メール認証が完了しているか確認 + const user: UserRecord = await adminAuth.getUserByEmail(member.mail); + if (user.emailVerified) { + try { + await changeNickName(interaction, member); + await giveRoles(interaction); + } catch (error) { + console.error("Failed to auth", error); + await interaction.reply("認証に失敗しました"); + } + } else { + await interaction.reply("メール認証が完了していません"); + } } async function changeNickName(interaction: CommandInteraction, member: Member) { - const guild = interaction.guild; - if (!guild) { - throw new Error("This command can only be used in a guild."); - } - const guildMember = await guild.members.fetch(interaction.user.id); - const realName = member.name; - await guildMember.setNickname(realName); + const guild = interaction.guild; + if (!guild) { + throw new Error("This command can only be used in a guild."); + } + const guildMember = await guild.members.fetch(interaction.user.id); + const realName = member.name; + await guildMember.setNickname(realName); } async function giveRoles(interaction: CommandInteraction) { - const user = await adminAuth.getUserByEmail(interaction.user.tag); - const guild = interaction.guild; - if (!guild) { - throw new Error("This command can only be used in a guild."); - } - const guildMember = await guild.members.fetch(interaction.user.id); - await giveAuthorizedRole(interaction, guild, guildMember); - await giveDepartmentRole(interaction, user, guildMember); + const user = await adminAuth.getUserByEmail(interaction.user.tag); + const guild = interaction.guild; + if (!guild) { + throw new Error("This command can only be used in a guild."); + } + const guildMember = await guild.members.fetch(interaction.user.id); + await giveAuthorizedRole(interaction, guild, guildMember); + await giveDepartmentRole(interaction, user, guildMember); } async function giveAuthorizedRole( - interaction: CommandInteraction, - guild: Guild, - guildMember: GuildMember, + interaction: CommandInteraction, + guild: Guild, + guildMember: GuildMember, ) { - try { - const authorizedRole: Role = await createRoleIfNotFound({ - guild, - customRole: authorizedRoleProperty, - }); - const unAuthorizedRole: Role = await createRoleIfNotFound({ - guild, - customRole: unAuthorizedRoleProperty, - }); - - await guildMember.roles.add(authorizedRole); - await guildMember.roles.remove(unAuthorizedRole); - - await interaction.reply("認証しました!"); - } catch (error) { - console.error("Failed to give Authorized Role"); - } + try { + const authorizedRole: Role = await createRoleIfNotFound({ + guild, + customRole: authorizedRoleProperty, + }); + const unAuthorizedRole: Role = await createRoleIfNotFound({ + guild, + customRole: unAuthorizedRoleProperty, + }); + + await guildMember.roles.add(authorizedRole); + await guildMember.roles.remove(unAuthorizedRole); + + await interaction.reply("認証しました!"); + } catch (error) { + console.error("Failed to give Authorized Role"); + } } async function giveDepartmentRole( - interaction: CommandInteraction, - userAccount: UserRecord, - guildMember: GuildMember, + interaction: CommandInteraction, + userAccount: UserRecord, + guildMember: GuildMember, ) { - const guild = interaction.guild; - if (!guild) { - throw new Error("Guild not found"); - } - - if (!userAccount.email) { - throw new Error("User email not found"); - } - - // 認証用のアカウントから、メンバー情報を取得 - const member = await getMemberByEmail(userAccount.email); - if (!member) { - throw new Error("Member not found"); - } - - const departmentRoleMap = { - [Department.CS]: csRole, - [Department.IA]: iaRole, - [Department.BI]: biRole, - [Department.GRADUATE]: graduateRole, - [Department.OTHERS]: othersRole, - [Department.OBOG]: obogRole, // OBOGロールを追加 - }; - - const role = departmentRoleMap[member.department]; - if (!role) { - throw new Error("Department not found"); - } - - await addRoleToMember(guild, guildMember, role); + const guild = interaction.guild; + if (!guild) { + throw new Error("Guild not found"); + } + + if (!userAccount.email) { + throw new Error("User email not found"); + } + + // 認証用のアカウントから、メンバー情報を取得 + const member = await getMemberByEmail(userAccount.email); + if (!member) { + throw new Error("Member not found"); + } + + const departmentRoleMap = { + [Department.CS]: csRole, + [Department.IA]: iaRole, + [Department.BI]: biRole, + [Department.GRADUATE]: graduateRole, + [Department.OTHERS]: othersRole, + [Department.OBOG]: obogRole, // OBOGロールを追加 + }; + + const role = departmentRoleMap[member.department]; + if (!role) { + throw new Error("Department not found"); + } + + await addRoleToMember(guild, guildMember, role); } export default authCommand; diff --git a/src/commands/health_check.ts b/src/commands/health_check.ts index cfd229b..4751cad 100644 --- a/src/commands/health_check.ts +++ b/src/commands/health_check.ts @@ -2,12 +2,12 @@ import { type CommandInteraction, SlashCommandBuilder } from "discord.js"; import type { Command } from "../types/command"; const healthCheckCommand: Command = { - data: new SlashCommandBuilder() - .setName("health_check") - .setDescription("ヘルスチェックコマンド"), - async execute(interaction: CommandInteraction) { - await interaction.reply("I am healthy!"); - }, + data: new SlashCommandBuilder() + .setName("health_check") + .setDescription("ヘルスチェックコマンド"), + async execute(interaction: CommandInteraction) { + await interaction.reply("I am healthy!"); + }, }; export default healthCheckCommand; diff --git a/src/commands/hotChannel.ts b/src/commands/hotChannel.ts index 859c4ea..9dbc3cf 100644 --- a/src/commands/hotChannel.ts +++ b/src/commands/hotChannel.ts @@ -4,30 +4,30 @@ import { generateChannelActivityRanking } from "../usecases/getHotChannels"; import checkIsAdmin from "../utils/checkMemberRole"; const hotChannelsCommand: Command = { - data: new SlashCommandBuilder() - .setName("hot_channels") - .setDescription("Show hot channels ranking"), + data: new SlashCommandBuilder() + .setName("hot_channels") + .setDescription("Show hot channels ranking"), - async execute(interaction: CommandInteraction) { - if (!interaction.guild) { - await interaction.reply("このコマンドはサーバーでのみ実行可能です"); - return; - } + async execute(interaction: CommandInteraction) { + if (!interaction.guild) { + await interaction.reply("このコマンドはサーバーでのみ実行可能です"); + return; + } - const isAdmin: boolean = await checkIsAdmin(interaction); - if (!isAdmin) { - await interaction.reply("このコマンドは管理者のみ使用可能です"); - return; - } + const isAdmin: boolean = await checkIsAdmin(interaction); + if (!isAdmin) { + await interaction.reply("このコマンドは管理者のみ使用可能です"); + return; + } - try { - const ranking = await generateChannelActivityRanking(interaction.guild); - await interaction.reply({ embeds: [ranking] }); - } catch (error) { - console.error("Error generating channel activity ranking:", error); - await interaction.reply("ランキングの生成中にエラーが発生しました。"); - } - }, + try { + const ranking = await generateChannelActivityRanking(interaction.guild); + await interaction.reply({ embeds: [ranking] }); + } catch (error) { + console.error("Error generating channel activity ranking:", error); + await interaction.reply("ランキングの生成中にエラーが発生しました。"); + } + }, }; export default hotChannelsCommand; diff --git a/src/commands/register.ts b/src/commands/register.ts index 7e55fb6..28594b3 100644 --- a/src/commands/register.ts +++ b/src/commands/register.ts @@ -6,82 +6,82 @@ import type CommandWithArgs from "../types/commandWithArgs"; import checkIsAdmin from "../utils/checkMemberRole"; const registerCommand: CommandWithArgs = { - data: new SlashCommandBuilder() - .setName("register") - .setDescription("認証コマンド") - .addStringOption((option) => - option.setName("mail").setDescription("メールアドレス").setRequired(true), - ) - .addStringOption((option) => - option.setName("name").setDescription("名前").setRequired(true), - ) - .addStringOption((option) => - option.setName("department").setDescription("学部").setRequired(true), - ) - .addStringOption((option) => - option - .setName("student_number") - .setDescription("学籍番号") - .setRequired(true), - ) as SlashCommandBuilder, - execute: addMemberCommandHandler, + data: new SlashCommandBuilder() + .setName("register") + .setDescription("認証コマンド") + .addStringOption((option) => + option.setName("mail").setDescription("メールアドレス").setRequired(true), + ) + .addStringOption((option) => + option.setName("name").setDescription("名前").setRequired(true), + ) + .addStringOption((option) => + option.setName("department").setDescription("学部").setRequired(true), + ) + .addStringOption((option) => + option + .setName("student_number") + .setDescription("学籍番号") + .setRequired(true), + ) as SlashCommandBuilder, + execute: addMemberCommandHandler, }; async function addMemberCommandHandler(interaction: CommandInteraction) { - //DMでは使用不可 - if (!interaction.guild) - return await interaction.reply( - "このコマンドはサーバー内でのみ使用可能です。", - ); + //DMでは使用不可 + if (!interaction.guild) + return await interaction.reply( + "このコマンドはサーバー内でのみ使用可能です。", + ); - //adminロールを持っているか確認 - const isAdmin: boolean = await checkIsAdmin(interaction); - if (!isAdmin) - return await interaction.reply("このコマンドは管理者のみ使用可能です。"); + //adminロールを持っているか確認 + const isAdmin: boolean = await checkIsAdmin(interaction); + if (!isAdmin) + return await interaction.reply("このコマンドは管理者のみ使用可能です。"); - //引数が正しいか確認 - const isArgsValid: boolean = validateArgs( - interaction.options.get("mail")?.value as string, - interaction.options.get("department")?.value as string, - interaction.options.get("student_number")?.value as string, - ); - if (!isArgsValid) return await interaction.reply("引数が不正です。"); + //引数が正しいか確認 + const isArgsValid: boolean = validateArgs( + interaction.options.get("mail")?.value as string, + interaction.options.get("department")?.value as string, + interaction.options.get("student_number")?.value as string, + ); + if (!isArgsValid) return await interaction.reply("引数が不正です。"); - await addMember({ - mail: interaction.options.get("mail")?.value as string, - name: interaction.options.get("name")?.value as string, - department: interaction.options.get("department")?.value as string, - student_number: interaction.options.get("student_number")?.value as string, - } as Member); + await addMember({ + mail: interaction.options.get("mail")?.value as string, + name: interaction.options.get("name")?.value as string, + department: interaction.options.get("department")?.value as string, + student_number: interaction.options.get("student_number")?.value as string, + } as Member); - await interaction.reply( - `${interaction.options.get("name")?.value}さんを登録しました`, - ); + await interaction.reply( + `${interaction.options.get("name")?.value}さんを登録しました`, + ); } function validateArgs( - mail: string, - department: string, - studentNumber: string, + mail: string, + department: string, + studentNumber: string, ): boolean { - return ( - validateEmail(mail) && - validateStudentNumber(studentNumber) && - validateDepartment(department) - ); + return ( + validateEmail(mail) && + validateStudentNumber(studentNumber) && + validateDepartment(department) + ); } function validateEmail(email: string): boolean { - // mailが@shizuoka.ac.jpで終わっているか検証 - return email.endsWith("@shizuoka.ac.jp"); + // mailが@shizuoka.ac.jpで終わっているか検証 + return email.endsWith("@shizuoka.ac.jp"); } function validateStudentNumber(studentNumber: string): boolean { - return studentNumber.startsWith("7") || studentNumber.length === 8; + return studentNumber.startsWith("7") || studentNumber.length === 8; } function validateDepartment(department: string): boolean { - return Object.values(Department).includes(department as Department); + return Object.values(Department).includes(department as Department); } export default registerCommand; diff --git a/src/commands/rename_all.ts b/src/commands/rename_all.ts index 1d6a9f2..df14032 100644 --- a/src/commands/rename_all.ts +++ b/src/commands/rename_all.ts @@ -4,43 +4,43 @@ import type { Command } from "../types/command"; import checkIsAdmin from "../utils/checkMemberRole"; const renameALL: Command = { - data: new SlashCommandBuilder() - .setName("rename_all") - .setDescription("全員のニックネームを変更する"), - execute: renameALLHandler, + data: new SlashCommandBuilder() + .setName("rename_all") + .setDescription("全員のニックネームを変更する"), + execute: renameALLHandler, }; async function renameALLHandler(interaction: CommandInteraction) { - if (!interaction.guild) - return await interaction.reply( - "このコマンドはサーバー内でのみ使用可能です。", - ); - - const isAdmin = await checkIsAdmin(interaction); - if (!isAdmin) - return await interaction.reply("このコマンドは管理者のみ使用可能です。"); - - // 応答がタイムアウトしないように遅延させる - await interaction.deferReply(); - - const members = await interaction.guild.members.fetch(); - const renamePromises = members.map(async (member) => { - const memberOnFirebase = await getMemberByDiscordId(member.id); - if (!memberOnFirebase) return; - - try { - await member.setNickname(memberOnFirebase.name); - console.log( - `[NOTE] Changed nickname of ${member.nickname}, ${memberOnFirebase.name}`, - ); - } catch (error) { - console.error(`[ERROR] Failed to rename ${member.nickname}: ${error}`); - } - }); - - await Promise.all(renamePromises); - await interaction.followUp("ニックネームの変更が完了しました。"); - console.log("[NOTE] Completed changing nicknames"); + if (!interaction.guild) + return await interaction.reply( + "このコマンドはサーバー内でのみ使用可能です。", + ); + + const isAdmin = await checkIsAdmin(interaction); + if (!isAdmin) + return await interaction.reply("このコマンドは管理者のみ使用可能です。"); + + // 応答がタイムアウトしないように遅延させる + await interaction.deferReply(); + + const members = await interaction.guild.members.fetch(); + const renamePromises = members.map(async (member) => { + const memberOnFirebase = await getMemberByDiscordId(member.id); + if (!memberOnFirebase) return; + + try { + await member.setNickname(memberOnFirebase.name); + console.log( + `[NOTE] Changed nickname of ${member.nickname}, ${memberOnFirebase.name}`, + ); + } catch (error) { + console.error(`[ERROR] Failed to rename ${member.nickname}: ${error}`); + } + }); + + await Promise.all(renamePromises); + await interaction.followUp("ニックネームの変更が完了しました。"); + console.log("[NOTE] Completed changing nicknames"); } export default renameALL; diff --git a/src/commands/who.ts b/src/commands/who.ts index a3c4f28..158b7bb 100644 --- a/src/commands/who.ts +++ b/src/commands/who.ts @@ -1,53 +1,53 @@ import { - type CommandInteraction, - SlashCommandBuilder, - type User, + type CommandInteraction, + SlashCommandBuilder, + type User, } from "discord.js"; import { getMemberByDiscordId } from "../controllers/MemberController"; import type CommandWithArgs from "../types/commandWithArgs"; const whoCommand: CommandWithArgs = { - data: new SlashCommandBuilder() - .setName("who") - .setDescription("ユーザー情報を表示します。") - .addUserOption((option) => - option - .setName("user") - .setDescription("情報を表示するユーザー") - .setRequired(true), - ) as SlashCommandBuilder, - execute: whoCommandHandler, + data: new SlashCommandBuilder() + .setName("who") + .setDescription("ユーザー情報を表示します。") + .addUserOption((option) => + option + .setName("user") + .setDescription("情報を表示するユーザー") + .setRequired(true), + ) as SlashCommandBuilder, + execute: whoCommandHandler, }; async function whoCommandHandler(interaction: CommandInteraction) { - if (!interaction.guild) { - await interaction.reply("このコマンドはサーバー内でのみ使用可能です。"); - return; - } - - printLog(interaction); - - const userOption = interaction.options.get("user"); - if (!userOption || !userOption.user) { - await interaction.reply("ユーザーを指定してください。"); - return; - } - - const user: User = userOption.user; - const member = await getMemberByDiscordId(user.id); - - if (!member) { - await interaction.reply("メンバー情報が見つかりませんでした。"); - return; - } - - await interaction.reply( - `名前: ${member.name}\n学部: ${member.department}\n学籍番号: ${member.student_number}\nメールアドレス: ${member.mail}`, - ); + if (!interaction.guild) { + await interaction.reply("このコマンドはサーバー内でのみ使用可能です。"); + return; + } + + printLog(interaction); + + const userOption = interaction.options.get("user"); + if (!userOption || !userOption.user) { + await interaction.reply("ユーザーを指定してください。"); + return; + } + + const user: User = userOption.user; + const member = await getMemberByDiscordId(user.id); + + if (!member) { + await interaction.reply("メンバー情報が見つかりませんでした。"); + return; + } + + await interaction.reply( + `名前: ${member.name}\n学部: ${member.department}\n学籍番号: ${member.student_number}\nメールアドレス: ${member.mail}`, + ); } function printLog(interaction: CommandInteraction) { - console.log(`[COMMAND] who command terminated by ${interaction.user}`); + console.log(`[COMMAND] who command terminated by ${interaction.user}`); } export default whoCommand; diff --git a/src/controllers/MemberController.ts b/src/controllers/MemberController.ts index 2e28ffb..e17abda 100644 --- a/src/controllers/MemberController.ts +++ b/src/controllers/MemberController.ts @@ -4,63 +4,63 @@ import insertMember from "../usecases/insertMember"; import setDiscordId from "../usecases/setDiscordId"; export async function getAllMembers(): Promise { - try { - return await getMembers(); - } catch (error) { - console.error("Error getting members:", error); - return undefined; - } + try { + return await getMembers(); + } catch (error) { + console.error("Error getting members:", error); + return undefined; + } } export async function getMemberByEmail( - email: string, + email: string, ): Promise { - try { - const members = await getMembers(); - return members.find((m) => m.mail === email); - } catch (error) { - console.error("Error getting member by email:", error); - return undefined; - } + try { + const members = await getMembers(); + return members.find((m) => m.mail === email); + } catch (error) { + console.error("Error getting member by email:", error); + return undefined; + } } export async function getMemberByDiscordId( - discordId: string, + discordId: string, ): Promise { - try { - const members = await getMembers(); - return members.find((m) => m.discordId === discordId); - } catch (error) { - console.error("Error getting member by discord id:", error); - return undefined; - } + try { + const members = await getMembers(); + return members.find((m) => m.discordId === discordId); + } catch (error) { + console.error("Error getting member by discord id:", error); + return undefined; + } } export async function addDiscordId( - member: Member, - discordId: string, + member: Member, + discordId: string, ): Promise { - if (!member.id) { - console.error("Member ID is undefined"); - return false; - } + if (!member.id) { + console.error("Member ID is undefined"); + return false; + } - try { - await setDiscordId(member.id, discordId); - return true; - } catch (error) { - console.error("Error adding discord id:", error); - return false; - } + try { + await setDiscordId(member.id, discordId); + return true; + } catch (error) { + console.error("Error adding discord id:", error); + return false; + } } export async function addMember(memberData: Member): Promise { - try { - await insertMember(memberData); - console.log("Member successfully added"); - return true; - } catch (error) { - console.error("Error adding member:", error); - return false; - } + try { + await insertMember(memberData); + console.log("Member successfully added"); + return true; + } catch (error) { + console.error("Error adding member:", error); + return false; + } } diff --git a/src/controllers/authController.ts b/src/controllers/authController.ts index 9d67ade..876ba40 100644 --- a/src/controllers/authController.ts +++ b/src/controllers/authController.ts @@ -5,54 +5,54 @@ import setDiscordId from "../usecases/setDiscordId"; import { getMemberByEmail } from "./MemberController"; async function sendAuthMailController(userInfo: AuthData) { - try { - if (!checkAuthData(userInfo)) { - throw new Error("Invalid AuthData"); - } + try { + if (!checkAuthData(userInfo)) { + throw new Error("Invalid AuthData"); + } - const { mail, student_number, department, discordId } = userInfo; + const { mail, student_number, department, discordId } = userInfo; - if (!mail || !student_number || !department || !discordId) { - throw new Error("Missing required fields in AuthData"); - } + if (!mail || !student_number || !department || !discordId) { + throw new Error("Missing required fields in AuthData"); + } - await sendAuthMail(mail, student_number, department); + await sendAuthMail(mail, student_number, department); - const member = await getMemberByEmail(mail); + const member = await getMemberByEmail(mail); - if (!member) { - throw new Error("Member not found"); - } + if (!member) { + throw new Error("Member not found"); + } - checkMember(member); + checkMember(member); - if (!member.id) { - throw new Error("Member ID is missing"); - } + if (!member.id) { + throw new Error("Member ID is missing"); + } - await setDiscordId(member.id, discordId); - } catch (e) { - console.error(e); - throw e; // エラーを上位に伝播させる - } + await setDiscordId(member.id, discordId); + } catch (e) { + console.error(e); + throw e; // エラーを上位に伝播させる + } } function checkAuthData(userInfo: AuthData): boolean { - return ( - userInfo.mail !== undefined && - userInfo.student_number !== undefined && - userInfo.department !== undefined && - userInfo.discordId !== undefined - ); + return ( + userInfo.mail !== undefined && + userInfo.student_number !== undefined && + userInfo.department !== undefined && + userInfo.discordId !== undefined + ); } function checkMember(member: Member | undefined): void { - if (!member) { - throw new Error("Member not found"); - } - if (!member.id) { - throw new Error("Member id is not provided"); - } + if (!member) { + throw new Error("Member not found"); + } + if (!member.id) { + throw new Error("Member id is not provided"); + } } export default sendAuthMailController; diff --git a/src/deployCommands.ts b/src/deployCommands.ts index 9e3d843..ee65c81 100644 --- a/src/deployCommands.ts +++ b/src/deployCommands.ts @@ -10,69 +10,69 @@ const commandHandlers: Command[] = []; const commandData: SlashCommandBuilder[] = []; async function readCommands(directory: string): Promise { - const filesOrFolders = fs.readdirSync(directory); + const filesOrFolders = fs.readdirSync(directory); - for (const entry of filesOrFolders) { - const absolutePath = path.join(directory, entry); - if (fs.statSync(absolutePath).isDirectory()) { - await readCommands(absolutePath); - } else if (entry.endsWith(".ts")) { - const module = await import(absolutePath); - const command: Command = module.default; - if ("data" in command && "execute" in command) { - commandHandlers.push(command); - commandData.push(command.data); - console.log(`[INFO] Loaded command: ${command.data.name}`); - } else { - console.log( - `[WARNING] The command at ${absolutePath} is missing a required "data" or "execute" property.`, - ); - } - } - } + for (const entry of filesOrFolders) { + const absolutePath = path.join(directory, entry); + if (fs.statSync(absolutePath).isDirectory()) { + await readCommands(absolutePath); + } else if (entry.endsWith(".ts")) { + const module = await import(absolutePath); + const command: Command = module.default; + if ("data" in command && "execute" in command) { + commandHandlers.push(command); + commandData.push(command.data); + console.log(`[INFO] Loaded command: ${command.data.name}`); + } else { + console.log( + `[WARNING] The command at ${absolutePath} is missing a required "data" or "execute" property.`, + ); + } + } + } } function checkEnvVariables() { - dotenv.config(); - const token = process.env.TOKEN; - const clientId = process.env.APP_ID; - const guildId = process.env.GUILD_ID; + dotenv.config(); + const token = process.env.TOKEN; + const clientId = process.env.APP_ID; + const guildId = process.env.GUILD_ID; - if (!token || !clientId || !guildId) { - console.error("Missing environment variables."); - process.exit(1); - } - return { token, clientId, guildId }; + if (!token || !clientId || !guildId) { + console.error("Missing environment variables."); + process.exit(1); + } + return { token, clientId, guildId }; } // コマンドをデプロイする関数 async function deployCommands( - token: string, - clientId: string, - guildId: string, + token: string, + clientId: string, + guildId: string, ) { - const rest = new REST({ version: "10" }).setToken(token); - try { - console.log( - `Started refreshing ${commandData.length} application (/) commands.`, - ); - await rest.put(Routes.applicationGuildCommands(clientId, guildId), { - body: commandData, - }); - console.log( - `Successfully reloaded ${commandData.length} application (/) commands.`, - ); - } catch (error) { - console.error(error); - } + const rest = new REST({ version: "10" }).setToken(token); + try { + console.log( + `Started refreshing ${commandData.length} application (/) commands.`, + ); + await rest.put(Routes.applicationGuildCommands(clientId, guildId), { + body: commandData, + }); + console.log( + `Successfully reloaded ${commandData.length} application (/) commands.`, + ); + } catch (error) { + console.error(error); + } } async function main() { - const commandsPath = path.join(__dirname, "commands"); - await readCommands(commandsPath); + const commandsPath = path.join(__dirname, "commands"); + await readCommands(commandsPath); - const { token, clientId, guildId } = checkEnvVariables(); - await deployCommands(token, clientId, guildId); + const { token, clientId, guildId } = checkEnvVariables(); + await deployCommands(token, clientId, guildId); } main().catch(console.error); diff --git a/src/entities/department.ts b/src/entities/department.ts index bf0ddee..6e0fc75 100644 --- a/src/entities/department.ts +++ b/src/entities/department.ts @@ -1,10 +1,10 @@ enum Department { - CS = "CS", - BI = "BI", - IA = "IA", - GRADUATE = "GRADUATE", - OTHERS = "OTHERS", - OBOG = "OB/OG", + CS = "CS", + BI = "BI", + IA = "IA", + GRADUATE = "GRADUATE", + OTHERS = "OTHERS", + OBOG = "OB/OG", } export default Department; diff --git a/src/entities/member.ts b/src/entities/member.ts index 85b306f..8194b32 100644 --- a/src/entities/member.ts +++ b/src/entities/member.ts @@ -1,12 +1,12 @@ import type department from "./department"; interface Member { - id?: string; - name: string; - student_number: string; - department: department; - mail: string; - discordId?: string; + id?: string; + name: string; + student_number: string; + department: department; + mail: string; + discordId?: string; } export default Member; diff --git a/src/events/clientReady.ts b/src/events/clientReady.ts index b409152..efdac13 100644 --- a/src/events/clientReady.ts +++ b/src/events/clientReady.ts @@ -3,20 +3,20 @@ import type { CustomClient } from "../types/customClient"; import initializeRoles from "../utils/initializeRoles"; export function setupClientReadyHandler(client: CustomClient) { - client.once(Events.ClientReady, () => { - console.log("Ready!"); - if (client.user) { - console.log(`Logged in as ${client.user.tag}`); + client.once(Events.ClientReady, () => { + console.log("Ready!"); + if (client.user) { + console.log(`Logged in as ${client.user.tag}`); - //guildのリストを取得 - const guilds = client.guilds.cache; - if (guilds.size === 0) { - console.error("No guild found."); - throw new Error("No guild found."); - } - for (const [, guild] of guilds) { - initializeRoles(guild); - } - } - }); + //guildのリストを取得 + const guilds = client.guilds.cache; + if (guilds.size === 0) { + console.error("No guild found."); + throw new Error("No guild found."); + } + for (const [, guild] of guilds) { + initializeRoles(guild); + } + } + }); } diff --git a/src/events/eventHandler.ts b/src/events/eventHandler.ts index d9f65cd..aee01f8 100644 --- a/src/events/eventHandler.ts +++ b/src/events/eventHandler.ts @@ -6,11 +6,11 @@ import { setupInteractionCreateHandler } from "./interactionCreate"; import { setupMessageCreate } from "./messageCreate"; export function setupEventHandlers( - client: CustomClient, - userStates: Map, + client: CustomClient, + userStates: Map, ) { - setupClientReadyHandler(client); - setupInteractionCreateHandler(client); - setupGuildMemberAddHandler(client); - setupMessageCreate(client, userStates); + setupClientReadyHandler(client); + setupInteractionCreateHandler(client); + setupGuildMemberAddHandler(client); + setupMessageCreate(client, userStates); } diff --git a/src/events/guildMemberAdd.ts b/src/events/guildMemberAdd.ts index 1521faa..fcb0560 100644 --- a/src/events/guildMemberAdd.ts +++ b/src/events/guildMemberAdd.ts @@ -4,36 +4,36 @@ import type { CustomClient } from "../types/customClient"; import createRoleIfNotFound from "../utils/createRoleNotFound"; export function setupGuildMemberAddHandler(client: CustomClient) { - client.on(Events.GuildMemberAdd, async (member: GuildMember) => { - await sendDM(member); - await giveUnauthorizedRole(member); - }); + client.on(Events.GuildMemberAdd, async (member: GuildMember) => { + await sendDM(member); + await giveUnauthorizedRole(member); + }); } async function sendDM(member: GuildMember) { - try { - await member.send( - `ようこそ ${member.displayName} さん! ITS discord 認証botです!`, - ); - await member.send("名前(フルネーム)を教えてください"); - console.log(`Welcome message sent to ${member.displayName}.`); - } catch (error) { - console.error("Error sending DM:", error); - } + try { + await member.send( + `ようこそ ${member.displayName} さん! ITS discord 認証botです!`, + ); + await member.send("名前(フルネーム)を教えてください"); + console.log(`Welcome message sent to ${member.displayName}.`); + } catch (error) { + console.error("Error sending DM:", error); + } } async function giveUnauthorizedRole(member: GuildMember) { - try { - const guild: Guild = member.guild; - const role: Role = await createRoleIfNotFound({ - guild, - customRole: unAuthorizedRoleProperty, - }); - await member.roles.add(role); - console.log( - `Unauthorized role has been assigned to ${member.displayName}.`, - ); - } catch (error) { - console.error("Error creating Unauthorized role:", error); - } + try { + const guild: Guild = member.guild; + const role: Role = await createRoleIfNotFound({ + guild, + customRole: unAuthorizedRoleProperty, + }); + await member.roles.add(role); + console.log( + `Unauthorized role has been assigned to ${member.displayName}.`, + ); + } catch (error) { + console.error("Error creating Unauthorized role:", error); + } } diff --git a/src/events/interactionCreate.ts b/src/events/interactionCreate.ts index a951fdd..66d62d0 100644 --- a/src/events/interactionCreate.ts +++ b/src/events/interactionCreate.ts @@ -2,28 +2,28 @@ import { Events } from "discord.js"; import type { CustomClient } from "../types/customClient"; export function setupInteractionCreateHandler(client: CustomClient) { - client.on(Events.InteractionCreate, async (interaction) => { - if (!interaction.isChatInputCommand()) return; + client.on(Events.InteractionCreate, async (interaction) => { + if (!interaction.isChatInputCommand()) return; - const command = client.commands.get(interaction.commandName); - if (!command) { - console.error( - `No command matching ${interaction.commandName} was found.`, - ); - return; - } + const command = client.commands.get(interaction.commandName); + if (!command) { + console.error( + `No command matching ${interaction.commandName} was found.`, + ); + return; + } - try { - await command.execute(interaction); - } catch (error) { - console.error(error); - const replyContent = { - content: "There was an error while executing this command!", - ephemeral: true, - }; - interaction.replied || interaction.deferred - ? await interaction.followUp(replyContent) - : await interaction.reply(replyContent); - } - }); + try { + await command.execute(interaction); + } catch (error) { + console.error(error); + const replyContent = { + content: "There was an error while executing this command!", + ephemeral: true, + }; + interaction.replied || interaction.deferred + ? await interaction.followUp(replyContent) + : await interaction.reply(replyContent); + } + }); } diff --git a/src/events/messageCreate.ts b/src/events/messageCreate.ts index efd1764..ecb8a99 100644 --- a/src/events/messageCreate.ts +++ b/src/events/messageCreate.ts @@ -7,137 +7,137 @@ import authMember from "../utils/authMember"; import clearAuthData from "../utils/clearAuthData"; export function setupMessageCreate( - client: CustomClient, - userStates: Map, + client: CustomClient, + userStates: Map, ) { - client.on(Events.MessageCreate, async (message: Message) => { - if (message.author.bot || message.channel.type !== ChannelType.DM) return; - handleDM(message, userStates); - }); + client.on(Events.MessageCreate, async (message: Message) => { + if (message.author.bot || message.channel.type !== ChannelType.DM) return; + handleDM(message, userStates); + }); } async function handleDM(message: Message, userStates: Map) { - const userId = message.author.id; - const userInfo = userStates.get(userId) || {}; - const reply = async (text: string) => message.reply(text); + const userId = message.author.id; + const userInfo = userStates.get(userId) || {}; + const reply = async (text: string) => message.reply(text); - if (!userInfo.name) { - await setUserInfoAndReply( - userStates, - userId, - { name: message.content }, - "学籍番号を教えてください", - reply, - ); - } else if (!userInfo.student_number) { - await validateAndSetStudentNumber( - message, - userInfo, - userStates, - userId, - reply, - ); - } else if (!userInfo.department) { - await validateAndSetDepartment( - message, - userInfo, - userStates, - userId, - reply, - ); - } else if (!userInfo.mail) { - await validateAndRegisterUser(message, userInfo, userStates, userId, reply); - } + if (!userInfo.name) { + await setUserInfoAndReply( + userStates, + userId, + { name: message.content }, + "学籍番号を教えてください", + reply, + ); + } else if (!userInfo.student_number) { + await validateAndSetStudentNumber( + message, + userInfo, + userStates, + userId, + reply, + ); + } else if (!userInfo.department) { + await validateAndSetDepartment( + message, + userInfo, + userStates, + userId, + reply, + ); + } else if (!userInfo.mail) { + await validateAndRegisterUser(message, userInfo, userStates, userId, reply); + } } async function setUserInfoAndReply( - userStates: Map, - userId: string, - update: Partial, - replyMessage: string, - reply: (message: string) => Promise, + userStates: Map, + userId: string, + update: Partial, + replyMessage: string, + reply: (message: string) => Promise, ) { - const userInfo = userStates.get(userId) || {}; - Object.assign(userInfo, update); - userStates.set(userId, userInfo); - await reply(replyMessage); + const userInfo = userStates.get(userId) || {}; + Object.assign(userInfo, update); + userStates.set(userId, userInfo); + await reply(replyMessage); } async function validateAndSetStudentNumber( - message: Message, - userInfo: AuthData, - userStates: Map, - userId: string, - reply: (message: string) => Promise, + message: Message, + userInfo: AuthData, + userStates: Map, + userId: string, + reply: (message: string) => Promise, ) { - const studentNumber = message.content; - // 学籍番号の形式が正しいかどうか曖昧にチェック - if (!/^[a-zA-Z0-9]{8}$/.test(studentNumber)) { - await reply("学籍番号の形式が正しくありません。"); - return; - } - await setUserInfoAndReply( - userStates, - userId, - { student_number: studentNumber }, - "学科を以下から教えてください: CS, BI, IA, OTHERS", - reply, - ); + const studentNumber = message.content; + // 学籍番号の形式が正しいかどうか曖昧にチェック + if (!/^[a-zA-Z0-9]{8}$/.test(studentNumber)) { + await reply("学籍番号の形式が正しくありません。"); + return; + } + await setUserInfoAndReply( + userStates, + userId, + { student_number: studentNumber }, + "学科を以下から教えてください: CS, BI, IA, OTHERS", + reply, + ); } async function validateAndSetDepartment( - message: Message, - userInfo: AuthData, - userStates: Map, - userId: string, - reply: (message: string) => Promise, + message: Message, + userInfo: AuthData, + userStates: Map, + userId: string, + reply: (message: string) => Promise, ) { - const departmentInput = message.content.toUpperCase(); - if (departmentInput in Department) { - await setUserInfoAndReply( - userStates, - userId, - { department: Department[departmentInput as keyof typeof Department] }, - "メールアドレスを教えてください", - reply, - ); - } else { - await reply( - "形式が正しくありません。学科を以下から教えてください: CS, BI, IA, GRADUATE, OTHERS", - ); - } + const departmentInput = message.content.toUpperCase(); + if (departmentInput in Department) { + await setUserInfoAndReply( + userStates, + userId, + { department: Department[departmentInput as keyof typeof Department] }, + "メールアドレスを教えてください", + reply, + ); + } else { + await reply( + "形式が正しくありません。学科を以下から教えてください: CS, BI, IA, GRADUATE, OTHERS", + ); + } } async function validateAndRegisterUser( - message: Message, - userInfo: AuthData, - userStates: Map, - userId: string, - reply: (message: string) => Promise, + message: Message, + userInfo: AuthData, + userStates: Map, + userId: string, + reply: (message: string) => Promise, ) { - const mail = message.content; - if (mail.endsWith("@shizuoka.ac.jp")) { - const updatedUserInfo = { ...userInfo, mail }; - if (await authMember(updatedUserInfo)) { - try { - updatedUserInfo.discordId = message.author.id; - await sendAuthMailController(updatedUserInfo); - } catch (e) { - await reply("認証に失敗しました。もう一度やり直してください"); - await reply("名前(フルネーム)を教えてください"); - userStates.set(userId, clearAuthData()); - return; - } - await reply( - "認証メールを送信しました。静大メールから認証を行い、Discordサーバーで`/auth`コマンドを実行してください", - ); - } else { - await reply("認証に失敗しました。もう一度やり直してください"); - await reply("名前(フルネーム)を教えてください"); - userStates.set(userId, clearAuthData()); - } - userStates.delete(userId); // 登録後は状態をクリア - } else { - await reply("メールアドレスの形式が正しくありません。もう一度お願いします"); - } + const mail = message.content; + if (mail.endsWith("@shizuoka.ac.jp")) { + const updatedUserInfo = { ...userInfo, mail }; + if (await authMember(updatedUserInfo)) { + try { + updatedUserInfo.discordId = message.author.id; + await sendAuthMailController(updatedUserInfo); + } catch (e) { + await reply("認証に失敗しました。もう一度やり直してください"); + await reply("名前(フルネーム)を教えてください"); + userStates.set(userId, clearAuthData()); + return; + } + await reply( + "認証メールを送信しました。静大メールから認証を行い、Discordサーバーで`/auth`コマンドを実行してください", + ); + } else { + await reply("認証に失敗しました。もう一度やり直してください"); + await reply("名前(フルネーム)を教えてください"); + userStates.set(userId, clearAuthData()); + } + userStates.delete(userId); // 登録後は状態をクリア + } else { + await reply("メールアドレスの形式が正しくありません。もう一度お願いします"); + } } diff --git a/src/infra/firebase.ts b/src/infra/firebase.ts index 80f6193..75ea3a7 100644 --- a/src/infra/firebase.ts +++ b/src/infra/firebase.ts @@ -6,21 +6,21 @@ import { getAuth } from "firebase/auth"; import serviceAccount from "../../its-discord-auth-firebase-adminsdk-wn2uo-ac781d8325.json"; admin.initializeApp({ - credential: admin.credential.cert(serviceAccount as admin.ServiceAccount), + credential: admin.credential.cert(serviceAccount as admin.ServiceAccount), }); dotenv.config(); // 環境変数をロード const firebaseConfig = { - apiKey: process.env.FIREBASE_API_KEY, - authDomain: process.env.FIREBASE_AUTH_DOMAIN, - databaseURL: process.env.FIREBASE_DATABASE_URL, - projectId: process.env.FIREBASE_PROJECT_ID, - storageBucket: process.env.FIREBASE_STORAGE_BUCKET, - messagingSenderId: process.env.FIREBASE_MESSAGING_SENDER_ID, - messageSenderId: process.env.FIREBASE_MESSAGE_SENDER_ID, - appId: process.env.FIREBASE_APP_ID, - measurementId: process.env.FIREBASE_MEASUREMENT_ID, + apiKey: process.env.FIREBASE_API_KEY, + authDomain: process.env.FIREBASE_AUTH_DOMAIN, + databaseURL: process.env.FIREBASE_DATABASE_URL, + projectId: process.env.FIREBASE_PROJECT_ID, + storageBucket: process.env.FIREBASE_STORAGE_BUCKET, + messagingSenderId: process.env.FIREBASE_MESSAGING_SENDER_ID, + messageSenderId: process.env.FIREBASE_MESSAGE_SENDER_ID, + appId: process.env.FIREBASE_APP_ID, + measurementId: process.env.FIREBASE_MEASUREMENT_ID, }; const app: FirebaseApp = initializeApp(firebaseConfig); diff --git a/src/loadCommands.ts b/src/loadCommands.ts index 93ad620..dae3534 100644 --- a/src/loadCommands.ts +++ b/src/loadCommands.ts @@ -3,19 +3,19 @@ import path from "node:path"; import type { CustomClient } from "./types/customClient"; export async function loadCommands(client: CustomClient) { - const commandsFoldersPath = path.resolve("src", "commands"); - const commandFiles = await fs.readdir(commandsFoldersPath); - const tsCommandFiles = commandFiles.filter((file) => file.endsWith(".ts")); - for (const file of tsCommandFiles) { - const filePath = path.join(commandsFoldersPath, file); - const { default: command } = await import(filePath); - if (command.data && command.execute) { - client.commands.set(command.data.name, command); - console.log(`[INFO] Loaded command: ${command.data.name}`); - } else { - console.log( - `[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`, - ); - } - } + const commandsFoldersPath = path.resolve("src", "commands"); + const commandFiles = await fs.readdir(commandsFoldersPath); + const tsCommandFiles = commandFiles.filter((file) => file.endsWith(".ts")); + for (const file of tsCommandFiles) { + const filePath = path.join(commandsFoldersPath, file); + const { default: command } = await import(filePath); + if (command.data && command.execute) { + client.commands.set(command.data.name, command); + console.log(`[INFO] Loaded command: ${command.data.name}`); + } else { + console.log( + `[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`, + ); + } + } } diff --git a/src/main.ts b/src/main.ts index ca5dc8d..cddc6e1 100644 --- a/src/main.ts +++ b/src/main.ts @@ -14,17 +14,17 @@ const horChannelId = process.env.HOT_CHANNEL_ID; const postHotChannelTime = process.env.POST_HOT_CHANNEL_TIME; async function main() { - if (!token || !horChannelId || !postHotChannelTime) { - console.error("Missing environment variables."); - process.exit(1); - } + if (!token || !horChannelId || !postHotChannelTime) { + console.error("Missing environment variables."); + process.exit(1); + } - await loadCommands(client); - setupEventHandlers(client, userStates); - scheduleHotChannels(client, horChannelId, postHotChannelTime); + await loadCommands(client); + setupEventHandlers(client, userStates); + scheduleHotChannels(client, horChannelId, postHotChannelTime); - await client.login(token); - console.log("Bot is running..."); + await client.login(token); + console.log("Bot is running..."); } main().catch(console.error); diff --git a/src/roles/administrator.ts b/src/roles/administrator.ts index 8432924..14b30cf 100644 --- a/src/roles/administrator.ts +++ b/src/roles/administrator.ts @@ -1,9 +1,9 @@ import type CustomRole from "../types/customRole"; const administratorRoleProperty: CustomRole = { - roleName: "Administrator", - color: "Red", - reason: "Role for administrators.", + roleName: "Administrator", + color: "Red", + reason: "Role for administrators.", }; export default administratorRoleProperty; diff --git a/src/roles/authorized.ts b/src/roles/authorized.ts index 92388dc..c6ba297 100644 --- a/src/roles/authorized.ts +++ b/src/roles/authorized.ts @@ -1,9 +1,9 @@ import type CustomRole from "../types/customRole"; const authorizedRoleProperty: CustomRole = { - roleName: "Authorized", - color: "Green", - reason: "Member role for authenticated members.", + roleName: "Authorized", + color: "Green", + reason: "Member role for authenticated members.", }; export default authorizedRoleProperty; diff --git a/src/roles/departments/bi.ts b/src/roles/departments/bi.ts index 2a11ca9..b0b337f 100644 --- a/src/roles/departments/bi.ts +++ b/src/roles/departments/bi.ts @@ -2,8 +2,8 @@ import type CustomRole from "../../types/customRole"; import makeDepartmentRole from "../../utils/makeDepartmentRole"; const biRole: CustomRole = makeDepartmentRole({ - department: "BI", - color: [0, 112, 255], - reason: "BI Department Role", + department: "BI", + color: [0, 112, 255], + reason: "BI Department Role", }); export default biRole; diff --git a/src/roles/departments/cs.ts b/src/roles/departments/cs.ts index 49a48f8..6c602d6 100644 --- a/src/roles/departments/cs.ts +++ b/src/roles/departments/cs.ts @@ -2,8 +2,8 @@ import type CustomRole from "../../types/customRole"; import makeDepartmentRole from "../../utils/makeDepartmentRole"; const csRole: CustomRole = makeDepartmentRole({ - department: "CS", - color: "Orange", - reason: "CS Department Role", + department: "CS", + color: "Orange", + reason: "CS Department Role", }); export default csRole; diff --git a/src/roles/departments/graduate.ts b/src/roles/departments/graduate.ts index c275cc9..d1ad01a 100644 --- a/src/roles/departments/graduate.ts +++ b/src/roles/departments/graduate.ts @@ -2,8 +2,8 @@ import type CustomRole from "../../types/customRole"; import makeDepartmentRole from "../../utils/makeDepartmentRole"; const graduateRole: CustomRole = makeDepartmentRole({ - department: "GRADUATE", - color: [255, 215, 0], - reason: "Graduate student Role", + department: "GRADUATE", + color: [255, 215, 0], + reason: "Graduate student Role", }); export default graduateRole; diff --git a/src/roles/departments/ia.ts b/src/roles/departments/ia.ts index ab3109c..4fbadc5 100644 --- a/src/roles/departments/ia.ts +++ b/src/roles/departments/ia.ts @@ -2,8 +2,8 @@ import type CustomRole from "../../types/customRole"; import makeDepartmentRole from "../../utils/makeDepartmentRole"; const iaRole: CustomRole = makeDepartmentRole({ - department: "IA", - color: [0, 128, 0], - reason: "BI Department Role", + department: "IA", + color: [0, 128, 0], + reason: "BI Department Role", }); export default iaRole; diff --git a/src/roles/departments/obog.ts b/src/roles/departments/obog.ts index cf0030b..5eb264e 100644 --- a/src/roles/departments/obog.ts +++ b/src/roles/departments/obog.ts @@ -1,8 +1,8 @@ import makeDepartmentRole from "../../utils/makeDepartmentRole"; export const obOgRole = makeDepartmentRole({ - department: "OB/OG", - color: [0, 128, 128], - reason: "Role for OB/OG", + department: "OB/OG", + color: [0, 128, 128], + reason: "Role for OB/OG", }); export default obOgRole; diff --git a/src/roles/departments/others.ts b/src/roles/departments/others.ts index 0b1e241..ff69e46 100644 --- a/src/roles/departments/others.ts +++ b/src/roles/departments/others.ts @@ -2,8 +2,8 @@ import type CustomRole from "../../types/customRole"; import makeDepartmentRole from "../../utils/makeDepartmentRole"; const othersRole: CustomRole = makeDepartmentRole({ - department: "OTHERS", - color: [128, 0, 128], - reason: "Role for non informatics major students", + department: "OTHERS", + color: [128, 0, 128], + reason: "Role for non informatics major students", }); export default othersRole; diff --git a/src/roles/unAuthorized.ts b/src/roles/unAuthorized.ts index b24a785..9cefce8 100644 --- a/src/roles/unAuthorized.ts +++ b/src/roles/unAuthorized.ts @@ -1,9 +1,9 @@ import type CustomRole from "../types/customRole"; const unAuthorizedRoleProperty: CustomRole = { - roleName: "Unauthorized", - color: "Grey", - reason: "Unauthorized role for new members.", + roleName: "Unauthorized", + color: "Grey", + reason: "Unauthorized role for new members.", }; export default unAuthorizedRoleProperty; diff --git a/src/tasks/scheduleHotChannels.ts b/src/tasks/scheduleHotChannels.ts index 5f9bdca..6e1404e 100644 --- a/src/tasks/scheduleHotChannels.ts +++ b/src/tasks/scheduleHotChannels.ts @@ -4,37 +4,37 @@ import type { CustomClient } from "../types/customClient"; import { generateChannelActivityRanking } from "../usecases/getHotChannels"; export function scheduleHotChannels( - client: CustomClient, - channelId: string, - time: string, + client: CustomClient, + channelId: string, + time: string, ): void { - const job = new CronJob(time, async () => { - try { - console.log("[INFO] Posting hot channels cron job started"); - const guild = client.guilds.cache.first(); - if (guild) { - console.log("[INFO] Generating hot channels ranking"); - const ranking = await generateChannelActivityRanking(guild); - console.log("[INFO] Generated hot channels ranking"); - console.log("[INFO] Finding hot channels channel"); - const channel = guild.channels.cache.find( - (ch) => ch.id === channelId, - ) as TextChannel; - if (channel) { - console.log("[INFO] Found hot channels channel"); - await channel.send({ embeds: [ranking] }); - } else { - console.error("[ERROR] Hot channels channel not found"); - } - } else { - console.error("[ERROR] Guild not found"); - } - } catch (error) { - console.error( - "[ERROR] An error occurred in the hot channels cron job:", - error, - ); - } - }); - job.start(); + const job = new CronJob(time, async () => { + try { + console.log("[INFO] Posting hot channels cron job started"); + const guild = client.guilds.cache.first(); + if (guild) { + console.log("[INFO] Generating hot channels ranking"); + const ranking = await generateChannelActivityRanking(guild); + console.log("[INFO] Generated hot channels ranking"); + console.log("[INFO] Finding hot channels channel"); + const channel = guild.channels.cache.find( + (ch) => ch.id === channelId, + ) as TextChannel; + if (channel) { + console.log("[INFO] Found hot channels channel"); + await channel.send({ embeds: [ranking] }); + } else { + console.error("[ERROR] Hot channels channel not found"); + } + } else { + console.error("[ERROR] Guild not found"); + } + } catch (error) { + console.error( + "[ERROR] An error occurred in the hot channels cron job:", + error, + ); + } + }); + job.start(); } diff --git a/src/types/authData.ts b/src/types/authData.ts index bb12c3f..9894749 100644 --- a/src/types/authData.ts +++ b/src/types/authData.ts @@ -1,11 +1,11 @@ import type Department from "../entities/department"; interface AuthData { - name?: string; - student_number?: string; - department?: Department; - mail?: string; - discordId?: string; + name?: string; + student_number?: string; + department?: Department; + mail?: string; + discordId?: string; } export default AuthData; diff --git a/src/types/command.ts b/src/types/command.ts index 2a637d1..4a8938e 100644 --- a/src/types/command.ts +++ b/src/types/command.ts @@ -1,6 +1,6 @@ import type { CommandInteraction, SlashCommandBuilder } from "discord.js"; export interface Command { - data: SlashCommandBuilder; - execute: (interaction: CommandInteraction) => void; + data: SlashCommandBuilder; + execute: (interaction: CommandInteraction) => void; } diff --git a/src/types/commandWithArgs.ts b/src/types/commandWithArgs.ts index 8f59f82..912442f 100644 --- a/src/types/commandWithArgs.ts +++ b/src/types/commandWithArgs.ts @@ -1,13 +1,13 @@ import type { CommandInteraction, SlashCommandBuilder } from "discord.js"; type OmittedSlashCommandBuilder = Omit< - SlashCommandBuilder, - "addSubcommand" | "addSubcommandGroup" + SlashCommandBuilder, + "addSubcommand" | "addSubcommandGroup" >; interface CommandWithArgs { - data: OmittedSlashCommandBuilder; - execute: (interaction: CommandInteraction) => void; + data: OmittedSlashCommandBuilder; + execute: (interaction: CommandInteraction) => void; } export default CommandWithArgs; diff --git a/src/types/customClient.ts b/src/types/customClient.ts index 7c8db60..315f6ea 100644 --- a/src/types/customClient.ts +++ b/src/types/customClient.ts @@ -2,18 +2,18 @@ import { Client, Collection, GatewayIntentBits, Partials } from "discord.js"; import type { Command } from "./command"; export class CustomClient extends Client { - public commands: Collection; + public commands: Collection; - constructor() { - super({ - intents: [ - GatewayIntentBits.DirectMessages, - GatewayIntentBits.GuildMembers, - GatewayIntentBits.GuildMessages, - GatewayIntentBits.GuildInvites, - ], - partials: [Partials.Message, Partials.Channel], - }); - this.commands = new Collection(); - } + constructor() { + super({ + intents: [ + GatewayIntentBits.DirectMessages, + GatewayIntentBits.GuildMembers, + GatewayIntentBits.GuildMessages, + GatewayIntentBits.GuildInvites, + ], + partials: [Partials.Message, Partials.Channel], + }); + this.commands = new Collection(); + } } diff --git a/src/types/customRole.ts b/src/types/customRole.ts index 4c58b18..2aafcfb 100644 --- a/src/types/customRole.ts +++ b/src/types/customRole.ts @@ -1,9 +1,9 @@ import type { ColorResolvable } from "discord.js"; interface CustomRole { - roleName: string; - color: ColorResolvable; - reason: string; + roleName: string; + color: ColorResolvable; + reason: string; } export default CustomRole; diff --git a/src/usecases/getHotChannels.ts b/src/usecases/getHotChannels.ts index e44c067..e592a46 100644 --- a/src/usecases/getHotChannels.ts +++ b/src/usecases/getHotChannels.ts @@ -1,86 +1,86 @@ import { - type APIEmbedField, - ChannelType, - EmbedBuilder, - type Guild, - SnowflakeUtil, - type TextChannel, + type APIEmbedField, + ChannelType, + EmbedBuilder, + type Guild, + SnowflakeUtil, + type TextChannel, } from "discord.js"; export async function generateChannelActivityRanking(guild: Guild) { - const now = new Date(); - const oneDayAgoSnowflake = SnowflakeUtil.generate({ - timestamp: now.getTime() - 24 * 60 * 60 * 1000, - }); + const now = new Date(); + const oneDayAgoSnowflake = SnowflakeUtil.generate({ + timestamp: now.getTime() - 24 * 60 * 60 * 1000, + }); - const channels = await guild.channels.fetch(); - const textChannels = channels.filter( - (channel): channel is TextChannel => - channel !== null && channel.type === ChannelType.GuildText, - ); + const channels = await guild.channels.fetch(); + const textChannels = channels.filter( + (channel): channel is TextChannel => + channel !== null && channel.type === ChannelType.GuildText, + ); - const channelStats = await Promise.all( - textChannels.map(async (channel) => { - try { - let totalMessages = 0; - let lastId: string | undefined; - while (true) { - const messages = await channel.messages.fetch({ - limit: 100, - after: lastId || oneDayAgoSnowflake.toString(), - }); - if (messages.size === 0) break; - totalMessages += messages.size; - lastId = messages.last()?.id; - const lastMessage = messages.last(); - if (lastMessage && lastMessage.createdTimestamp < oneDayAgoSnowflake) - break; - } - return { - id: channel.id, - name: channel.name, - count: totalMessages, - }; - } catch (error) { - console.error( - `Error fetching messages for channel ${channel.name}:`, - error, - ); - return { - id: channel.id, - name: channel.name, - count: 0, - }; - } - }), - ); + const channelStats = await Promise.all( + textChannels.map(async (channel) => { + try { + let totalMessages = 0; + let lastId: string | undefined; + while (true) { + const messages = await channel.messages.fetch({ + limit: 100, + after: lastId || oneDayAgoSnowflake.toString(), + }); + if (messages.size === 0) break; + totalMessages += messages.size; + lastId = messages.last()?.id; + const lastMessage = messages.last(); + if (lastMessage && lastMessage.createdTimestamp < oneDayAgoSnowflake) + break; + } + return { + id: channel.id, + name: channel.name, + count: totalMessages, + }; + } catch (error) { + console.error( + `Error fetching messages for channel ${channel.name}:`, + error, + ); + return { + id: channel.id, + name: channel.name, + count: 0, + }; + } + }), + ); - const targetChannels = channelStats.filter((channel) => channel.count > 0); - const sortedStats = targetChannels - .sort((a, b) => b.count - a.count) - .slice(0, 20); - const totalMessages = sortedStats.reduce( - (sum, channel) => sum + channel.count, - 0, - ); + const targetChannels = channelStats.filter((channel) => channel.count > 0); + const sortedStats = targetChannels + .sort((a, b) => b.count - a.count) + .slice(0, 20); + const totalMessages = sortedStats.reduce( + (sum, channel) => sum + channel.count, + 0, + ); - const embed = new EmbedBuilder() - .setColor(0x0099ff) - .setTitle("Hot Channels Bot") - .setDescription(`${now.toISOString().split("T")[0]} の発言数ランキング`) - .setFooter({ text: `合計発言数: ${totalMessages}` }); + const embed = new EmbedBuilder() + .setColor(0x0099ff) + .setTitle("Hot Channels Bot") + .setDescription(`${now.toISOString().split("T")[0]} の発言数ランキング`) + .setFooter({ text: `合計発言数: ${totalMessages}` }); - const fields: APIEmbedField | APIEmbedField[] = []; - sortedStats.forEach((channel, index) => { - const percentage = ((channel.count / totalMessages) * 100).toFixed(1); - fields.push({ - name: `${index + 1}. https://discord.com/channels/${guild.id}/${channel.id}`, - value: `発言数: ${channel.count} (${percentage}%)`, - inline: false, - }); - }); + const fields: APIEmbedField | APIEmbedField[] = []; + sortedStats.forEach((channel, index) => { + const percentage = ((channel.count / totalMessages) * 100).toFixed(1); + fields.push({ + name: `${index + 1}. https://discord.com/channels/${guild.id}/${channel.id}`, + value: `発言数: ${channel.count} (${percentage}%)`, + inline: false, + }); + }); - embed.addFields(fields); + embed.addFields(fields); - return embed; + return embed; } diff --git a/src/usecases/getMembers.ts b/src/usecases/getMembers.ts index ce71efb..e235859 100644 --- a/src/usecases/getMembers.ts +++ b/src/usecases/getMembers.ts @@ -2,25 +2,25 @@ import type Member from "../entities/member"; import { db } from "../infra/firebase"; async function getMembers(): Promise { - const snapshot = await db.collection("members").get(); - const members: Member[] = snapshot.docs.map((doc) => - convertToMember({ - id: doc.id, - ...doc.data(), - }), - ); - return members; + const snapshot = await db.collection("members").get(); + const members: Member[] = snapshot.docs.map((doc) => + convertToMember({ + id: doc.id, + ...doc.data(), + }), + ); + return members; } function convertToMember(docData: FirebaseFirestore.DocumentData): Member { - return { - id: docData.id, - name: docData.name, - student_number: docData.student_number, - department: docData.department, - mail: docData.mail, - discordId: docData.discordId, - }; + return { + id: docData.id, + name: docData.name, + student_number: docData.student_number, + department: docData.department, + mail: docData.mail, + discordId: docData.discordId, + }; } export default getMembers; diff --git a/src/usecases/insertMember.ts b/src/usecases/insertMember.ts index f7a2036..2f12242 100644 --- a/src/usecases/insertMember.ts +++ b/src/usecases/insertMember.ts @@ -3,15 +3,15 @@ import type Member from "../entities/member"; import { db } from "../infra/firebase"; async function insertMember(member: Member) { - const uniqueId = uuidv4(); - const docRef = await db.collection("members").doc(uniqueId); - await docRef.set({ - name: member.name, - student_number: member.student_number, - department: member.department, - mail: member.mail, - }); - console.log("Document written with ID: ", docRef.id); + const uniqueId = uuidv4(); + const docRef = await db.collection("members").doc(uniqueId); + await docRef.set({ + name: member.name, + student_number: member.student_number, + department: member.department, + mail: member.mail, + }); + console.log("Document written with ID: ", docRef.id); } export default insertMember; diff --git a/src/usecases/sendAuthMail.ts b/src/usecases/sendAuthMail.ts index 303d09d..7feb9f1 100644 --- a/src/usecases/sendAuthMail.ts +++ b/src/usecases/sendAuthMail.ts @@ -1,37 +1,37 @@ import { - type ActionCodeSettings, - type UserCredential, - createUserWithEmailAndPassword, - sendEmailVerification, + type ActionCodeSettings, + type UserCredential, + createUserWithEmailAndPassword, + sendEmailVerification, } from "firebase/auth"; import { auth } from "../infra/firebase"; async function sendAuthMail( - mail: string, - student_number: string, - department: string, + mail: string, + student_number: string, + department: string, ) { - const actionCodeSettings: ActionCodeSettings = { - url: "https://discord.com/channels/1224047445714010143/1224047445714010146", - handleCodeInApp: true, - }; + const actionCodeSettings: ActionCodeSettings = { + url: "https://discord.com/channels/1224047445714010143/1224047445714010146", + handleCodeInApp: true, + }; - try { - const userCredential: UserCredential = await createUserWithEmailAndPassword( - auth, - mail, - student_number + department, - ); + try { + const userCredential: UserCredential = await createUserWithEmailAndPassword( + auth, + mail, + student_number + department, + ); - if (userCredential.user) { - await sendEmailVerification(userCredential.user, actionCodeSettings); - console.log(`Send mail to ${mail} successfully`); - } else { - console.error("User object is null after creation"); - } - } catch (e) { - console.error(e); - } + if (userCredential.user) { + await sendEmailVerification(userCredential.user, actionCodeSettings); + console.log(`Send mail to ${mail} successfully`); + } else { + console.error("User object is null after creation"); + } + } catch (e) { + console.error(e); + } } export default sendAuthMail; diff --git a/src/usecases/setDiscordId.ts b/src/usecases/setDiscordId.ts index d2a941c..ec87ddc 100644 --- a/src/usecases/setDiscordId.ts +++ b/src/usecases/setDiscordId.ts @@ -1,10 +1,10 @@ import { db } from "../infra/firebase"; async function setDiscordId(memberId: string, discordId: string) { - const docRef = db.collection("members").doc(memberId); - await docRef.update({ - discordId: discordId, - }); + const docRef = db.collection("members").doc(memberId); + await docRef.update({ + discordId: discordId, + }); } export default setDiscordId; diff --git a/src/utils/addRoleToMember.ts b/src/utils/addRoleToMember.ts index 816ca6b..0663364 100644 --- a/src/utils/addRoleToMember.ts +++ b/src/utils/addRoleToMember.ts @@ -3,16 +3,16 @@ import type CustomRole from "../types/customRole"; import createRoleIfNotFound from "./createRoleNotFound"; async function addRoleToMember( - guild: Guild, - member: GuildMember, - customRole: CustomRole, + guild: Guild, + member: GuildMember, + customRole: CustomRole, ) { - try { - const role = await createRoleIfNotFound({ guild, customRole: customRole }); - await member.roles.add(role); - } catch (error) { - console.error("Failed to add role to member"); - } + try { + const role = await createRoleIfNotFound({ guild, customRole: customRole }); + await member.roles.add(role); + } catch (error) { + console.error("Failed to add role to member"); + } } export default addRoleToMember; diff --git a/src/utils/authMember.ts b/src/utils/authMember.ts index a1a58b9..9c8a141 100644 --- a/src/utils/authMember.ts +++ b/src/utils/authMember.ts @@ -3,18 +3,18 @@ import type AuthData from "../types/authData"; import getMembers from "../usecases/getMembers"; async function authMember(authData: AuthData): Promise { - const members: Member[] = await getMembers(); - //membersの中からauthDataと一致するものがあるかどうかを確認する - const authMember: Member | undefined = members.find((member) => { - return ( - member.student_number === authData.student_number && - member.mail === authData.mail && - member.department === authData.department && - member.name === authData.name - ); - }); + const members: Member[] = await getMembers(); + //membersの中からauthDataと一致するものがあるかどうかを確認する + const authMember: Member | undefined = members.find((member) => { + return ( + member.student_number === authData.student_number && + member.mail === authData.mail && + member.department === authData.department && + member.name === authData.name + ); + }); - return !!authMember; + return !!authMember; } export default authMember; diff --git a/src/utils/checkMemberRole.ts b/src/utils/checkMemberRole.ts index 39e2b6b..9847bc7 100644 --- a/src/utils/checkMemberRole.ts +++ b/src/utils/checkMemberRole.ts @@ -2,16 +2,16 @@ import type { CommandInteraction } from "discord.js"; import administratorRoleProperty from "../roles/administrator"; async function checkIsAdmin(interaction: CommandInteraction): Promise { - const guild = interaction.guild; - if (!guild) { - return false; - } + const guild = interaction.guild; + if (!guild) { + return false; + } - const member = await guild.members.fetch(interaction.user.id); - const isAdmin: boolean = member.roles.cache.some( - (role) => role.name === administratorRoleProperty.roleName, - ); - return isAdmin; + const member = await guild.members.fetch(interaction.user.id); + const isAdmin: boolean = member.roles.cache.some( + (role) => role.name === administratorRoleProperty.roleName, + ); + return isAdmin; } export default checkIsAdmin; diff --git a/src/utils/clearAuthData.ts b/src/utils/clearAuthData.ts index e40bf8b..8ea10ba 100644 --- a/src/utils/clearAuthData.ts +++ b/src/utils/clearAuthData.ts @@ -1,13 +1,13 @@ import type AuthData from "../types/authData"; function clearAuthData(): AuthData { - return { - name: undefined, - student_number: undefined, - department: undefined, - mail: undefined, - discordId: undefined, - }; + return { + name: undefined, + student_number: undefined, + department: undefined, + mail: undefined, + discordId: undefined, + }; } export default clearAuthData; diff --git a/src/utils/createRoleNotFound.ts b/src/utils/createRoleNotFound.ts index beed863..0589f50 100644 --- a/src/utils/createRoleNotFound.ts +++ b/src/utils/createRoleNotFound.ts @@ -2,32 +2,32 @@ import type { Guild, Role } from "discord.js"; import type CustomRole from "../types/customRole"; type createRoleNotFoundParams = { - guild: Guild; - customRole: CustomRole; + guild: Guild; + customRole: CustomRole; }; async function createRoleIfNotFound({ - guild, - customRole, + guild, + customRole, }: createRoleNotFoundParams): Promise { - const roles = await guild.roles.fetch(); - let role: Role | undefined = roles.find( - (r) => r.name === customRole.roleName, - ); - if (!role) { - try { - role = await guild.roles.create({ - name: customRole.roleName, - color: customRole.color, - reason: customRole.reason, - }); - console.log(`${customRole.roleName} role created.`); - } catch (error) { - console.error(`Error creating ${customRole.roleName} role:`, error); - throw error; - } - } - return role; + const roles = await guild.roles.fetch(); + let role: Role | undefined = roles.find( + (r) => r.name === customRole.roleName, + ); + if (!role) { + try { + role = await guild.roles.create({ + name: customRole.roleName, + color: customRole.color, + reason: customRole.reason, + }); + console.log(`${customRole.roleName} role created.`); + } catch (error) { + console.error(`Error creating ${customRole.roleName} role:`, error); + throw error; + } + } + return role; } export default createRoleIfNotFound; diff --git a/src/utils/initializeRoles.ts b/src/utils/initializeRoles.ts index dd3d846..f37f60b 100644 --- a/src/utils/initializeRoles.ts +++ b/src/utils/initializeRoles.ts @@ -5,34 +5,34 @@ import type CustomRole from "../types/customRole"; import createRoleIfNotFound from "./createRoleNotFound"; async function readRolesFromDirectory(directoryPath: string, guild: Guild) { - const files = readdirSync(directoryPath); - for (const file of files) { - const fullPath = join(directoryPath, file); - if (statSync(fullPath).isDirectory()) { - await readRolesFromDirectory(fullPath, guild); - } else if (fullPath.endsWith("ts")) { - try { - const module = await import(fullPath); - const roleConfig = module.default || module; - if (roleConfig?.roleName && roleConfig.color && roleConfig.reason) { - await initializeRole(roleConfig, guild); - } else { - console.error(`Failed to load a valid role config from ${fullPath}`); - } - } catch (error) { - console.error(`Error importing file ${fullPath}: ${error}`); - } - } - } + const files = readdirSync(directoryPath); + for (const file of files) { + const fullPath = join(directoryPath, file); + if (statSync(fullPath).isDirectory()) { + await readRolesFromDirectory(fullPath, guild); + } else if (fullPath.endsWith("ts")) { + try { + const module = await import(fullPath); + const roleConfig = module.default || module; + if (roleConfig?.roleName && roleConfig.color && roleConfig.reason) { + await initializeRole(roleConfig, guild); + } else { + console.error(`Failed to load a valid role config from ${fullPath}`); + } + } catch (error) { + console.error(`Error importing file ${fullPath}: ${error}`); + } + } + } } async function initializeRole(roleConfig: CustomRole, guild: Guild) { - await createRoleIfNotFound({ guild, customRole: roleConfig }); + await createRoleIfNotFound({ guild, customRole: roleConfig }); } async function initializeRoles(guild: Guild) { - const rolesDirectory = resolve(__dirname, "../roles"); - await readRolesFromDirectory(rolesDirectory, guild); + const rolesDirectory = resolve(__dirname, "../roles"); + await readRolesFromDirectory(rolesDirectory, guild); } export default initializeRoles; diff --git a/src/utils/makeDepartmentRole.ts b/src/utils/makeDepartmentRole.ts index da4d78f..bfa2ccd 100644 --- a/src/utils/makeDepartmentRole.ts +++ b/src/utils/makeDepartmentRole.ts @@ -2,23 +2,23 @@ import type { ColorResolvable } from "discord.js"; import type CustomRole from "../types/customRole"; interface makeDepartmentRoleProps { - department: string; - color: ColorResolvable; - reason?: string; + department: string; + color: ColorResolvable; + reason?: string; } function makeDepartmentRole({ - department, - color, - reason, + department, + color, + reason, }: makeDepartmentRoleProps): CustomRole { - const role: CustomRole = { - roleName: `DP:${department}`, - color: color, - reason: reason ? reason : `${department}Department Role`, - }; + const role: CustomRole = { + roleName: `DP:${department}`, + color: color, + reason: reason ? reason : `${department}Department Role`, + }; - return role; + return role; } export default makeDepartmentRole; diff --git a/tsconfig.json b/tsconfig.json index 92b0647..e548276 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,109 +1,109 @@ { - "compilerOptions": { - "target": "es6", - "module": "commonjs", - "resolveJsonModule": true, - "esModuleInterop": true, - /* Visit https://aka.ms/tsconfig to read more about this file */ - /* Projects */ - // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ - // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ - // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ - // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ - // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ - // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + "compilerOptions": { + "target": "es6", + "module": "commonjs", + "resolveJsonModule": true, + "esModuleInterop": true, + /* Visit https://aka.ms/tsconfig to read more about this file */ + /* Projects */ + // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ - /* Language and Environment */ - // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ - // "jsx": "preserve", /* Specify what JSX code is generated. */ - // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ - // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ - // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ - // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ - // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ - // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ - // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ - // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ - // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + /* Language and Environment */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "preserve", /* Specify what JSX code is generated. */ + // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ - /* Modules */ - // "rootDir": "./", /* Specify the root folder within your source files. */ - // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ - // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ - // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ - // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ - // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ - // "types": [], /* Specify type package names to be included without being referenced in a source file. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ - // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ - // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ - // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ - // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ - // "resolveJsonModule": true, /* Enable importing .json files. */ - // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ - // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + /* Modules */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ + // "types": [], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ + // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ + // "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ - /* JavaScript Support */ - // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ - // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ - // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + /* JavaScript Support */ + // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ - /* Emit */ - // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ - // "declarationMap": true, /* Create sourcemaps for d.ts files. */ - // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ - // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ - // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ - // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ - "outDir": "./build" /* Specify an output folder for all emitted files. */, - // "removeComments": true, /* Disable emitting comments. */ - // "noEmit": true, /* Disable emitting files from a compilation. */ - // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ - // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ - // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ - // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ - // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ - // "newLine": "crlf", /* Set the newline character for emitting files. */ - // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ - // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ - // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ - // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ - // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ - // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + /* Emit */ + // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + "outDir": "./build" /* Specify an output folder for all emitted files. */, + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ - /* Interop Constraints */ - // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ - // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ - // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ - // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ - "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, - /* Type Checking */ - "strict": true /* Enable all strict type-checking options. */, - // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ - // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ - // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ - // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ - // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ - // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ - // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ - // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ - // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ - // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ - // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ - // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ - // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ - // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ - // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ - // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ - // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + /* Type Checking */ + "strict": true /* Enable all strict type-checking options. */, + // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ - /* Completeness */ - // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ - "skipLibCheck": true /* Skip type checking all .d.ts files. */ - } + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + } } From 79c2623213031721ce54a142e10faafc26285ace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=8B=E3=82=8F=E3=81=8D=E3=82=93?= Date: Wed, 2 Oct 2024 12:52:19 +0900 Subject: [PATCH 11/12] mv github dir to .github --- {github => .github}/workflows/code_queality.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {github => .github}/workflows/code_queality.yaml (100%) diff --git a/github/workflows/code_queality.yaml b/.github/workflows/code_queality.yaml similarity index 100% rename from github/workflows/code_queality.yaml rename to .github/workflows/code_queality.yaml From 392130c94f471c2420520b0f83beb0dc40503b9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=8B=E3=82=8F=E3=81=8D=E3=82=93?= Date: Wed, 2 Oct 2024 12:53:13 +0900 Subject: [PATCH 12/12] Refactor GitHub workflows to improve code quality --- .github/workflows/code_queality.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/code_queality.yaml b/.github/workflows/code_queality.yaml index 461742b..a0b946f 100644 --- a/.github/workflows/code_queality.yaml +++ b/.github/workflows/code_queality.yaml @@ -1,7 +1,6 @@ name: Code quality on: - push: pull_request: jobs: