[DAY16]模板按钮

TemplateSendMessage - ButtonsTemplate

buttons_template_message = TemplateSendMessage(
    alt_text='Buttons template',
    template=ButtonsTemplate(
        按钮上方的图片
        thumbnail_image_url='https://example.com/image.jpg',
        粗体字
        title='Menu',
        解释此按钮的目的
        text='Please select',
        actions=[
        按钮的三种类型,控制使用者说出我们开发者希望其说出的话
            PostbackAction(
                label='postback',
                display_text='postback text',
                data='action=buy&itemid=1'
            ),
        让机器人回复开发者希望机器人回复的讯息
            MessageAction(
                label='message',
                text='message text'
            ),
        按下去後到开发者希望使用者抵达的网站
            URIAction(
                label='uri',
                uri='http://example.com/'
            )
        ]
    )
)

Template with an image, title, text, and multiple action buttons.

type
String Required
buttons
图片、标题是可以选择是否要放
thumbnailImageUrl
String Optional
Image URL (Max character limit: 2,000)
HTTPS over TLS 1.2 or later
JPEG or PNG
Max width: 1024px
Max file size: 10 MB

imageAspectRatio
String Optional
Aspect ratio of the image. One of:

rectangle: 1.51:1
square: 1:1
Default: rectangle

imageSize
String Optional
Size of the image. One of:

cover: The image fills the entire image area. Parts of the image that do not fit in the area are not displayed.
contain: The entire image is displayed in the image area. A background is displayed in the unused areas to the left and right of vertical images and in the areas above and below horizontal images.
Default: cover

imageBackgroundColor
String Optional
Background color of the image. Specify a RGB color value. Default: #FFFFFF (white)

title
String Optional
Title
Max character limit: 40

text
String Required
Message text
Max character limit: 160 (no image or title)
Max character limit: 60 (message with an image or title)
当主体被按後的动作
defaultAction
Action object Optional
Action when image, title or text area is tapped.
按钮最多只能有4个
actions
Array of action objects Required
Action when tapped
Max objects: 4
下图基本上就是用Maso老师给的档案,基本没有更改
https://ithelp.ithome.com.tw/upload/images/20210930/20140159ymtUJCkKbL.png


<<:  # Day15--今天,我想来点.......扩展

>>:  [面试][後端]在正式 API 完成前,如何让要串接的工程师不要空等?

Day17 - 帮蛇多加了暂停与继续

class Game{ startGame () { this.snake = new Snake(...

萤幕录影和笔电录音-- Windows 7/8

新版本的 Windows 作业系统,但是不少用户还是喜欢用经典的 Windows 7/8 版本。我们...

Day22. 当苹果掉到牛顿头上,牛顿被敲醒了 - Gravity

一开始到现在,虽然我们没有特别提到,物体就那麽自然的向下掉,就像苹果掉到牛顿头上的自然,这背後的理所...

[Day5]UTXO未花费的交易输出

HI!今天要介绍UTXO!如果对UTXO有兴趣,欢迎继续看下去! 今天会分成UTXO介绍、参观实例...

Day 22 Flask-SocketIO

上一篇讲完了 Flask 的本体,这篇开始就要开始讲 Flask 的插件了。Flask 从初始版本(...