All Projects → tasdikrahman → Margo

tasdikrahman / Margo

Licence: gpl-3.0
An opinionated Slack bot written for SRMSE's slack channel

Programming Languages

python
139335 projects - #7 most used programming language

margo

An opiniated Slack bot written for SRMSE's slack channel

demo

Index

What does it do

⬆️ Back to top

Margo will notify in realtime if the queried website is down or not. As it resides inside SRMSE's slack channel, check out whether our own web server is up or not! But yes you can query for other domains too

App structuring

⬆️ Back to top

All the TOKENS have been kept inside a single settings.ini.example file.

$ tree
.
├── assets
│   └── demo.gif
├── CONTRIBUTING.rst
├── LICENSE
├── Makefile
├── margo
│   ├── constants.py
│   ├── core.py
│   ├── helpers.py
│   ├── __init__.py
│   └── utils.py
├── Procfile
├── README.md
├── requirements.txt
├── run.py
├── scripts
│   ├── __init__.py
│   └── print_bot_id.py
└── settings.ini.example

Installation

⬆️ Back to top

Clone it

Install the dependencies

$ virtualenv margo              # Create virtual environment
$ source margo/bin/activate     # Change default python to virtual one
(margo)$ git clone https://github.com/prodicus/margo.git
(margo)$ cd margo
(margo)$ make deps

Deploying to Heroku

Go to the Bot users page and create a new bot to get the SLACK_BOT_TOKEN

$ # create the heroku project
$ heroku create {project-name}
$ heroku config:set BASE_URL=https://isitup.org/
$ heroku config:set RESULT_FORMAT=json
$ heroku config:set SLACK_BOT_TOKEN=YOUR-SLACK-TOKEN
$ heroku config:set BOT_ID=YOUR-BOT-ID
$ # deploy it
$ git push -u heroku master

Check the logs for any errors by doing a $ heroku logs -t

You need to get your Bot's ID too! How do you get it?

Run the script print_bot_id.py placed in inside the project directory scripts. Before running it, Change the the variable BOT_NAME to the bot name you chose for your case

$ make bot_id

And then place put it inside the settings.ini or the heroku environment (whatever you chose)

Running it locally

Setting up the environment variables

(margo)$ cp settings.ini.example settings.ini

and add the required values like SLACK_BOT_TOKEN and BOT_ID

(margo)$ make run

Open you slack channel and start talking to your bot

Bot not responding

So the thing with heroku and it's basic plan is that, the dyno sleeps after some inactivity. Visit http://margo-slackbot.herokuapp.com/ to wake up the bot!

Contributing

⬆️ Back to top

Refer CONTRIBUTING.rst for details

TODO

  • [ ] Make margo query a website in intervals and notify when it goes down!

License

⬆️ Back to top

Built with ♥ and vim by Tasdik Rahman (@tasdikrahman)

Open sourced under GPLv3

You can find a copy of the License at LICENSE

Donation

⬆️ Back to top

If you have found my little bits of software being of any use to you, do consider helping me pay my internet bills :)

PayPal Donate via PayPal!
Gratipay Support via Gratipay
Patreon Support me on Patreon
£ (GBP) Donate via TransferWise!
€ Euros Donate via TransferWise!
₹ (INR) Donate via instamojo
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].