fix(fishing): avoid stale no-session response on session end
This commit is contained in:
parent
7022900eff
commit
55fc7b46fc
|
|
@ -203,6 +203,13 @@ export class FishingService {
|
|||
return;
|
||||
}
|
||||
|
||||
if (session.status === 'success' || session.status === 'failed') {
|
||||
await interaction.update({
|
||||
components: [this.buildControlRow(session.userId, true)],
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (interaction.user.id !== session.userId) {
|
||||
await interaction.reply({
|
||||
content: t(locale, 'commands.fishing.ownerOnly'),
|
||||
|
|
@ -368,8 +375,6 @@ export class FishingService {
|
|||
private static async finishSession(session: FishingSession, finalState: 'success' | 'failed', deleteThread: boolean) {
|
||||
session.status = finalState;
|
||||
this.clearTick(session);
|
||||
this.sessionsByUser.delete(this.getUserKey(session.guildId, session.userId));
|
||||
this.sessionsByThread.delete(session.threadId);
|
||||
|
||||
logger.info(`[Fishing] Finished session for ${session.userId} with state ${finalState}.`);
|
||||
|
||||
|
|
@ -377,6 +382,9 @@ export class FishingService {
|
|||
|
||||
await this.renderSession(session, true);
|
||||
|
||||
this.sessionsByUser.delete(this.getUserKey(session.guildId, session.userId));
|
||||
this.sessionsByThread.delete(session.threadId);
|
||||
|
||||
if (finalState === 'success') {
|
||||
await this.sendCatchResult(session);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue