GithubHelp home page GithubHelp logo

greenfoot5 / thanks_bot_2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lenscas/thanks_bot_2

0.0 0.0 0.0 989 KB

License: MIT License

Shell 0.01% JavaScript 8.23% TypeScript 91.65% Dockerfile 0.11%

thanks_bot_2's Introduction

Thanks_bot 2

This is a simple discord bot to keep track of helpful people so mods can reward them. It also has a few moderator commands, basic scam protection and various other commands so that the members of the discord server can better help each other.

Dependencies

  • Node (v14.10.0)
  • Yarn (npm install yarn -g)
  • Postgresql

Setup docker

  1. Install docker and docker compose
  2. Copy database.example.json to database.json
  3. Copy postgres.example.json to postgres.json
  4. Copy config.example.json to config.json
  5. Put your own key into the config.json file (You can get a key for your bot at https://discord.com/developers/applications )
  6. Run docker-compose up and watch the magic happen as docker-compose pulls in everything needed and starts the bot.

To access the DB from the host and run yarn prepareSql, read How to access the DB from the host while using Docker

Setup locally

  1. Copy database.example.json to database.json
  2. Fill in the details to connect to your locally running database
  3. Copy postgres.example.json to postgres.json
  4. Fill here the database connection in again (I know, feels redundant)
  5. Copy config.example.json to config.json
  6. Put your own key into the config.json file (You can get a key for your bot at https://discord.com/developers/applications )
  7. Run yarn install
  8. Run yarn migrate up to run the migrations
  9. Run yarn start to start the bot. Or use yarn start:dev to also have it automatically restart when it detects changes.

Useful scripts

  1. lintFix uses eslint to fix most lint errors (PR's with lint errors won't get merged)
  2. unitTest runs the unit tests
  3. prepareSql reads the sql files and updates the generated types (use -w to run in watch mode)
  4. start:dev automatically compiles and restarts on changes
  5. build does a clean build
  6. start does a clean build, then starts the bot
  7. migrate to run db-migrate
  8. lint runs eslint and tells you what the problems are.
  9. test runs the linter and the unit tests

How to access the DB from the host while using Docker:

By default, the postgresql container has a port opened at 5433. The default username is thanks_bot_2, so is the database name and password.

The example configuration file postgres.example.json is setup to connect to the postgresql container from the host. This way, yarn prepareSql works out of the box with docker, provided the container is running. There is NO need to run this command from withing the container. ONLY run it from the host!

If you want to connect to the Database with dbeaver from the host then simply configure a new connection, select the postgresql driver and fill the details in as followed:

Host: localhost Port: 5433 Database: thanks_bot_2 Authentication: Database Native Username : thanks_bot_2 Password : thanks_bot_2

Session role and Local client can remain empty.

thanks_bot_2's People

Contributors

lenscas avatar dependabot[bot] avatar harshhhdev avatar greenfoot5 avatar megarev avatar kintrix007 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.