Giter Site home page Giter Site logo

c0d3r's Introduction

c0d3r : Discord bot for C0D3

This is the discord bot for c0d3, it performs discord related actions, like messaging in channels and direct messaging users for the c0d3 app.

This bot can be operated by an Api documented here.

Details about the bot's design and architecture are available in this design doc.

Running the bot

The production bot runs on the c0d3 CapRover server and can be communicated with the Api.

Development - Getting Started

* First you need to register a discord application to get the DISCORD_TOKEN that c0d3r will use to forward your commands to your discord server. A guide for that setup can be found on the wiki page here: Registering a Discord Bot

  • Using yarn

  1. Run yarn to install dependencies
  2. Copy and rename example.env to .env and fill the required variables.
  3. Run yarn start to start the bot.
  • Using Docker

  1. Run docker build -t c0d3r . to build the image
  2. Run docker run --env DISCORD_TOKEN=token --env BOT_TOKEN=token c0d3r to start a new container with the bot. The env variables are required.

Notes

  • The production DISCORD_TOKEN available to the engineering team should not be used for local development as the c0d3 discord server will end up receiving your test messages.
  • For testing your BOT_TOKEN can be any value as long as the application sending the api commands has the same Authorization header token set Bearer <BOT_TOKEN>

Confirm setup

You should be able to run this curl command to verify your c0d3r bot is running correctly

curl --location --request POST 'http://localhost:5623/api/messages/direct/<USER_ID>' \
--header 'Authorization: Bearer <BOT_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "message": "Good Job! You are ready to c0d3"
  }'

* replace <BOT_TOKEN> & <USER_ID> with their correct corresponding value.

(Enable developer mode in discord to get channelId's / userId's )

c0d3r's People

Contributors

jasirzaeem avatar flacial avatar tomrule007 avatar ggwadera avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.