GithubHelp home page GithubHelp logo

iscsc / iscsc.fr-blog-notify Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 1.0 35 KB

Simple Discord Bot to notify that a new article has been created on the club website

Python 51.85% Dockerfile 23.74% Shell 24.41%

iscsc.fr-blog-notify's Introduction

iscsc.fr-blog-notify

Bot to notify on Discord that a new article has been created on the club website.

How to

It's actually a flask app waiting for request and using a webhook to write on a Discord server.

and so it is quite different than the bot1.0 we had before! (which was a real discord bot, not a hook)

Config

see .env.example

In a .env file, specify your Discord webhook URL the bot needs to post notifications. You should also specify the port on which the flask app will listen.

Start the bot

DISCLAIMER: if you happen to run this bot in production, you're doing it at your own risk, without any warranty of security, isolation or behavior. Especially if you

Directly on host system (for development only!!)

To run it on the host system simply run python3 main.py (you'll need all the dependencies in requirements.txt)

⚠️ but you should really consider using the containerized deployment.
⚠️⚠️ this is exclusively for development, to run in production see the section below.

Containerized with Docker

Production mode

The bot can run in Docker thanks to the provided Dockerfile. To start the bot in Docker, you just have to run ./run.sh prod: the script cleans previous running containers, builds the current one and starts it.

Note: it's mandatory to use this ./run.sh prod in production because the default flask server isn't safe.
See Deploying in production.

Once the command is finished, simply run docker ps -a to check that the bot is indeed running and STATUS: Up, if you can't see a iscscfr-blog-bot:latest or the container is STATUS: Exited, check the logs with docker logs iscscfr-blog-bot.

Development and debug

Simply run ./run.sh (without prod) and you'll be in the docker environment.
Then just start the bot as you would do on the host: python3 main.py.

Note: you can also test the production server in this environment using gunicorn -w 1 -b 0.0.0.0:5000 --access-logfile=- main:app

iscsc.fr-blog-notify's People

Contributors

ctmbl avatar gbrivady avatar zynoxelek avatar

Watchers

 avatar Kostas Georgiou avatar Antoine Stevan avatar

Forkers

ctmbl

iscsc.fr-blog-notify's Issues

Add real logs

This bot needs logs when sending requests.
For instance, it would help us track when the bot goes wild for no reason.

bot2.0: Update README

the new bot is actually using a webhook which is quite different than the previous one, we shiuld update the readme accrodingly

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.