discord.send() 函数
discord.send()
是用户贡献的函数,由包作者维护。
discord.send()
使用 Discord webhook 向 Discord 频道发送单条消息。
函数类型签名
(
content: A,
username: B,
webhookID: string,
webhookToken: string,
?avatar_url: C,
) => int
有关更多信息,请参阅函数类型签名。
参数
webhookToken
(必需) Discord webhook 令牌。
webhookID
(必需) Discord webhook ID。
username
(必需) 覆盖 Discord webhook 的默认用户名。
content
(必需) 要发送到 Discord 的消息(2000 个字符限制)。
avatar_url
覆盖 Discord webhook 的默认头像。
示例
向 Discord 发送上次报告的状态
import "contrib/chobbs/discord"
import "influxdata/influxdb/secrets"
token = secrets.get(key: "DISCORD_TOKEN")
lastReported =
from(bucket: "example-bucket")
|> range(start: -1m)
|> filter(fn: (r) => r._measurement == "statuses")
|> last()
|> findRecord(fn: (key) => true, idx: 0)
discord.send(
webhookToken: token,
webhookID: "1234567890",
username: "chobbs",
content: "The current status is \"${lastReported.status}\".",
avatar_url: "https://staff-photos.net/pic.jpg",
)
此页是否对您有帮助?
感谢您的反馈!