|
| 1 | +syntax = "proto3"; |
| 2 | + |
| 3 | +package protocol.bots.v1; |
| 4 | +/** |
| 5 | +
|
| 6 | +## Bot Invite Codes |
| 7 | +
|
| 8 | +Bot invite codes work similarly to HMC URLs. |
| 9 | +They can either be server+code or just code, |
| 10 | +to refer to a bot on the current homeserver. |
| 11 | +
|
| 12 | +The format for an invite code is: |
| 13 | +> [url[:port]/]code |
| 14 | +
|
| 15 | +where `code` is a purely alphanumeric code. |
| 16 | +
|
| 17 | +*/ |
| 18 | + |
| 19 | +// A description of a bot account |
| 20 | +message Bot { |
| 21 | + // The ID of the bot |
| 22 | + uint64 bot_id = 1; |
| 23 | + // The bot's display name |
| 24 | + string display_name = 2; |
| 25 | + // The bot's avatar URL |
| 26 | + string avatar_url = 3; |
| 27 | + // The bot's invite code, if it has one |
| 28 | + optional string invite = 4; |
| 29 | +} |
| 30 | + |
| 31 | +// Request type for MyBots |
| 32 | +message MyBotsRequest {} |
| 33 | +// Response type for MyBots |
| 34 | +message MyBotsResponse { |
| 35 | + // The list of owned bots |
| 36 | + repeated Bot bots = 1; |
| 37 | +} |
| 38 | + |
| 39 | +// Request type for CreateBot |
| 40 | +message CreateBotRequest { |
| 41 | + // The bot's display name |
| 42 | + string display_name = 1; |
| 43 | + // The bot's avatar URL |
| 44 | + optional string avatar_url = 2; |
| 45 | + // The bot's invite code, if it has one |
| 46 | + optional string invite = 3; |
| 47 | +} |
| 48 | +// Response type for CreateBot |
| 49 | +message CreateBotResponse { |
| 50 | + // The newly minted ID of the bot |
| 51 | + uint64 bot_id = 1; |
| 52 | +} |
| 53 | + |
| 54 | +// Request type for EditBot |
| 55 | +message EditBotRequest { |
| 56 | + // The ID of the bot to edit |
| 57 | + uint64 bot_id = 1; |
| 58 | + // The bot's new display name |
| 59 | + optional string new_display_name = 2; |
| 60 | + // The bot's new avatar URL |
| 61 | + optional string new_avatar_url = 3; |
| 62 | + // The bot's new invite code |
| 63 | + optional string invite = 4; |
| 64 | +} |
| 65 | +// Response type for EditBot |
| 66 | +message EditBotResponse {} |
| 67 | + |
| 68 | +// Request type for DeleteBot |
| 69 | +message DeleteBotRequest { |
| 70 | + // The bot to delete |
| 71 | + uint64 bot_id = 1; |
| 72 | +} |
| 73 | +// Response type for DeleteBot |
| 74 | +message DeleteBotResponse {} |
| 75 | + |
| 76 | +// Request type for GetBot |
| 77 | +message GetBotRequest { |
| 78 | + // The bot to get the information of |
| 79 | + uint64 bot_id = 1; |
| 80 | +} |
| 81 | +// Response type for GetBot |
| 82 | +message GetBotResponse { |
| 83 | + // The requested bot |
| 84 | + Bot bot = 1; |
| 85 | +} |
| 86 | + |
| 87 | +// Request type for Policies |
| 88 | +message PoliciesRequest {} |
| 89 | +// Response type for Policies |
| 90 | +message PoliciesResponse { |
| 91 | + // How many bots an individual account is allowed to own |
| 92 | + uint32 max_bots = 1; |
| 93 | +} |
| 94 | + |
| 95 | +// Request type for AddBot |
| 96 | +message AddBotRequest { |
| 97 | + // The guild to add the bot to |
| 98 | + uint64 guild_id = 1; |
| 99 | + // The bot's invite code. |
| 100 | + string invite_code = 2; |
| 101 | +} |
| 102 | +// Response type for AddBot |
| 103 | +message AddBotResponse {} |
| 104 | + |
| 105 | +// The Bots service allows the management of bot accounts |
| 106 | +service BotsService { |
| 107 | + // Gets the list of bots that you own |
| 108 | + rpc MyBots(MyBotsRequest) returns (MyBotsResponse); |
| 109 | + // Gets information on a given bot |
| 110 | + rpc GetBot(GetBotRequest) returns (GetBotResponse); |
| 111 | + // Creates a new bot account |
| 112 | + rpc CreateBot(CreateBotRequest) returns (CreateBotResponse); |
| 113 | + // Modifies a bot account that you own |
| 114 | + rpc EditBot(EditBotRequest) returns (EditBotResponse); |
| 115 | + // Deletes a bot account that you own |
| 116 | + rpc DeleteBot(DeleteBotRequest) returns (DeleteBotResponse); |
| 117 | + // Server policies for bot accounts that the client |
| 118 | + // may display in its UI or restrict actions to prevent |
| 119 | + // request errors |
| 120 | + rpc Policies(PoliciesRequest) returns (PoliciesResponse); |
| 121 | + // The request to add a bot. |
| 122 | + rpc AddBot(AddBotRequest) returns (AddBotResponse); |
| 123 | +}; |
0 commit comments