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

View File

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