|
| 1 | +# Low Level docs for sogs bot api |
| 2 | + |
| 3 | +For a high level bot framework in python see [soggy](soggy.md) |
| 4 | + |
| 5 | +zmq commands: |
| 6 | + |
| 7 | +* [sogs.sub](#sub) |
| 8 | +* [sogs.unsub](#unsub) |
| 9 | + |
| 10 | +* [sogs.user.info](#user-info) |
| 11 | +* [sogs.user.send](#user-send) |
| 12 | +* [sogs.user.perm](#user-perm) |
| 13 | +* [sogs.user.ban](#user-ban) |
| 14 | +* [sogs.user.unban](#user-unban) |
| 15 | + |
| 16 | +* [sogs.room.info](#room-info) |
| 17 | +* [sogs.room.send](#room-send) |
| 18 | +* [sogs.room.perm](#room-perm) |
| 19 | + |
| 20 | +* [sogs.file.info](#file-info) |
| 21 | +* [sogs.file.upload](#file-upload) |
| 22 | +* [sogs.file.del](#file-del) |
| 23 | +* [sogs.file.ban](#file-ban) |
| 24 | +* [sogs.file.unban](#file-ban) |
| 25 | + |
| 26 | + |
| 27 | +# Objects |
| 28 | + |
| 29 | +## UserInfo |
| 30 | + |
| 31 | +a dict containing info on a user |
| 32 | + |
| 33 | +* id - the integer id for this user |
| 34 | +* pubkey - the user's 32 byte public x25519 key, session id is 0x05 then the pubkey bytes all hex encoded |
| 35 | +* names - a dict of room token as key and displayed name in that room |
| 36 | +* mod - if the user is a moderator positive non zero otherwise zero |
| 37 | + |
| 38 | +## RoomInfo |
| 39 | + |
| 40 | +a dict containing info on a room |
| 41 | + |
| 42 | +* id - the integer id for this room |
| 43 | +* token - the name of this room used in the url |
| 44 | +* users - a list of UserInfo of all the users in the room (optional) |
| 45 | + |
| 46 | +## FileInfo |
| 47 | + |
| 48 | +a dict describing a file |
| 49 | + |
| 50 | +* id - internal id for referring to this file |
| 51 | +* public-url - a public url to fetch the file at |
| 52 | +* size - the size of this file in bytes |
| 53 | +* mimetype - the implied mimetpye of this file |
| 54 | +* uploaded - the time this file was uploaded at in milliseconds since unix epoch |
| 55 | +* hashes - a dict of hash algorithm name to the digest value of the file with that algorithm (currently supported algorithms: blake2 / sha2-256 / sha1 / md5 ) |
| 56 | +* user - the user id of who uploaded this file |
| 57 | + |
| 58 | +## PostInfo |
| 59 | + |
| 60 | +a dict describing a post made to a room |
| 61 | + |
| 62 | +* id - the post's id |
| 63 | +* user - the id of the user that posted the message |
| 64 | +* room - the id of the room that the message was posted in |
| 65 | +* when - the time this message was recieved in the room as milliseconds since unix epoch |
| 66 | +* text - the plaintext body of the message as a string |
| 67 | +* files - a list of file ids this message uploaded files with (optional) |
| 68 | +* cites - a post id this post is citing (optional) |
| 69 | + |
| 70 | + |
| 71 | +# Events |
| 72 | + |
| 73 | +## message |
| 74 | + |
| 75 | +sent when a user posts a message to a room |
| 76 | + |
| 77 | +contains a PostInfo, a UserInfo and a RoomInfo |
| 78 | + |
| 79 | +## joined |
| 80 | + |
| 81 | +sent when a user joins a room |
| 82 | + |
| 83 | +provides a UserInfo and a RoomInfo |
| 84 | + |
| 85 | +## banned |
| 86 | + |
| 87 | +sent when a user is banned from a room or the entire server |
| 88 | + |
| 89 | +## unbanned |
| 90 | + |
| 91 | +like banned but for when unbanned |
| 92 | + |
| 93 | +## uploaded |
| 94 | + |
| 95 | +sent when a file is uploaded to sogs |
| 96 | + |
| 97 | +contains one or more FileInfos |
| 98 | + |
| 99 | +## deleted |
| 100 | + |
| 101 | +sent when a post or file is deleted |
| 102 | + |
| 103 | +contains one or more PostInfos |
| 104 | + |
| 105 | +# Commands |
| 106 | + |
| 107 | +## sogs.sub <span id="sub" /> |
| 108 | + |
| 109 | +subscribe to events |
| 110 | + |
| 111 | +## sogs.unsub <span id="unsub" /> |
| 112 | + |
| 113 | +unsubscribe to events |
| 114 | + |
| 115 | +## sogs.user.info <span id="user-info" /> |
| 116 | + |
| 117 | +fetch info of a user |
| 118 | + |
| 119 | +## sogs.user.send <span id="user-send" /> |
| 120 | + |
| 121 | +send a whisper to a user |
| 122 | + |
| 123 | +## sogs.user.perm <span id="user-perm" /> |
| 124 | + |
| 125 | +get/set user permissions (read/write/upload) |
| 126 | + |
| 127 | +## sogs.user.ban <span id="user-ban" /> |
| 128 | + |
| 129 | +ban user |
| 130 | + |
| 131 | +## sogs.user.unban <span id="user-unban" /> |
| 132 | + |
| 133 | +unban user |
| 134 | + |
| 135 | +## sogs.room.info <span id="room-info" /> |
| 136 | + |
| 137 | +get/set room info |
| 138 | + |
| 139 | +## sogs.room.send <span id="room-send" /> |
| 140 | + |
| 141 | +send a message to the room |
| 142 | + |
| 143 | +## sogs.room.perm <span id="room-perm" /> |
| 144 | + |
| 145 | +get/set room permissions (read/write/upload) |
| 146 | + |
| 147 | +## sogs.file.info <span id="file-info" /> |
| 148 | + |
| 149 | +get uploaded file info |
| 150 | + |
| 151 | +## sogs.file.upload <span id="file-upload" /> |
| 152 | + |
| 153 | +upload a file |
| 154 | + |
| 155 | +## sogs.file.del <span id="file-del" /> |
| 156 | + |
| 157 | +delete a file |
| 158 | + |
| 159 | +## sogs.file.ban <span id="file-ban" /> |
| 160 | + |
| 161 | +ban file uploads by mimetype/hash/etc optionally per room |
| 162 | + |
| 163 | +## sogs.file.unban <span id="file-unban" /> |
| 164 | + |
| 165 | +unban uploads by mimetype/hash/etc optionally per room |
0 commit comments