Skip to content

Commit

Permalink
Update docs for template messages
Browse files Browse the repository at this point in the history
  • Loading branch information
gehongyan committed Nov 12, 2024
1 parent cbb3bf8 commit c475ec6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
17 changes: 11 additions & 6 deletions docs/quick_reference/http_api/direct-message.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,22 @@ Stream stream = null; // 要发送的文件的流
FileAttachment attachment = default; // 要发送的文件的附件
ICard card = null; // 要发送的卡片
IEnumerable<ICard> cards = null; // 要发送的卡片列表
int templateId = default; // 要发送的模板消息的模板 ID
T parameters = default; // 要发送的模板消息的参数
JsonSerializerOptions jsonSerializerOptions = null; // 要发送的模板消息的参数的序列化选项
// API 请求,发送文本消息
Cacheable<IUserMessage,Guid> textMessage = await dmChannel.SendTextAsync(text, quote);
Cacheable<IUserMessage, Guid> textMessage = await dmChannel.SendTextAsync(text, quote);
Cacheable<IUserMessage, Guid> textMessageFromTemplate = await dmChannel.SendTextAsync(templateId, parameters, quote, jsonSerializerOptions);
// API 请求,发送文件消息
Cacheable<IUserMessage,Guid> fileMessageFromPath = await dmChannel.SendFileAsync(filePath, fileName, fileType, quote);
Cacheable<IUserMessage,Guid> fileMessageFromStream = await dmChannel.SendFileAsync(stream, fileName, fileType, quote);
Cacheable<IUserMessage,Guid> fileMessageFromAttachment = await dmChannel.SendFileAsync(attachment, quote);
Cacheable<IUserMessage, Guid> fileMessageFromPath = await dmChannel.SendFileAsync(filePath, fileName, fileType, quote);
Cacheable<IUserMessage, Guid> fileMessageFromStream = await dmChannel.SendFileAsync(stream, fileName, fileType, quote);
Cacheable<IUserMessage, Guid> fileMessageFromAttachment = await dmChannel.SendFileAsync(attachment, quote);
// API 请求,发送单卡片消息
Cacheable<IUserMessage,Guid> cardMessage = await dmChannel.SendCardAsync(card, quote);
Cacheable<IUserMessage, Guid> cardMessage = await dmChannel.SendCardAsync(card, quote);
// API 请求,发送多卡片消息
Cacheable<IUserMessage,Guid> cardsMessage = await dmChannel.SendCardsAsync(cards, quote);
Cacheable<IUserMessage, Guid> cardsMessage = await dmChannel.SendCardsAsync(cards, quote);
Cacheable<IUserMessage, Guid> cardsMessageFromTemplate = await dmChannel.SendCardsAsync(templateId, parameters, quote, jsonSerializerOptions);
```

### [更新私信聊天消息]
Expand Down
17 changes: 11 additions & 6 deletions docs/quick_reference/http_api/message.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,22 @@ Stream stream = null; // 要发送的文件的流
FileAttachment attachment = default; // 要发送的文件的附件
ICard card = null; // 要发送的卡片
IEnumerable<ICard> cards = null; // 要发送的卡片列表
int templateId = default; // 要发送的模板消息的模板 ID
T parameters = default; // 要发送的模板消息的参数
JsonSerializerOptions jsonSerializerOptions = null; // 要发送的模板消息的参数的序列化选项
// API 请求,发送文本消息
Cacheable<IUserMessage,Guid> textMessage = await textChannel.SendTextAsync(text, quote, ephemeralUser);
Cacheable<IUserMessage, Guid> textMessage = await textChannel.SendTextAsync(text, quote, ephemeralUser);
Cacheable<IUserMessage, Guid> textMessageFromTemplate = await textChannel.SendTextAsync(templateId, parameters, quote, ephemeralUser, jsonSerializerOptions);
// API 请求,发送文件消息
Cacheable<IUserMessage,Guid> fileMessageFromPath = await textChannel.SendFileAsync(filePath, fileName, fileType, quote, ephemeralUser);
Cacheable<IUserMessage,Guid> fileMessageFromStream = await textChannel.SendFileAsync(stream, fileName, fileType, quote, ephemeralUser);
Cacheable<IUserMessage,Guid> fileMessageFromAttachment = await textChannel.SendFileAsync(attachment, quote, ephemeralUser);
Cacheable<IUserMessage, Guid> fileMessageFromPath = await textChannel.SendFileAsync(filePath, fileName, fileType, quote, ephemeralUser);
Cacheable<IUserMessage, Guid> fileMessageFromStream = await textChannel.SendFileAsync(stream, fileName, fileType, quote, ephemeralUser);
Cacheable<IUserMessage, Guid> fileMessageFromAttachment = await textChannel.SendFileAsync(attachment, quote, ephemeralUser);
// API 请求,发送单卡片消息
Cacheable<IUserMessage,Guid> cardMessage = await textChannel.SendCardAsync(card, quote, ephemeralUser);
Cacheable<IUserMessage, Guid> cardMessage = await textChannel.SendCardAsync(card, quote, ephemeralUser);
// API 请求,发送多卡片消息
Cacheable<IUserMessage,Guid> cardsMessage = await textChannel.SendCardsAsync(cards, quote, ephemeralUser);
Cacheable<IUserMessage, Guid> cardsMessage = await textChannel.SendCardsAsync(cards, quote, ephemeralUser);
Cacheable<IUserMessage, Guid> cardsMessageFromTemplate = await textChannel.SendCardsAsync(templateId, parameters, quote, ephemeralUser, jsonSerializerOptions);
```

### [更新频道聊天消息]
Expand Down

0 comments on commit c475ec6

Please sign in to comment.