Exemple #1
0
def konazikan():
    try:
        now = datetime.now()

        text = 'もうこんな時間かぁ'
        # time = ('ただいまの時刻は{}時{}分').format(now.hour, now.minute)
        line_api.push_message(set.ID, [text])
        return True
    except:
        return False
def infromToday():
    try:
        date = tomorrow_Day()
        table = time_table_string(get_time_table(get_date(date)))
        task = task_string(get_task(get_date(date)))
        event = event_string(get_event(get_date(date)))

        #text = 'もうこんな時間かぁ'
        line_api.push_message(setting.ID, [table, task, event])
        #line_api.push_message(setting.ID,[text])
        return True
    except:
        return False
Exemple #3
0
def task_inform():
    try:
        now = datetime.now()

        #text = 'もうこんな時間かぁ'
        #time = ('ただいまの時刻は{}時{}分').format(now.hour, now.minute)

        comment = '課題List {}時通知'.format(now.hour)
        date = '2018/{}/{}'.format(now.month, now.day)
        line_api.push_message(setting.ID, [comment, task_list_string(get_task_list(date))])
        #line_api.push_message(setting.ID,[text, time])
        return True
    except:
        return False
Exemple #4
0
def postback(event_dict):
    data = event_dict['postback']['data'].split()
    if data[0] == 'select':
        if tempDB.get(event_dict['source']['userId']):
            tempDB.add_location(event_dict['source']['userId'], f'{data[1]} {data[2]}')
            line_api.reply_template_confirm(event_dict['replyToken'], '登録しますか?', '登録しますか?', [
                PostbackTemplateAction(label='ええよ', data='yes'),
                PostbackTemplateAction(label='ないわ', data='no'),
            ])
        else:
            data = data[1:]
            result = mainDB.random_select(data[0], data[1])
            if result is None:
                line_api.reply_message(event_dict['replyToken'], 'この駅にはまだ何も登録されていません')
            if result[3] == 'text':
                line_api.push_message(event_dict['source']['userId'], result[4])
            elif result[3] == 'image':
                module.GeneratPreview('contents/user/img/'+result[4])
                line_api.push_image(event_dict['source']['userId'], 'https://trompot.mydns.jp/hack/img/'+result[4], 'https://trompot.mydns.jp/hack/img/preview/'+result[4])
            line_api.reply_template_carousel(event_dict['replyToken'], 'どうでしたか?', 'どうでしたか?', result[0])

    id = 0
    if len(data) == 2:
        id = data[1]
    data = data[0]
    if data == '5':
        mainDB.update(id, 5)
        line_api.reply_message(event_dict['replyToken'], '評価ありがとうございます')
    elif data == '4':
        mainDB.update(id, 4)
        line_api.reply_message(event_dict['replyToken'], '評価ありがとうございます')
    elif data == '3':
        mainDB.update(id, 3)
        line_api.reply_message(event_dict['replyToken'], '評価ありがとうございます')
    elif data == '2':
        mainDB.update(id, 2)
        line_api.reply_message(event_dict['replyToken'], '評価ありがとうございます')
    elif data == '1':
        mainDB.update(id, 1)
        line_api.reply_message(event_dict['replyToken'], '評価ありがとうございます')
    elif data == 'yes':
        data = tempDB.get(event_dict['source']['userId'])[0]
        location = tempDB.get_location(event_dict['source']['userId'])[0][1].split()
        mainDB.add((location[0], location[1], data[1], data[2]))
        line_api.reply_message(event_dict['replyToken'], '登録しました')
        tempDB.delete(event_dict['source']['userId'])
        tempDB.delete_location(event_dict['source']['userId'])
    elif data == 'no':
        tempDB.delete(event_dict['source']['userId'])
        tempDB.delete_location(event_dict['source']['userId'])