Giter Site home page Giter Site logo

reminder-bot's Introduction

reminder-bot

Short little script to remind me on the first of every month to post in a channel. Uses crontab (0 0 1 * *) to call the script

Installing dependencies

The project dependencies are listed in a Pipfile. Use pipenv to trigger python virtual environment:

cd reminder-bot
pipenv install

Pipenv uses virtualenv to create a python environment with all the dependencies listed in the Pipfile. Before running the reminder.py script, you must first activate the environment:

pipenv shell

If you wish to deactivate the environment use the command

exit

Config file

A /config/config.json file need to be created in the same directory with reminderstat.py Below is an example of the config.json file.

{
	"token":"your-token",
	"channel":"your-channel-id",
	"message":"your-message"
}

Script arguments

The following arguments can be passed to the script

Short Long Type Description
-c --config string config file path, default is set to "./config/config.json"

Running the script using cron

We can use cron to automatically run the script periodically in order to keep it up-to-date. You will need either a macOS computer or Linux server to use cron.

  1. Set up config file with specified template in Config file section

  2. Run crontab -e to open the cron editor

  3. Use the following format to create a line for your cron

    * * * * * command to be executed
    - - - - -
    | | | | |
    | | | | ----- Day of week (0 - 7) (Sunday=0 or 7)
    | | | ------- Month (1 - 12)
    | | --------- Day of month (1 - 31)
    | ----------- Hour (0 - 23)
    ------------- Minute (0 - 59)
    

    For example, to run the script with default config file at 9 AM everyday, insert the following line

    0 9 * * * cd /home/tduong/remider-bot && /usr/local/bin/pipenv run python reminder.py
    

    Note: run which pipenv to identify your pipenv path. Mine is "/usr/local/bin/pipenv"

    To trigger the script with your-config.json at 9 AM everyday, run the below

    0 9 * * * cd /home/tduong/remider-bot && /usr/local/bin/pipenv run python reminder.py -c ./config/your-config.json
    

To-do

See projects tab

reminder-bot's People

Contributors

tduong10101 avatar mmcmd avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Forkers

tduong10101

reminder-bot's Issues

Add parser and pipenv

Just thought it's a good to have pipenv setup for dependency modules.
Also adding parser for config file, this will enable user to have multiple cron jobs on different bot, server or message.

cron job with aws lambda

I think aws lambda is perfect for this script. Save us from setting up a server and we have 1Mil free job every month.
I might write up a cloud formation template with a CI/CD pipeline for this...

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.