line/line-bot-sdk-python

can not use ClipboardAction

Closed this issue · 2 comments

ccwuco commented

Do this before creating an issue

When creating an issue

  • Make sure your issue is related to the LINE Bot SDK. For general questions about LINE bots, please ask in https://www.linebiz.com/contact/
  • Provide detailed information about the issue you had with the SDK as below

System Informations

  • Python version: 3.9
  • SDK version: 3.11.0
  • OS: MacOS

Expected Behavior

I want import "ClipboardAction", and QuickReplyButton(action=ClipboardAction(label="Label", clipboardText="Text"))
and send message QuickBtn with ClipboardAction。

Current Behavior

from linebot.models import QuickReply, QuickReplyButton, MessageAction, PostbackAction, URIAction, ClipboardAction
ImportError: cannot import name 'ClipboardAction' from 'linebot.models' (/Users/ccwu/Library/Python/3.9/lib/python/site-packages/linebot/models/init.py)

QuickReply, QuickReplyButton, MessageAction, PostbackAction, URIAction: Works Great!!!
when i import ClipboardAction, it show me ImportError.

from linebot.v3.messaging.models.clipboard_action import ClipboardAction
from linebot.v3.messaging.models import ClipboardAction

may work. https://github.com/line/line-bot-sdk-python/pull/595/files added ClipboardAction.

The latest usage of quick reply in line-bot-sdk is here. This will help you to use new library.

elif text == 'quick_reply':
line_bot_api.reply_message(
ReplyMessageRequest(
reply_token=event.reply_token,
messages=[TextMessage(
text='Quick reply',
quick_reply=QuickReply(
items=[
QuickReplyItem(
action=PostbackAction(label="label1", data="data1")
),
QuickReplyItem(
action=MessageAction(label="label2", text="text2")
),
QuickReplyItem(
action=DatetimePickerAction(label="label3",
data="data3",
mode="date")
),
QuickReplyItem(
action=CameraAction(label="label4")
),
QuickReplyItem(
action=CameraRollAction(label="label5")
),
QuickReplyItem(
action=LocationAction(label="label6")
),
]
)
)]
)
)