A Discord bot that lets you play a voting-based game of Tetris in a Discord server. Inspired by @EmojiTetra on Twitter.
Built using Discord.NET and Redis.
The bot will post the game state as an embed, which includes things like the board, the next piece, and the score. This embed has multiple buttons on it, which you can click to vote on which action to do.
After the voting period has passed (5 minutes), the action with the most votes will be executed, and the next turn starts. Try to get the highest score with your friends before topping out!
-
Ensure you have .NET 6.0 installed. If not, you can download it here.
-
Clone the project locally using git.
-
Navigate to the inner
TetraCord
directory, the one that contains the.csproj
file. -
If you are using Visual Studio, you can use the NuGet Package Manager to install the required packages. Otherwise, run the following commands to install all of the required dependencies.
dotnet add package Discord.Net
dotnet add package Microsoft.Extensions.Configuration
dotnet add package Microsoft.Extensions.Configuration.Binder
dotnet add package Microsoft.Extensions.Configuration.Json
dotnet add package Microsoft.Extensions.DependencyInjection
dotnet add package Newtonsoft.Json
dotnet add package StackExchange.Redis
-
Run
dotnet build
to build the project. -
Copy
appsettings.json
to thebin
directory generated bydotnet build
. Paste your own Discord bot token into the file. -
Install Redis by running the following command in the terminal:
sudo apt-get install redis-server
. On Windows, you will have to use WSL2 for this. (You may also have to runsudo apt-get update
beforehand). -
Start the Redis server by running:
sudo service redis-server start
- Finally, run
dotnet run
in the directory where the.csproj
file is located.
-
Invite your instance of the bot to your Discord server.
-
Type
/setchannel
to specify the channel that will be used for the game. -
Type
/start
and the game will begin!