Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.

Message Usage

runoneall edited this page Dec 10, 2024 · 6 revisions
简体中文 | English
Language translations may not be 100% accurate

Import Module

from RyhBotPythonSDK import Message

Set the message token

Message.Token = "Your message token can be found in the Yunhu backend"

Send Message

Send = Message.Send()

Text

Send.Text(
    recvId = "Target ID",
    recvType = "Target Type",
    text = "Text"
)

Markdown

Send.Markdown(
    recvId = "Target ID",
    recvType = "Target Type",
    markdown = "Markdown Statements"
)

Image

Send.Image(
    recvId = "Target ID",
    recvType = "Target Type",
    imagePath = "Image Path"
)

File

Send.File(
    recvId = "Target ID",
    recvType = "Target Type",
    fileName = "file name",
    fileUrl = "File URL"
)

Optional parameters

  1. buttons: A list of buttons, Visit document for more information.
  2. parentId: The ID of the quoted message.

Response

  1. code: Response status code.
  2. msg: Response information, including exception information.
  3. data: Response data.

Edit Message

Edit = Message.Edit()

Text

Edit.Text(
    msgId = "Message ID",
    recvId = "Target ID",
    recvType = "Target Type",
    new_text = "New Text"
)

Markdown

Edit.Markdown(
    msgId = "Message ID",
    recvId = "Target ID",
    recvType = "Target Type",
    new_markdown = "New Markdown"
)

Image

Edit.Image(
    msgId = "Message ID",
    recvId = "Target ID",
    recvType = "Target Type",
    new_image_path = "New Image Path"
)

File

Edit.File(
    msgId = "Message ID",
    recvId = "Target ID",
    recvType = "Target Type",
    new_file_name = "New File Name",
    new_file_url = "New File URL"
)

Optional parameters

  1. buttons: A list of buttons, Visit document for more information.

Response

  1. code: Response status code.
  2. msg: Response information, including exception information.
  3. data: Response data.

Delete Message

Delete = Message.Delete

Usage

Delete(
    msgId="Message ID",
    chatId="Target ID",
    chatType="Target Type",
)

Response

  1. code: Response status code.
  2. msg: Response information, including exception information.
  3. data: Response data.

Get Message

Messages = Message.Messages()

Before

Messages.Before(
    chat_id = "Target ID",
    chat_type = "Target Type",
    before = Number_of_messages # Int
)

After

Messages.After(
    chat_id = "Target ID",
    chat_type = "Target Type",
    message_id = "Message ID", # Based on a certain message, get the subsequent message
    after = Number_of_messages # Int
)

Response

  1. code: Response status code.
  2. msg: Response information, including exception information.
  3. data: Response data.

Management dashboard

User dashboard

Board = Message.Board()

Text

Board.Text(
    recvId = "Target ID",
    recvType = "Target Type",
    text = "Dashboard text"
)

Markdown

Board.Markdown(
    recvId = "Target ID",
    recvType = "Target Type",
    markdown = "Dashboard Markdown text"
)

Html

Board.Html(
    recvId = "Target ID",
    recvType = "Target Type",
    html = "Dashboard HTML text"
)

Optional parameters

  1. expireTime: The expiration time of the message, in seconds.

Cancel board

Board.Dismiss(
    recvId = "Target ID",
    recvType = "Target Type"
)

Global dashboard

BoardAll = Message.Board.All()

Text

BoardAll.Text(
    text = "Dashboard text"
)

Markdown

BoardAll.Markdown(
    markdown = "Dashboard Markdown text"
)

Html

BoardAll.Html(
    html = "Dashboard HTML text"
)

Optional parameters

  1. expireTime: The expiration time of the message, in seconds.

Cancel board

BoardAll.Dismiss()

This document is written by English and 简体中文.

English


本文档由English和简体中文编写。

简体中文

Clone this wiki locally