rolespace 0.2.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/rolespace.js +21 -0
package/package.json
CHANGED
package/rolespace.js
CHANGED
|
@@ -608,6 +608,27 @@ class Rolespace {
|
|
|
608
608
|
return new RolespaceMessage(await this.post(`/servers/${serverId}/channels/${channelId}/messages`, payload));
|
|
609
609
|
}
|
|
610
610
|
|
|
611
|
+
/**
|
|
612
|
+
* Send an ephemeral message to a single user in a channel — they see it,
|
|
613
|
+
* nobody else does, and it's gone on reload. Accepts the same extras as
|
|
614
|
+
* sendMessage (embeds and/or one Components panel).
|
|
615
|
+
*
|
|
616
|
+
* Same scopes/permissions as a normal send, plus the recipient must be
|
|
617
|
+
* able to view the channel.
|
|
618
|
+
*
|
|
619
|
+
* // Reply ephemerally to whoever just typed "!secret":
|
|
620
|
+
* await rs.sendEphemeral(serverId, channelId, msg.author.id,
|
|
621
|
+
* "Here's your private info 👀");
|
|
622
|
+
*
|
|
623
|
+
* // With an embed + button panel:
|
|
624
|
+
* await rs.sendEphemeral(serverId, channelId, userId, "Take your pick:", embed, panel);
|
|
625
|
+
*/
|
|
626
|
+
async sendEphemeral(serverId, channelId, recipientUserId, ...rest) {
|
|
627
|
+
const payload = _buildMessagePayload(rest);
|
|
628
|
+
payload.recipientAccountId = recipientUserId;
|
|
629
|
+
return this.post(`/servers/${serverId}/channels/${channelId}/ephemeral`, payload);
|
|
630
|
+
}
|
|
631
|
+
|
|
611
632
|
/** Fetch a single message by id. */
|
|
612
633
|
async getMessage(serverId, channelId, messageId) {
|
|
613
634
|
return new RolespaceMessage(await this.get(`/servers/${serverId}/channels/${channelId}/messages/${messageId}`));
|