Coder Social home page Coder Social logo

mrrfv / discord-webhook-qotd-bot Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 0.0 40 KB

Discord bot that sends a "question of the day" every 24 hours

License: BSD 3-Clause "New" or "Revised" License

JavaScript 93.91% Dockerfile 6.09%
discord discord-bot discord-fun discord-webhook discord-webhooks fun games qotd question-of-the-day webhook

discord-webhook-qotd-bot's Introduction

Discord Question of the Day Bot

This is a Node.js application that utilizes a discord webhook to post a question of the day from a file to a Discord channel. It reads a JSON object containing an array of questions and posts one question according to your schedule.

Usage

  1. Include your own questions in questions.json. A format is included in questions.json.format.
  2. Run npm install to install dependencies.
  3. Copy .env.example to .env and fill in the values.
  4. Run node index.js.

Docker

You can also run this bot in a Docker container. To do so, use the following commands:

# Create progress.txt file
cat 0 > "$(pwd)"/progress.txt
# Make sure to also create the questions.json file in the same directory

# Run the image
docker run -d \ 
    -e WEBHOOK_URL="enter webhook url here" \ 
    -e CRON_SCHEDULE="enter cron schedule here" \ 
    -e OPTIONAL_MESSAGE_CONTENT="" \ 
    -e TZ="Europe/Berlin" \ 
    --mount type=bind,source="$(pwd)"/questions.json,target=/app/questions.json,readonly \ 
    --mount type=bind,source="$(pwd)"/progress.txt,target=/app/progress.txt \ 
    --restart always \ 
    --name qotdbot \ 
    mrrfv/discord-webhook-qotd-bot:latest

The command above expects that the progress.txt and questions.json files already exist, and that they are in the current directory. Change the value of the TZ environment variable for message scheduling to work properly.

License

BSD 3-Clause License. See LICENSE for more information.

discord-webhook-qotd-bot's People

Contributors

mrrfv avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

discord-webhook-qotd-bot's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

dockerfile
Dockerfile
  • node 20
github-actions
.github/workflows/docker-image.yml
  • actions/checkout v4
  • docker/login-action v3
  • docker/setup-qemu-action v3
  • docker/setup-buildx-action v3
  • docker/build-push-action v5
npm
package.json
  • dotenv ^16.0.3
  • node-fetch ^3.3.1
  • node-schedule ^2.1.1

  • Check this box to trigger a request for Renovate to run again on this repository

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.