Skip to content

New minigame Worldle #540

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/COMMAND-WIKI.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@
- ``bet``: How much to bet - default is 10.
- **Subcommands:** None

## worldle
- **Aliases:** `wl`, `country-guess`
- **Description:** Play Worldle - Guess the country
- **Examples:**<br>`.worldle`<br>`.worldle 100`<br>`.wl 50`
- **Options:**
- ``bet``: A valid bet amount
- **Subcommands:** None

# INTERVIEWER
## interviewers
- **Aliases:** `int`, `interviewer`
Expand Down
25 changes: 17 additions & 8 deletions src/commandDetails/games/blackjack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,17 +265,26 @@ const blackjackExecuteCommand: SapphireMessageExecuteType = async (
// Return next game state
await msg.edit({ embeds: [getEmbedFromGame(game!)] });
await reactCollector.update({ components: [optionRow] });
} catch {
// If player has not acted within time limit, consider it as quitting the game
game = performGameAction(author, BlackjackAction.QUIT);
msg.edit(
"You didn't act within the time limit. Unfortunately, this counts as a quit. Please start another game!",
);
if (game) {
game.stage = BlackjackStage.DONE;
} catch (error) {
if (error instanceof Error && error.message.includes('time')) {
// If player has not acted within time limit, consider it as quitting the game
game = performGameAction(author, BlackjackAction.QUIT);
await msg.edit(
"You didn't act within the time limit. Unfortunately, this counts as a quit. Please start another game!",
);
if (game) {
game.stage = BlackjackStage.DONE;
}
} else {
// Handling Unexpected Errors
await msg.edit('An unexpected error occured. The game has been aborted.');

closeGame(author, 0); // No change to balance
return 'An unexpected error occured. The game has been aborted.';
}
}
}

if (game) {
// Update game embed
await msg.edit({ embeds: [getEmbedFromGame(game)], components: [] });
Expand Down
Loading