Add Ci procedure

This commit is contained in:
Alexandr Bogomyakov
2018-09-26 18:24:55 +03:00
parent 4d463182aa
commit 0dcb2d6f9b
3 changed files with 19 additions and 5 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

11
Dockerfile Normal file
View File

@ -0,0 +1,11 @@
FROM ubuntu:18.04
RUN apt-get update && \
apt-get install -y python3 python3-pip && \
pip3 install python-telegram-bot && \
pip3 install requests && \
pip3 install beautifulsoup4 && \
WORKDIR /usr/share/fesmoo_perdoliq
COPY ./*py /usr/share/fesmoo_perdoliq/
CMD python3 baraban.py

View File

@ -6,16 +6,17 @@ on the telegram.ext bot framework.
This program is dedicated to the public domain under the CC0 license.
"""
import os
import sys
import logging
import threading
import telegram
from telegram.error import NetworkError, Unauthorized
from time import sleep
try:
import tg_settings
TOKEN = os.environ["TG_TOKEN"]
except:
print("You have to create tg_settings.py. See tg_settings.py.example.")
os.exit(1)
print("You have to set env var TG_TOKEN with bot token.")
sys.exit(1)
try:
if os.environ["DRYRUN"]:
from dryrun import Perdoliq
@ -29,7 +30,6 @@ def main():
"""Run the bot."""
global update_id
# Telegram Bot Authorization Token
TOKEN = tg_settings.TG_TOKEN
bot = telegram.Bot(TOKEN)
# get the first pending update_id,
@ -102,7 +102,10 @@ def do_action(update):
"chosen subj %s "\
"test %s and accuracy %s" % (s[3], s[4], s[5])
update.message.reply_text(msg)
update.message.reply_photo(open('1516736368795.png', 'rb'))
update.message.reply_text("You cannot resolve more than "\
"one test in the same time."\
"Одновременно решать более одного теста невозможно,"\
" вы испортите результаты обоих тестов.")
perdoliq(s[1], s[2], s[3], s[4], s[5], s[6])
update.message.reply_text("It's done. Check your test because "\
"i disclaim any responsibility.")