DEV Community

Cover image for Playing Cards Discord Bot
svntax
svntax

Posted on

Playing Cards Discord Bot

What I built

A Discord bot that lets users play with a standard 52-card deck of playing cards.

Category Submission:

Random Roulette

App Link

https://playing-cards-bot-rvpup.ondigitalocean.app/

Screenshots

Drawing cards and changing the art style

Drawing cards

Playing a game of High or Low

Game of High or Low

Description

This bot gives Discord servers a deck of playing cards that anyone in the server can use. You can draw cards, shuffle the deck, change the art style of the cards, and play a game of High or Low with others.

Link to Source Code

https://github.com/svntax/PlayingCardsBot

Permissive License

MIT

Background

I've been using Discord for 4 years now, and seeing all the different kinds of bots out there made me want to try making my own. I've also been interested in learning Go for a while now, so making a Discord bot with Go seemed like a great project idea for me to learn from, and this hackathon was a good opportunity to do so.

How I built it

The frontend is a simple, responsive landing page showing the bot's features and commands along with a button to add the bot to your own Discord servers. I used HTML and CSS only.

The backend consists of the bot itself and the standard Go packages for hosting card images and the frontend website. I used the DiscordGo package for the bot, which provides Go bindings for the Discord API.

Since this was my first time using Go but not my first time making an app, I mainly had to learn language-specific things, like how to set up a Go project, how to use the net/http package to serve files, and how to use goroutines to run multiple card games at a time. The DigitalOcean App Platform made the deployment process much easier for me because I didn't have to worry about building the app and figuring out how to run the build as a service on a Linux server.

Additional Resources/Info

The two card image sets used are CC0 licensed (public domain) and come from Kenney. You can find them here:

Top comments (2)

Collapse
 
crispy3ed profile image
Crispy3ed

I tried to add this bot to my discord server, but I get the message that the bot has not been verified and to ask the developer about dis.gd/bot-verification. Also, a little confused I came here for the card bot but the background talks about a Go bot.

Collapse
 
akaneko3 profile image
Jun Kudou

I deployed a git repository to DigitalOcean, but the bot is offline and I can't use it. Is there some setting I need?