Skip to content

Commit

Permalink
Update docs for modifying template messages
Browse files Browse the repository at this point in the history
  • Loading branch information
gehongyan committed Nov 12, 2024
1 parent 786162e commit 9dd8f59
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions docs/quick_reference/http_api/direct-message.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,20 @@ POST `/api/v3/direct-message/update`
string content = null; // 要更新的消息的文本
IEnumerable<ICard> cards = null; // 要更新的消息的卡片
IQuote quote = null; // 要更新的消息的引用
int templateId = default; // 要发送的模板消息的模板 ID
T parameters = default; // 要发送的模板消息的参数
JsonSerializerOptions jsonSerializerOptions = null; // 要发送的模板消息的参数的序列化选项
// API 请求
// 在更新模板消息时,指定泛型参数 T 可以提高序列化性能,省略泛型参数 T 时,序列化器将以序列化 object 的方式进行序列化
await userMessage.ModifyAsync(x =>
{
x.Content = content;
x.Cards = cards;
x.Quote = quote; // 要清除引用,请设置为 Quote.Empty
x.TemplateId = templateId;
x.Parameters = parameters;
x.JsonSerializerOptions = jsonSerializerOptions;
});
```

Expand Down
9 changes: 8 additions & 1 deletion docs/quick_reference/http_api/message.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,21 @@ string content = null; // 要更新的消息的文本
IEnumerable<ICard> cards = null; // 要更新的消息的卡片
IQuote quote = null; // 要更新的消息的引用
IUser ephemeralUser = null; // 要更新的瞬态消息的可见用户
int templateId = default; // 要发送的模板消息的模板 ID
T parameters = default; // 要发送的模板消息的参数
JsonSerializerOptions jsonSerializerOptions = null; // 要发送的模板消息的参数的序列化选项
// API 请求
await userMessage.ModifyAsync(x =>
// 在更新模板消息时,指定泛型参数 T 可以提高序列化性能,省略泛型参数 T 时,序列化器将以序列化 object 的方式进行序列化
await userMessage.ModifyAsync<T>(x =>
{
x.Content = content;
x.Cards = cards;
x.Quote = quote; // 要清除引用,请设置为 Quote.Empty
x.EphemeralUser = ephemeralUser;
x.TemplateId = templateId;
x.Parameters = parameters;
x.JsonSerializerOptions = jsonSerializerOptions;
});
```

Expand Down

0 comments on commit 9dd8f59

Please sign in to comment.