Coder Social home page Coder Social logo

detransport_lviv_telegram's Introduction

detransport_lviv_telegram

Source code for https://t.me/DetransportBot

image image image

Installation

Requirements

  • Crystal
  • PostgreSQL

Clone repository:

git clone https://github.com/mamantoha/detransport_lviv_telegram.git

Setup Telegram

Copy .env.example to .env and set variables

Setup Database

Copy config/database.yml.example to config/database.yml and set PostgreSQL variables

crystal sam.cr db:setup
crystal sam.cr db:migrate

Run

shards build --release --production
./bin/detransport_telegram

Development

DB Migration

$ crystal sam.cr generate:migration ChangeUserId
./db/migrations/20220709130450248_change_user_id.cr was successfully created.

Update stops

To update ./src/detransport_telegram/data/lviv_stops.json run:

crystal ./utils/update_stops.cr

Deployment

Linux with systemd

Create /etc/systemd/system/detransport_lviv_telegram.service

[Unit]
Description=Detransport Lviv Telegram service
After=network.target
StartLimitIntervalSec=0

[Service]
Type=simple
Restart=always
RestartSec=1
User=user
WorkingDirectory=/path/to/detransport_lviv_telegram
ExecStart=/path/to/detransport_lviv_telegram/bin/detransport_telegram &>/dev/null &
StandardOutput=null
StandardError=null

[Install]
WantedBy=multi-user.target
sudo systemctl enable detransport_lviv_telegram
sudo systemctl start detransport_lviv_telegram

Contributing

  1. Fork it (https://github.com/mamantoha/detransport_lviv_telegram/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

detransport_lviv_telegram's People

Contributors

imgbotapp avatar mamantoha avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

detransport_lviv_telegram's Issues

Is this bot instance running in webhook mode?

I have seen your code running in polling mode, but the delay time is very low. And my bot runs in the same way, with very high delay time.

My bot: https://t.me/policr_bot

By sending the /ping command, my bot responds for about 3 seconds, and yours is less than 1 second.

Why is this, do you have a clue? We simply call the send_message method, using the same library. Unable to understand ☹.

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.