diff --git a/src/matcher.ts b/src/matcher.ts index b370904..7d94b9a 100644 --- a/src/matcher.ts +++ b/src/matcher.ts @@ -310,22 +310,10 @@ export function createMatches( ): Participant[][] { const { temperature = 0.5, groupSize = 2 } = options; - // 엣지 케이스 - if (participants.length === 0) return []; - if (participants.length < groupSize) { - // groupSize 미만이면 매칭 불가, 단 2명 이상이면 한 그룹으로 - if (participants.length >= 2) return [participants]; - return []; - } - // 정확히 groupSize명이면 한 그룹 - if (participants.length === groupSize) return [participants]; - // groupSize+1명 이하로 두 그룹을 만들 수 없으면 전체 한 그룹 - if ( - participants.length < groupSize * 2 && - participants.length <= groupSize + groupSize - 1 - ) { - return [participants]; - } + // 2명 미만이면 매칭 불가 + if (participants.length < 2) return []; + // groupSize * 2 미만이면 한 그룹으로 + if (participants.length < groupSize * 2) return [participants]; const recentGroups = getRecentGroups(history); const stats = calculateExperienceStats(participants, history); diff --git a/worker/src/handlers.ts b/worker/src/handlers.ts index 77cbbcd..e023f39 100644 --- a/worker/src/handlers.ts +++ b/worker/src/handlers.ts @@ -6,14 +6,9 @@ import { MessageFlags, } from "discord-api-types/v10"; import rolesConfig from "../../data/roles.json"; +import type { RoleConfig } from "../../src/types.ts"; import { addRole, removeRole } from "./discord-api.ts"; -interface RoleConfig { - name: string; - displayName: string; - roleId: string; -} - interface Env { DISCORD_BOT_TOKEN: string; DISCORD_SERVER_ID: string;