Skip to content

Bravo Bot is a dynamic Discord bot powered by a REST API that celebrates user achievements by sending personalized congratulatory messages and celebratory GIFs whenever a sprint is completed.

License

Notifications You must be signed in to change notification settings

viliusddd/bravo-bot

Repository files navigation


Bravo! Bot 🎉

It's a dynamic Discord bot powered by a REST API that celebrates user achievements by sending personalized congratulatory messages and celebratory GIFs whenever a sprint is completed. It integrates with a database to fetch random messages and store metadata, ensuring a lively and engaging recognition system on any Discord server.

Features

  • Congratulate a user on a configured Discord server with the GIF and a message.
  • Fetch a random GIF of success from an external GIF.
  • Highlight mentioned username in Discord message.
  • DB is seeded with data.
  • Github Workflow for linting and testing.

Tech Stack

TypeScript SQLite Zod Express.js Kysely discord.js Vitest

TL;DR Setup

  1. Join test server https://discord.gg/vAxt2mvsNe
  2. Clone repo, setup and run app:
   git clone [email protected]:viliusddd/bravo-bot.git && \
   cd bravo-bot && \
   cp .env.example .env && \
   npm i && \
   npm run migrate:latest && \
   npm run dev

Important

It appears that discord know when token is exposed in public github repo and resets it, even if it's a throw-away token.

  1. Execute cUrl POST in cli (or any other cmd from Examples):
curl -sX POST http://localhost:3000/messages \
  -H 'Content-Type: application/json' \
  -d '{"username": "vjuodz", "sprintCode": "WD-1.3.4"}' | jq
  1. Voila! Check message at discord server.

Discord Setup

  1. Create a copy of .env.example and rename it to .env
  2. Fill-in DISCORD_SERVER_ID, DISCORD_CHANNEL_ID variables.
  3. Get giphy api key from here
  4. Create new Discord bot Application at https://discord.com/developers/applications
  5. On the left-side meniu go to Bot and:
    1. enable SERVER MEMBERS INTENT
    2. enable MESSAGE CONTENT INTENT
    3. press Reset Token, then add it to .env, DISCORD_TOKEN
  6. On the left-side menu, go to OAuth and, under OAuth2 URL Generator:
    1. choose bot
    2. choose applications.commands
    3. at the bottom, under GENERATED URL press copy (it should look similar to https://discord.com/oauth2/authorize?client_id=1267831555741581382&permissions=0&integration_type=0&scope=bot)
    4. paste copied url at you internet browser, choose channel you want your bot to reside.
  7. Paste yur app token to the .env and fill in the rest of the variables.

Examples

Messages

Post new message
curl -sX POST http://localhost:3000/messages \
  -H 'Content-Type: application/json' \
  -d '{"username": "vjuodz", "sprintCode": "WD-1.3.4"}' | jq
Get All messages
curl -s http://localhost:3000/messages | jq
Get particular message
curl -s http://localhost:3000/messages/1 | jq
Get messages by username
curl -s http://localhost:3000/messages?username=vjuodz | jq
Get messages by sprintCode
curl -s http://localhost:3000/messages?sprintCode=WD-1.2.5 | jq
Delete message
curl -sX DELETE http://localhost:3000/messages/1 | jq

CRUD Sprints (praises | templates | users | emojis)

Replace sprints with any of praises, templates, users, emojis

Get all sprints
curl -s http://localhost:3000/sprints | jq
Get single sprint
curl -s http://localhost:3000/sprints/1 | jq
Update sprint
curl -sX PATCH http://localhost:3000/sprints/1 \
  -H 'Content-Type: application/json' \
  -d '{"sprintCode": "WD-1.2.9", "sprintTitle": "Foo"}' | jq
Delete sprint
curl -sX DELETE http://localhost:3000/sprints/1 | jq

About

Bravo Bot is a dynamic Discord bot powered by a REST API that celebrates user achievements by sending personalized congratulatory messages and celebratory GIFs whenever a sprint is completed.

Resources

License

Stars

Watchers

Forks