help.py 4.74 KB
#-*-coding: utf-8 -*-
import os
import sys
from flask import request
import datetime

import random

sys.path.append(os.path.dirname(os.path.dirname("main")))
from Functions.getInstance import *
from Functions.checkFunction import *
from Functions.updateDatabase import *
from Functions.messageTypes import *
from Config import intentBlockId

# 도움말 시작
def get_startHelp_message():
    contextList = []
    outputList = []
    qrList = []

    payload = request.get_json()
    kakaoUserKey = getKakaoUserKeyFromPayload(payload)
    outputList.append(simpleText('[시스템] 무엇이 궁금하신가요?'))

    # help button window
    qrList = helpButtonWindow()

    # 메시지 로그 저장 sender: bot, receiver: user
    addMessageLogs('bot', kakaoUserKey, '[도움말]메인', datetime.datetime.now(), 'none')

    return ordinaryMessageType(contextList, outputList, qrList)

def get_quitHelp_message():
    contextList = []
    outputList = []
    qrList = []

    payload = request.get_json()
    kakaoUserKey = getKakaoUserKeyFromPayload(payload)
    petId = getPetId(kakaoUserKey)
    petName = getPetName(petId)
    outputList.append(simpleText('[시스템] 언제든지 다시 질문해주세요'))

    # 챗봇 노란버튼
    qrList = basicButtonWindow(petName)

    # 메시지 로그 저장 sender: bot, receiver: user
    addMessageLogs('bot', kakaoUserKey, '[도움말]종료', datetime.datetime.now(), 'none')

    return ordinaryMessageType(contextList, outputList, qrList)

def get_serviceIntroduction_message():
    contextList = []
    outputList = []
    qrList = []

    payload = request.get_json()
    kakaoUserKey = getKakaoUserKeyFromPayload(payload)
    petId = getPetId(kakaoUserKey)
    petName = getPetName(petId)

    card_list = serviceIntroductionCardList(petName)
    outputList.append(cardArray(card_list))
    outputList.append(simpleText('도기보기와 함께라면 밖에서도 우리집 ' + petName + '와 채팅할 수 있어요😊'))
    outputList.append(simpleText(petName + '와 카톡할 준비 되셨나요?'))

    # help button window
    qrList = helpButtonWindow()

    # 메시지 로그 저장 sender: bot, receiver: user
    addMessageLogs('bot', kakaoUserKey, '[도움말]서비스 소개', datetime.datetime.now(), 'none')

    return ordinaryMessageType(contextList, outputList, qrList)


# QR코드 스캔 도움말
def get_helpQrScan_message():
    contextList = []
    outputList = []
    qrList = []

    payload = request.get_json()
    kakaoUserKey = getKakaoUserKeyFromPayload(payload)
    outputList.append(simpleText('[시스템] 카메라 초점을 맞춰서 스캔해보시겠어요?'))
    outputList.append(simpleText('그래도 스캔이 잘 되지 않는다면 연락주세요\n\n‍📧: petpeotalk@gmail.com'))

    qrList.append(blockQuickReply('돌아가기↩️', '돌아가기↩️', intentBlockId.help))

    # 메시지 로그 저장 sender: bot, receiver: user
    addMessageLogs('bot', kakaoUserKey, '[도움말]QR코드스캔', datetime.datetime.now(), 'none')

    return ordinaryMessageType(contextList, outputList, qrList)

# 사진추가 도움말
def get_helpAddImage_message():
    contextList = []
    outputList = []
    qrList = []

    payload = request.get_json()
    kakaoUserKey = getKakaoUserKeyFromPayload(payload)
    petId = getPetId(kakaoUserKey)
    petName = getPetName(petId)

    outputList.append(simpleText('물론이에요!'))
    outputList.append(simpleText('귀여운 ' + petName + '사진은 언제든지 추가 가능합니다😍'))

    qrList.append(blockQuickReply('사진추가하기📸', '사진추가하기📸️', '5d4251ca8192ac0001b8d96e'))
    qrList.append(blockQuickReply('돌아가기↩️', '돌아가기↩️', intentBlockId.help))

    # 메시지 로그 저장 sender: bot, receiver: user
    addMessageLogs('bot', kakaoUserKey, '[도움말]사진추가', datetime.datetime.now(), 'none')

    return ordinaryMessageType(contextList, outputList, qrList)


# 사용인원 도움말
def get_helpCapacity_message():
    contextList = []
    outputList = []
    qrList = []

    payload = request.get_json()
    kakaoUserKey = getKakaoUserKeyFromPayload(payload)
    outputList.append(simpleText('아쉽게도 아직은 공기계 한 대당 한 명만 이용하실 수 있습니다'))
    outputList.append(simpleText('머지않아 온가족이 도기보기와 함께할 수 있어요!\n'
                                                        '기대해주실거죠?☺'))

    qrList.append(blockQuickReply('돌아가기↩️', '돌아가기↩️', intentBlockId.help))

    # 메시지 로그 저장 sender: bot, receiver: user
    addMessageLogs('bot', kakaoUserKey, '[도움말]사용인원', datetime.datetime.now(), 'none')

    return ordinaryMessageType(contextList, outputList, qrList)