Example #1
0
def handle_message(event):
    print("取得イヴェント:{}".format(event))
    print("取得イヴェントメッセージID:{}".format(event.message.id))
    print("リプライトークン:{}".format(event.reply_token))
    print("------リプライ型------")
    print(type(event.reply_token))

    profile = line_bot_api.get_profile(event.source.user_id)
    print("ユーザーID:{}".format(profile.user_id))

    userId = profile.user_id

    #モザイク(目)
    if event.message.text == ">>おめめモザイク" and os.path.exists("static/" +
                                                            userId):
        print("通過: {}".format(event.message.text))
        with open(path_w1) as f:
            work = f.read()
        with open(path_w2) as f2:
            work1 = f2.read()
        output_method.handle_send_message(work, event.reply_token, userId)

    #線画
    elif event.message.text == ">>線画風" and os.path.exists("static/" + userId):
        print("通過: {}".format(event.message.text))
        with open(path_w1) as f:
            work = f.read()
        with open(path_w2) as f2:
            work1 = f2.read()
        output_method.handle_send_message2(work, event.reply_token, userId)

    #イラスト風
    elif event.message.text == ">>イラスト風" and os.path.exists("static/" +
                                                            userId):
        print("通過: {}".format(event.message.text))
        with open(path_w1) as f:
            work = f.read()
        with open(path_w2) as f2:
            work1 = f2.read()
        output_method.handle_send_message3(work, event.reply_token, userId)

    #ドット絵
    elif event.message.text == ">>ドット絵風" and os.path.exists("static/" +
                                                            userId):
        print("通過: {}".format(event.message.text))
        with open(path_w1) as f:
            work = f.read()
        with open(path_w2) as f2:
            work1 = f2.read()
        output_method.handle_send_message4(work, event.reply_token, userId)

    #髪の毛test
    elif event.message.text == ">>test" and os.path.exists("static/" + userId):
        print("通過: {}".format(event.message.text))
        with open(path_w1) as f:
            work = f.read()
        with open(path_w2) as f2:
            work1 = f2.read()
        output_method.handle_send_message5(work, event.reply_token, userId)
Example #2
0
def handle_message(event):
    # line_bot_api.reply_message(event.reply_token,[TextSendMessage(text=event.message.text),])
    print("取得イヴェント:{}".format(event))
    print("取得イヴェントメッセージID:{}".format(event.message.id))
    print("リプライトークン:{}".format(event.reply_token))
    print("------リプライ型------")
    print(type(event.reply_token))

    #モザイク(目)
    if event.message.text == ">>おめめモザイク":
        print("通過: {}".format(event.message.text))
        with open(path_w1) as f:
            work = f.read()
        with open(path_w2) as f2:
            work1 = f2.read()
        #line_bot_api.reply_message(event.reply_token,[TextSendMessage(text="目のモザイク処理をしています..."),])
        output_method.handle_send_message(work, event.reply_token)

    #線画
    elif event.message.text == ">>線画風":
        print("通過: {}".format(event.message.text))
        with open(path_w1) as f:
            work = f.read()
        with open(path_w2) as f2:
            work1 = f2.read()
        #line_bot_api.reply_message(event.reply_token,[TextSendMessage(text="画像を線画化しています..."),])
        output_method.handle_send_message2(work, event.reply_token)

    #イラスト風
    elif event.message.text == ">>イラスト風":
        print("通過: {}".format(event.message.text))
        with open(path_w1) as f:
            work = f.read()
        with open(path_w2) as f2:
            work1 = f2.read()
        #line_bot_api.reply_message(event.reply_token,[TextSendMessage(text="イラスト風に変更しています..."),])
        output_method.handle_send_message3(work, event.reply_token)

    #ドット絵
    elif event.message.text == ">>ドット絵風":
        print("通過: {}".format(event.message.text))
        with open(path_w1) as f:
            work = f.read()
        with open(path_w2) as f2:
            work1 = f2.read()
        #line_bot_api.reply_message(event.reply_token,[TextSendMessage(text="ドット絵風に変更しています..."),])
        output_method.handle_send_message4(work, event.reply_token)

    elif event.message.text == "ヘルプ":
        try:
            print("使い方:{}出力拡張子:{}")
            line_bot_api.reply_message(
                event.reply_token, TextSendMessage(text="使い方:{}\n出力拡張子:{}"))
        except:
            print("だめやん")
Example #3
0
def handle_message(event):
    print("取得イヴェント:{}".format(event))
    print("取得イヴェントメッセージID:{}".format(event.message.id))
    print("リプライトークン:{}".format(event.reply_token))
    print("------リプライ型------")
    print(type(event.reply_token))

    profile = line_bot_api.get_profile(event.source.user_id)
    print("ユーザーID:{}".format(profile.user_id))

    userId = profile.user_id



    #モザイク(目)
    if event.message.text == ">>おめめモザイク" and os.path.exists("static/" + userId):
        print("通過: {}".format(event.message.text))
        with open(path_w1) as f:
            work = f.read()
        with open(path_w2) as f2:
            work1 = f2.read()
        output_method.handle_send_message(work,event.reply_token,userId)

    #線画
    elif event.message.text == ">>線画風" and os.path.exists("static/" + userId):
        print("通過: {}".format(event.message.text))
        with open(path_w1) as f:
            work = f.read()
        with open(path_w2) as f2:
            work1 = f2.read()
        output_method.handle_send_message2(work,event.reply_token,userId)

    #イラスト風
    elif event.message.text == ">>イラスト風" and os.path.exists("static/" + userId):
        print("通過: {}".format(event.message.text))
        with open(path_w1) as f:
            work = f.read()
        with open(path_w2) as f2:
            work1 = f2.read()
        output_method.handle_send_message3(work,event.reply_token,userId)

    #ドット絵
    elif event.message.text == ">>ドット絵風" and os.path.exists("static/" + userId):
        print("通過: {}".format(event.message.text))
        with open(path_w1) as f:
            work = f.read()
        with open(path_w2) as f2:
            work1 = f2.read()
        output_method.handle_send_message4(work,event.reply_token,userId)
    
    # #髪の毛test
    # elif event.message.text == ">>髪色変更" and os.path.exists("static/" + userId):
    #     print("通過: {}".format(event.message.text))
    #     with open(path_w1) as f:
    #         work = f.read()
    #     with open(path_w2) as f2:
    #         work1 = f2.read()
    #     output_method.handle_send_message5(work,event.reply_token,userId)


    #肌の色
    elif event.message.text == ">>肌色変更" and os.path.exists("static/" + userId):
        print("通過: {}".format(event.message.text))
        # with open(path_w1) as f:
        #     work = f.read()
        # with open(path_w2) as f2:
        #     work1 = f2.read()
        #output_method.handle_send_message6(work,event.reply_token,userId)

        flex(event)


    elif event.message.text == ">>緑色変更" and os.path.exists("static/" + userId):
        print("「緑」通過: {}".format(event.message.text))

        color = 1
        with open(path_w1) as f:
            work = f.read()
        with open(path_w2) as f2:
            work1 = f2.read()
        output_method.handle_send_message6(work,event.reply_token,userId,color)

    elif event.message.text == ">>青色変更" and os.path.exists("static/" + userId):
        print("通過: {}".format(event.message.text))

        color = 2
        with open(path_w1) as f:
            work = f.read()
        with open(path_w2) as f2:
            work1 = f2.read()
        output_method.handle_send_message6(work,event.reply_token,userId,color)

    elif event.message.text == ">>黄色変更" and os.path.exists("static/" + userId):
        print("通過: {}".format(event.message.text))

        color = 3
        with open(path_w1) as f:
            work = f.read()
        with open(path_w2) as f2:
            work1 = f2.read()
        output_method.handle_send_message6(work,event.reply_token,userId,color)

    elif event.message.text == ">>ピンク変更" and os.path.exists("static/" + userId):
        print("通過: {}".format(event.message.text))

        color = 4
        with open(path_w1) as f:
            work = f.read()
        with open(path_w2) as f2:
            work1 = f2.read()
        output_method.handle_send_message6(work,event.reply_token,userId,color)


    elif event.message.text == ">>赤色変更" and os.path.exists("static/" + userId):
        print("通過: {}".format(event.message.text))

        color = 5
        with open(path_w1) as f:
            work = f.read()
        with open(path_w2) as f2:
            work1 = f2.read()
        output_method.handle_send_message6(work,event.reply_token,userId,color)

    elif event.message.text == ">>黒色変更" and os.path.exists("static/" + userId):
        print("通過: {}".format(event.message.text))

        color = 6
        with open(path_w1) as f:
            work = f.read()
        with open(path_w2) as f2:
            work1 = f2.read()
        output_method.handle_send_message6(work,event.reply_token,userId,color)


    #髪の毛test
    elif event.message.text == ">>髪色変更" and os.path.exists("static/" + userId):
        print("通過: {}".format(event.message.text))
        flex2(event)

    elif event.message.text == ">>黒色" and os.path.exists("static/" + userId):
        print("通過: {}".format(event.message.text))
        flex_black(event)

    elif event.message.text == ">>茶色" and os.path.exists("static/" + userId):
        print("通過: {}".format(event.message.text))
        flex_cha(event)

    elif event.message.text == ">>黒色から緑色変更" and os.path.exists("static/" + userId):
        print("「緑」通過: {}".format(event.message.text))

        color = 1
        with open(path_w1) as f:
            work = f.read()
        with open(path_w2) as f2:
            work1 = f2.read()
        output_method.handle_send_message6(work,event.reply_token,userId,color)

    elif event.message.text == ">>黒色から青色変更" and os.path.exists("static/" + userId):
        print("「緑」通過: {}".format(event.message.text))

        color = 2
        with open(path_w1) as f:
            work = f.read()
        with open(path_w2) as f2:
            work1 = f2.read()
        output_method.handle_send_message6(work,event.reply_token,userId,color)

    elif event.message.text == ">>黒色から黄色変更" and os.path.exists("static/" + userId):
        print("「緑」通過: {}".format(event.message.text))

        color = 3
        with open(path_w1) as f:
            work = f.read()
        with open(path_w2) as f2:
            work1 = f2.read()
        output_method.handle_send_message6(work,event.reply_token,userId,color)
    
    elif event.message.text == ">>黒色からピンク変更" and os.path.exists("static/" + userId):
        print("「緑」通過: {}".format(event.message.text))

        color = 4
        with open(path_w1) as f:
            work = f.read()
        with open(path_w2) as f2:
            work1 = f2.read()
        output_method.handle_send_message6(work,event.reply_token,userId,color)
    
    elif event.message.text == ">>黒色から赤色変更" and os.path.exists("static/" + userId):
        print("「緑」通過: {}".format(event.message.text))

        color = 5
        with open(path_w1) as f:
            work = f.read()
        with open(path_w2) as f2:
            work1 = f2.read()
        output_method.handle_send_message6(work,event.reply_token,userId,color)
    
    elif event.message.text == ">>黒色から茶色変更" and os.path.exists("static/" + userId):
        print("「緑」通過: {}".format(event.message.text))

        color = 6
        with open(path_w1) as f:
            work = f.read()
        with open(path_w2) as f2:
            work1 = f2.read()
        output_method.handle_send_message6(work,event.reply_token,userId,color)


    
    elif event.message.text == ">>茶色から緑色変更" and os.path.exists("static/" + userId):
        print("「緑」通過: {}".format(event.message.text))

        color = 1
        with open(path_w1) as f:
            work = f.read()
        with open(path_w2) as f2:
            work1 = f2.read()
        output_method.handle_send_message7(work,event.reply_token,userId,color)
    
    elif event.message.text == ">>茶色から青色変更" and os.path.exists("static/" + userId):
        print("「緑」通過: {}".format(event.message.text))

        color = 2
        with open(path_w1) as f:
            work = f.read()
        with open(path_w2) as f2:
            work1 = f2.read()
        output_method.handle_send_message7(work,event.reply_token,userId,color)

    elif event.message.text == ">>茶色から黄色変更" and os.path.exists("static/" + userId):
        print("「緑」通過: {}".format(event.message.text))

        color = 3
        with open(path_w1) as f:
            work = f.read()
        with open(path_w2) as f2:
            work1 = f2.read()
        output_method.handle_send_message7(work,event.reply_token,userId,color)
    
    elif event.message.text == ">>茶色からピンク変更" and os.path.exists("static/" + userId):
        print("「緑」通過: {}".format(event.message.text))

        color = 4
        with open(path_w1) as f:
            work = f.read()
        with open(path_w2) as f2:
            work1 = f2.read()
        output_method.handle_send_message7(work,event.reply_token,userId,color)
    
    elif event.message.text == ">>茶色から赤色変更" and os.path.exists("static/" + userId):
        print("「緑」通過: {}".format(event.message.text))

        color = 5
        with open(path_w1) as f:
            work = f.read()
        with open(path_w2) as f2:
            work1 = f2.read()
        output_method.handle_send_message7(work,event.reply_token,userId,color)
    
    elif event.message.text == ">>茶色から黒色変更" and os.path.exists("static/" + userId):
        print("「緑」通過: {}".format(event.message.text))

        color = 6
        with open(path_w1) as f:
            work = f.read()
        with open(path_w2) as f2:
            work1 = f2.read()
        output_method.handle_send_message7(work,event.reply_token,userId,color)