Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 23 additions & 42 deletions stable/chat/v1/messages.proto
Original file line number Diff line number Diff line change
Expand Up @@ -30,37 +30,11 @@ message Overrides {
}
}

// The payload sent to the bot when an action is triggered.
message ActionPayload {
// The payload data for a button action.
message Button {
// The data from the Button action.
bytes data = 1;
}
// The payload for a dropdown action.
message Dropdown {
// The user choice from the dropdown.
bytes choice = 1;
}
// The payload for a text input action.
message Input {
// The user input.
string input = 1;
// The bot-provided data.
bytes data = 2;
}
// The payload data.
oneof payload {
// Payload for a button.
Button button = 1;
// Payload for a dropdown.
Dropdown dropdown = 2;
// Payload for a text input.
Input input = 3;
}
}

// Actions are interactive elements that can exist within an embed.
// Actions are interactive elements that can exist within a message.
// They can be only sent by bots; servers should ignore actions created by users.
//
// Servers MUST verify that the action data sent by an user is valid for that action
// before sending it to the bot.
message Action {
// The action type. This is primarily used to change the look of the action to
// the user (example: Destructive actions will have a red background).
Expand All @@ -78,14 +52,11 @@ message Action {
// The text to show on the button.
string text = 1;

// Action data, which should be used in the call to perform the action.
bytes data = 2;

// An external URL that the button links to.
//
// This makes it so that tapping this button will open said URL instead
// of triggering the action.
optional string url = 3;
optional string url = 2;
}

// A dropdown menu that users can click on to trigger an action.
Expand All @@ -111,21 +82,24 @@ message Action {
string label = 1;
// Whether this text input should be a multiline one or not.
bool multiline = 2;
// Contextual data allowing the bot to discern what the user input is for.
bytes data = 3;
// The default text that should be pre-filled in the text field.
optional string default = 3;
}

// Type of the action.
Type action_type = 1;
// Contextual info allowing the bot to discern what the action is for.
// The info of an action cannot be the same with the info of another action in the same message.
bytes info = 2;

// The kind of the action.
oneof kind {
// Button action.
Button button = 2;
Button button = 3;
// Dropdown action.
Dropdown dropdown = 3;
Dropdown dropdown = 4;
// Input action.
Input input = 4;
Input input = 5;
}
}

Expand Down Expand Up @@ -440,6 +414,8 @@ message Message {
Content content = 7;
// The reactions of the message.
repeated Reaction reactions = 8;
// Bot actions to show on this message.
repeated Action actions = 9;
}

// Object representing a message with it's ID.
Expand Down Expand Up @@ -537,8 +513,11 @@ message TriggerActionRequest {
uint64 channel_id = 2;
// Message ID of the message you want to trigger an action in.
uint64 message_id = 3;
// Payload of action data.
ActionPayload payload = 4;
// Data that alllows the bot to discern which action the user is trying to trigger.
// A server MUST verify that this info refers to a valid action for the target message.
bytes info = 4;
// Payload of action data. Ignored if this is a button action.
optional bytes payload = 5;
}
// Used in the `TriggerAction` endpoint.
message TriggerActionResponse {}
Expand Down Expand Up @@ -604,6 +583,8 @@ message SendMessageRequest {
optional Overrides overrides = 6;
// The message this new message is a reply to.
optional uint64 in_reply_to = 7;
// Actions to send on this message. Ignored if the message is not sent by a bot.
repeated Action actions = 8;
// The metadata of this new message.
optional harmonytypes.v1.Metadata metadata = 5;
}
Expand Down
4 changes: 3 additions & 1 deletion stable/chat/v1/stream.proto
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,10 @@ message StreamEvent {
uint64 message_id = 3;
// User ID of the user that triggered the action
uint64 user_id = 4;
// The custom info set by the bot
optional bytes info = 5;
// The action data payload
ActionPayload payload = 5;
optional bytes payload = 6;
}

// Event sent when a role's position in the role list is changed.
Expand Down