Beispiel #1
0
def GetLessions(message, bot):
    mesg = message.text
    try:

        if not message.text in lessions:

            answ = "Группа не найдена"

            bot.reply_to(message, answ)
            return

        answ = "|№| Группа : " + lessions[mesg].GroupNum + "|" + "\n"

        i = 0
        for lession in lessions[mesg].Lessions:
            answ += "|" + str(i) + "| " + lession + " |" + "\n"
            i += 1
        pass
    except:
        answ = "Error GetLessions \n"
        answ += traceback.format_exc()
        Debug.LogError(answ)
        pass
    Debug.Log("GetLession for " + mesg + " by " + message.from_user.first_name)
    bot.reply_to(message, answ)
Beispiel #2
0
def UpdateWithoutTg():
    try:
        parse(get_html(site))
        pass
    except:
        Debug.LogError(traceback.format_exc())
        return
    Debug.Log("Updating lessions")
Beispiel #3
0
def Update(message, bot):
    try:
        parse(get_html(site))
        pass
    except:
        bot.reply_to(message, traceback.format_exc())
        Debug.LogError(traceback.format_exc())
        return
    bot.reply_to(message, "Updated")
    Debug.Log("Updating lessions")
Beispiel #4
0
def SubscribeUser(message, bot):
    splitMsg = message.text.split(" ")
    if not splitMsg[1] in ParseSite.lessions:
        answ = "Группа не найдена"
        bot.reply_to(message, answ)
        return
    subsFile = open(subsFileName, "+w")
    Subs[message.from_user.id] = splitMsg[1]
    subsFile.write(json.dumps(Subs))
    Debug.Log("User subscribed " + message.from_user.first_name + " on " +
              splitMsg[1])
    answ = "Вы подписались на рассылку расписания для групы " + splitMsg[1]
    bot.reply_to(message, answ)
Beispiel #5
0
def reloadImports(message, bot):
    importlib.reload(Group)
    importlib.reload(Debug)
    GroupLessions = Group.GroupLessions
    Update(message, bot)
    Debug.Log("ReloadingImports")