39bytes / TetraCord

Discord bot that allows users to play a game of Tetris in their servers. Inspired by EmojiTetra on Twitter.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TetraCord

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.

How it works

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.

Imgur

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!

Imgur

Installation and Setup

  1. Ensure you have .NET 6.0 installed. If not, you can download it here.

  2. Clone the project locally using git.

  3. Navigate to the inner TetraCord directory, the one that contains the .csproj file.

  4. 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
  1. Run dotnet build to build the project.

  2. Copy appsettings.json to the bin directory generated by dotnet build. Paste your own Discord bot token into the file.

  3. 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 run sudo apt-get update beforehand).

  4. Start the Redis server by running:

sudo service redis-server start
  1. Finally, run dotnet run in the directory where the .csproj file is located.

Using the bot

  1. Invite your instance of the bot to your Discord server.

  2. Type /setchannel to specify the channel that will be used for the game.

  3. Type /start and the game will begin!

About

Discord bot that allows users to play a game of Tetris in their servers. Inspired by EmojiTetra on Twitter.


Languages

Language:C# 100.0%