Create (rich) Message (Section) — DiSky

Addon: DiSky · Category: Section · Since: 4.0.0

Syntax

(make|create) [a] [new] [silent] message [(based on|from) %-message%] [and store (it|the result) in %-~objects%]

Description

Creates a rich message. A rich message can receive the following data: - Content - Embed[s] (default max is 1, webhooks can send up to 5) - Attachment(s) (supports images if SkImage is installed) - Components This will be used to both post & edit a message. Simply change what you want and pass the result of the section to the edit effect.

Examples

create a new message and store it in {_message}:
    set the content of the message to "hello world"


    # we create a new component row that'll hold multiple buttons
    create a new row and store it in {_row}:

        add new danger button with id "test" named "Hello World" with reaction "smile" to the components of the row
        add new success button with id "test2" named "yuss" to the components of the row
    # we add the row containing two buttons
    add {_row} to the rows of message
        
    # row with one button only
    add new secondary button with id "test3" named "Another row!" to the rows of message

    set {_dp} to new dropdown with id "selector"
    set min range of {_dp} to 1
    set max range of {_dp} to 2
    set placeholder of {_dp} to "Dropdown"
    loop "one", "two" and "three":
        add new option with value (loop-value) named "Value: %loop-value%" with description "Click to select" with reaction "sparkles" to options of {_dp}
    add {_dp} to the rows of message

    make embed:
        set title of embed to "hello there!"
        set embed color of embed to red
        set image of embed to "attachment://image1.png"
    add last embed to the embeds of message

    # SkImage's image. Images are named as: 'imageX.png' where X is the attachment's index.
    set {_image} to new image with size 500, 500
    set {_font} to new font style with name "Arial Black" and with size 60
    set {_text} to new text "Hello World" with color from rgb 255, 255, 255 with font {_font} centered vertically centered horizontally
    draw {_text} at 0, 0 on {_image}

    add {_image} to attachments of message

reply with {_message}

View source