How to used ClipboardAction?
dalnel opened this issue · 3 comments
dalnel commented
I want add ClipboardAction in Buttons Template ,but it is not work,my code:
from linebot.v3.messaging.models import ClipboardAction
from linebot.models import ButtonsTemplate, MessageAction, TemplateSendMessage, CarouselTemplate, CarouselColumn, PostbackAction, URIAction
def delet_CarouselTemplate():
columns=[]
column_item = ButtonsTemplate(
title="copy test",
text="click button to copy text",
actions=[
ClipboardAction(
type="clipboard",
label="copy",
clipboardText="copy hellow word"
)
]
)
columns.append(column_item)
return TemplateSendMessage(
alt_text='ButtonsTemplate',
template=ButtonsTemplate(columns)
)
CarouselTemplate = delet_CarouselTemplate()
line_bot_api.reply_message(tk,CarouselTemplate)
I used breakpoints in VS Code to inspect what was happening, and I found out that this action was not even added. So, I checked the linebot.models, and I realized that ClipboardAction is not included there. Did I use the wrong method or did I forget to add it?
YrChen1001 commented
I can't use this action either
Yang-33 commented
Hi @YrChen1001, thank you for using line-bot-sdk-python.
Please import definition from linebot.v3.messaging.models instead of linebot.models. linebot.models are too old. I'll deprecate them.
Yang-33 commented
line-bot-sdk-python/examples/flask-kitchensink/app.py
Lines 303 to 322 in 12360f8
ButtonsTemplate in linebot.v3.messaging.models, that might help you!