Play Minesweeper from your Discord server!
First, create a new Discord bot profile and generate a token. Then, do as following:
# get the code
git clone https://github.com/ivaaane/minesweeper-bot.git
cd minesweeper-bot
# store token
touch src/.env
echo "DISCORD_TOKEN={insert_your_token}" > src/.env
# start bot
python src/main.py
The provided instructions will teach you how to interact with this bot. If you don't know how to play vanilla Minesweeper, I recommend this article.
-
Start a new game with the
/start
command. The GUI is composed of the board, displayed with emojis, the left tiles counter, the turn counter, and the name of the user. -
Reveal cells with
/r <row> <column>
. You'll need to provide the coordinates of your cell: they're displayed in the border of the board, the rows being represented with letters and columns with numbers. For example,/r a 0
will reveal the cell in the top left side. -
Your first reveal will always be in an empty cell for safety.
-
Same as
/r
, you can place flags with/f <row> <column>
. Tip: if a number cell has as many flags around its 8 touching cells as the number displays, you can reveal the number cell to automatically reveal the remaining cells. -
The game advances one turn after each action. If you win or lose, a notification will display.
-
You can always cancel your game with
/cancel
.
Use /help
to view the instructions from the server.
- Fork the repository and clone it.
git clone https://github.com/ivaaane/minesweeper-bot.git
- Install dependencies.
pip install -r requirements.txt
- Make a new branch and work on it.
git checkout -b new-feature
- Commit the changes.
git commit -m "Added the Thing."
- Push the branch.
git push origin new-feature
- Open a pull request.
Link | Contribution |
---|---|
Discord.py | Framework |
Create Your Own Discord Bot in Python 3.10 | Tutorial |
Robert Donner's original Minesweeper | Original game |