Code Monkey home page Code Monkey logo

carcassonne-spain-telegram-bot's Introduction

๐Ÿค– carcassonne-spain-telegram-bot

Send updates about Carcassonne Spain league to Telegram groups. Also tweets them.

Bot demo

๐Ÿ“ฆ Setup

Telegram bot

You need to create a Telegram bot in case you don't have one:

  1. Open a chat with BotFather.
  2. Type /newbot and follow BotFather instructions.

Once you are done, edit config.yml and fill your Telegram token.

Twitter bot

You need to go to https://developer.twitter.com , get your tokens and put them in config.yml.

Dependencies

$ python -m venv venv
$ source venv/bin/activate
$ pip install -r requirements.txt

Or using Docker:

$ docker build -t carcassonnespain .

๐Ÿš€ Usage

$ bin/telegram_bot
$ bin/twitter_bot

Again, if you prefer to use Docker:

$ docker run carcassonnespain
$ docker run --entrypoint bin/twitter_bot carcassonnespain

Once telegram_bot is running, it will start to send daily updates to all the groups at the time specified in config.yml.

twitter_bot simply tweets when you run it. Hence you need to put it in cron to get daily updates.

๐Ÿงช Testing

When you run the bot, you get the outcome for games played yesterday and the schedule for games that will be played today.

For testing purposes, you can pretend that today is a different day. You can also use the --test flag so nothing is send to telegram/twitter, messages will be printed instead.

$ bin/telegram_bot --today 2022-11-01 --test
$ bin/twitter_bot --today 2022-11-01 --test

๐Ÿ‘ท Contributing

Code simply retrieves some csv files, generate a message and publish it in Telegram/Twitter. All the csv reading and parsing is done under src/cs/. Telegram/Twitter stuff is inside src/io/.

After cloning the repository you should set up pre-commit:

$ python3 -m venv venv
$ source env/bin/activate
$ pip install -r dev/requirements.txt
$ pip install -r requirements.txt
$ pre-commit install

Then update, test and commit. pre-commit will check code quality and format using black, pyright, flake8 and pylint. It will also run unit tests.

๐Ÿ“œ License

GPL v3

carcassonne-spain-telegram-bot's People

Contributors

davidegx avatar inigomartinez avatar

Watchers

 avatar  avatar

Forkers

inigomartinez

carcassonne-spain-telegram-bot's Issues

Add pre-commit hooks

Add pre-commit so some checks are run before committing any change:

  • Run isort
  • Run black
  • Run tests

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.