This commit is contained in:
mk
2018-05-11 21:50:45 +02:00
parent f135c613a9
commit 9a2d216691
2 changed files with 14 additions and 11 deletions

View File

@@ -28,8 +28,7 @@ def main():
except IndexError: except IndexError:
update_id = None update_id = None
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s') logging.basicConfig(level=logging.DEBUG)
while True: while True:
try: try:
echo(bot) echo(bot)
@@ -40,11 +39,15 @@ def main():
update_id += 1 update_id += 1
def perdoliq(username, password, subj, test, acc): def perdoliq(username, password, subj, test, acc):
from main import Perdoliq try:
app = Perdoliq(username, password) from main import Perdoliq
app.auth() app = Perdoliq(username, password)
app.get_tests() app.auth()
app.resolve(subj, test, acc, is_delayed=False) app.get_tests()
app.resolve(subj, test, acc, is_delayed=False)
except Exception as e:
return "Exception: " + str(e)
def echo(bot): def echo(bot):
@@ -56,9 +59,9 @@ def echo(bot):
if update.message: if update.message:
s = update.message.text.split() s = update.message.text.split()
if len(s) == 5: if len(s) == 6:
msg = "usr: " + s[0] + " pass: " + s[1] + " subj: " + s[2] + " test: " + s[3] + " acc: " + s[4] msg = "usr: " + s[0] + " pass: " + s[1] + " subj: " + s[2] + " test: " + s[3] + " acc: " + s[4]
# perdoliq(s[0], s[1], s[2], s[3], s[4]) perdoliq(s[0], s[1], s[2], s[3], s[4])
update.message.reply_text(msg) update.message.reply_text(msg)

View File

@@ -232,12 +232,12 @@ class Perdoliq:
logging.info("Going to wait %s sec for this question." % delay) logging.info("Going to wait %s sec for this question." % delay)
time.sleep(delay) time.sleep(delay)
accuracy = int(accuracy)
# applying accuracy here. trying to make resulting # applying accuracy here. trying to make resulting
# accuracy NO LESSthan requested. # accuracy NO LESSthan requested.
spoil_count = int(q_count - q_count * (accuracy / 100)) spoil_count = int(q_count - q_count * (accuracy / 100))
if int(spoil_count / q_count * (-100) + 100) < accuracy: if int(spoil_count / q_count * (-100) + 100) < accuracy:
spoil_count -= 1 spoil_count -= 1
# skip random `spoil_count` questions. # skip random `spoil_count` questions.
# Choose questions which going to be skipped # Choose questions which going to be skipped
skip_this = [] skip_this = []