This commit is contained in:
dahyeon committed 2026-04-25 14:53:56 -07:00
1 parent d0ae8ffb0e
commit d1f7b0c916
6 files changed
+263 -12

No files matched your search

@@ -1,4 +1,8 @@
import { BadRequestException, Injectable, NotFoundException } from '@nestjs/common';
import {
BadRequestException,
Injectable,
NotFoundException,
} from '@nestjs/common';
import mongoose from 'mongoose';
import { MatchService } from '../../match/match.service';
import { Position, PositionPreference } from '../../global/database/schema';
@@ -24,7 +28,7 @@ export class MatchJoinHandler {
public async handle(params: JoinHandlerParams): Promise<DakaoSegment[]> {
if (!mongoose.isValidObjectId(params.matchId)) {
return this.errorReply(params, '유효하지 않은 매치 ID 입니다.');
return this.errorReply(params, '유효하지 않은 내전 ID 입니다.');
}
const matchObjectId = new mongoose.Types.ObjectId(params.matchId);
@@ -66,14 +70,14 @@ export class MatchJoinHandler {
kind: 'text',
text:
` 신청 완료 (${match.participants.length}/${match.maxParticipants})` +
`\n매치: ${match.title}` +
`\n내전: ${match.title}` +
`\n계정: ${resolved.riotAccount.gameName}#${resolved.riotAccount.tagLine}` +
`\n포지션: ${params.positions.join(', ')}`,
},
];
} catch (err) {
if (err instanceof NotFoundException) {
return this.errorReply(params, '매치를 찾을 수 없습니다.');
return this.errorReply(params, '내전을 찾을 수 없습니다.');
}
if (err instanceof BadRequestException) {
return this.errorReply(params, this.translateBadRequest(err.message));
@@ -113,10 +117,10 @@ export class MatchJoinHandler {
private translateBadRequest(raw: string): string {
if (raw.includes('different communities'))
return '이 매치는 현재 채팅방의 커뮤니티 소속이 아닙니다.';
if (raw.includes('not recruiting')) return '모집 중인 매치가 아닙니다.';
return '이 내전은 현재 채팅방의 커뮤니티 소속이 아닙니다.';
if (raw.includes('not recruiting')) return '모집 중인 내전이 아닙니다.';
if (raw.includes('full')) return '정원이 가득 찼습니다.';
if (raw.includes('already joined')) return '이미 신청한 매치입니다.';
if (raw.includes('already joined')) return '이미 신청한 내전입니다.';
return raw;
}
}
@@ -45,7 +45,7 @@ export class MatchListHandler {
},
{
kind: 'text',
text: ` 모집 중인 내전 ${matches.length}건${lines.join('')}\n신청: !내전 신청 <ID> <게임명>#<태그> <포지션1>,<포지션2>`,
text: ` 모집 중인 내전 ${matches.length}건${lines.join('')}\n신청: !내전 신청 <ID> <닉네임>#<태그> <포지션1>,<포지션2>`,
},
];
}