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