Skip to content

Commit

Permalink
Merge pull request #3 from Crazy-Marvin/development
Browse files Browse the repository at this point in the history
Subway Telegram Bot v0.1
  • Loading branch information
CrazyMarvin committed Sep 12, 2021
2 parents 012f591 + a8e13c5 commit 948a2c2
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 10 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python application

on:
push:
branches: [ development ]
pull_request:
branches: [ development ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Telegram New Game Releases Bot](https://img.shields.io/badge/Telegram-Bot-blue?logo=telegram)](https://t.me/SubwayBot)
[![Telegram Subway Bot](https://img.shields.io/badge/Telegram-Bot-blue?logo=telegram)](https://t.me/SubwayBot)
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/Crazy-Marvin/SubwayTelegramBot/ci)
![healthchecks.io](https://img.shields.io/endpoint?url=https%3A%2F%2Fhealthchecks.io%2Fbadge%2F396c7d03-faf7-4562-9f83-1194d0%2F31QvRDxH%2FSubway.shields)
[![License](https://img.shields.io/github/license/Crazy-Marvin/SubwayTelegramBot)](https://github.com/Crazy-Marvin/SubwayTelegramBot/blob/trunk/LICENSE)
Expand All @@ -8,9 +8,8 @@
[![Issues](https://img.shields.io/github/issues/Crazy-Marvin/SubwayTelegramBot.svg?style=flat)](https://github.com/Crazy-Marvin/SubwayTelegramBot/issues)
[![Pull requests](https://img.shields.io/github/issues-pr/Crazy-Marvin/SubwayTelegramBot.svg?style=flat)](https://github.com/Crazy-Marvin/SubwayTelegramBot/pulls)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/a9ec4ee98a93425ca8162b369adce3db)](https://www.codacy.com/gh/Crazy-Marvin/SubwayTelegramBot/dashboard?utm_source=github.com&utm_medium=referral&utm_content=Crazy-Marvin/SubwayTelegramBot&utm_campaign=Badge_Grade)
[![PHP Dependencies](https://badgen.net/badge/icon/dependabot?icon=dependabot&label)](https://getcomposer.org/)
[![Dependabot](https://badgen.net/badge/icon/dependabot?icon=dependabot&label)](https://python.org/)
![Snyk Vulnerabilities for GitHub Repo](https://img.shields.io/snyk/vulnerabilities/github/Crazy-Marvin/SubwayTelegramBot)
[![StyleCI](https://github.styleci.io/repos/402841855/shield?branch=development&style=flat)](https://github.styleci.io/repos/402841855?branch=development)

# Subway Telegram Bot

Expand Down
8 changes: 1 addition & 7 deletions Subway_Bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@

API_KEY = os.getenv("API_KEY") # your Token from @Botfather
my_id = os.getenv("my_id") # your personal chat ID
healthchecks = os.getenv("healthchecks") # your healthchecks.io URL

try:
requests.get("healthchecks", timeout=300)
except requests.RequestException as e:
print("Ping failed: %s" % e)

welcome_stk = "CAACAgIAAxkBAAN6YQg3tT0d6WxU_lo-bUquFOv0Qh8AAgUAA8A2TxP5al-agmtNdSAE"
thanks_stk = "CAACAgIAAxkBAAM_YQgjN81oKkVQl3LNKKt69sddvbwAAhcAA1m7_CX7oZ-xASU7NiAE"
Expand Down Expand Up @@ -144,4 +138,4 @@ def callback_listener(call):
elif data == 'contact':
contact(call.message)

subway_bot.polling() # checking for new messages
subway_bot.polling() # checking for new messages
8 changes: 8 additions & 0 deletions healthchecks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import dotenv, os, requests

dotenv.load_dotenv()

try:
requests.get("https://hc-ping.com/db037b86-718a-4ce1-aecc-70e0a994965e", timeout=300)
except requests.RequestException as e:
print("Ping failed: %s" % e)

0 comments on commit 948a2c2

Please sign in to comment.