Mattermost¶
module/mattermost_bot.py¶
module.mattermost_bot ¶
MattermostBot
MattermostBot ¶
Bases: Session
MattermostBot
Parameters:
Name | Type | Description | Default |
---|---|---|---|
token |
str
|
API token. |
required |
base_url |
str
|
API base url. |
required |
log_name |
str
|
Log name. |
'MattermostBot'
|
Note
The headers
will update the Authorization
in Bearer {self.token}
.
Source code in module/mattermost_bot.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
|
create_a_direct_message ¶
Create a direct messge
Parameters:
Name | Type | Description | Default |
---|---|---|---|
users |
list | tuple
|
Two uids in list or tuple. |
required |
Returns:
Type | Description |
---|---|
Response
|
Return the requests.Response object. |
Source code in module/mattermost_bot.py
del_deactivate_user ¶
Deactivate user account
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uid |
str
|
User id. |
required |
Returns:
Type | Description |
---|---|
Response
|
Return the requests.Response object. |
get_posts_from_channel ¶
Get post from channel
Parameters:
Name | Type | Description | Default |
---|---|---|---|
channel_id |
str
|
Channel id. |
required |
Returns:
Type | Description |
---|---|
Response
|
Return the requests.Response object. |
Source code in module/mattermost_bot.py
get_user_by_username ¶
Get user by username
Parameters:
Name | Type | Description | Default |
---|---|---|---|
username |
str
|
Username. |
required |
Returns:
Type | Description |
---|---|
Response
|
Return the requests.Response object. |
Source code in module/mattermost_bot.py
get_users ¶
Get users
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page |
int
|
Page. |
required |
per_page |
int
|
Numbers per page. |
200
|
Returns:
Type | Description |
---|---|
Response
|
Return the requests.Response object. |
Source code in module/mattermost_bot.py
get_users_loop ¶
Get users in loop
Parameters:
Name | Type | Description | Default |
---|---|---|---|
per_page |
int
|
Numbers per page. |
200
|
Yields:
Type | Description |
---|---|
dict[str, Any]
|
Yield the user's info. |
Source code in module/mattermost_bot.py
get_users_stats ¶
log_rate_limit ¶
Get log info from headers
Parameters:
Name | Type | Description | Default |
---|---|---|---|
headers |
dict
|
required |
Source code in module/mattermost_bot.py
post_invite_by_email ¶
Post an invite by email
Parameters:
Name | Type | Description | Default |
---|---|---|---|
team_id |
str
|
Team id. |
required |
emails |
list
|
Email addresses. |
required |
Returns:
Type | Description |
---|---|
Response
|
Return the requests.Response object. |
Source code in module/mattermost_bot.py
post_invite_guests_by_email ¶
post_invite_guests_by_email(
team_id: str,
emails: list[str],
channels: list[str],
message: Optional[str] = None,
) -> Response
Post an invite to guest by email
Parameters:
Name | Type | Description | Default |
---|---|---|---|
team_id |
str
|
Team id. |
required |
emails |
list
|
Email addresses. |
required |
channels |
list
|
Channel ids. |
required |
message |
str
|
Messages. |
None
|
Returns:
Type | Description |
---|---|
Response
|
Return the requests.Response object. |
Source code in module/mattermost_bot.py
post_revoke_all_sessions_for_a_user ¶
Revoke all sessions for a user
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uid |
str
|
User id. |
required |
Returns:
Type | Description |
---|---|
Response
|
Return the requests.Response object. |
Source code in module/mattermost_bot.py
post_user_to_channel ¶
Post user to channel
Parameters:
Name | Type | Description | Default |
---|---|---|---|
channel_id |
str
|
Channel id. |
required |
uid |
str
|
User id. |
required |
Returns:
Type | Description |
---|---|
Response
|
Return the requests.Response object. |
Source code in module/mattermost_bot.py
posts ¶
Posts message
Parameters:
Name | Type | Description | Default |
---|---|---|---|
channel_id |
str
|
Channel id. |
required |
message |
str
|
Messages. |
required |
Returns:
Type | Description |
---|---|
Response
|
Return the requests.Response object. |
Source code in module/mattermost_bot.py
put_users_patch ¶
Update user
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uid |
str
|
User id. |
required |
position |
str
|
Position title. |
required |
Returns:
Type | Description |
---|---|
Response
|
Return the requests.Response object. |
Source code in module/mattermost_bot.py
MattermostTools ¶
Bases: MattermostBot
MattermostTools for more implement in operation
Parameters:
Name | Type | Description | Default |
---|---|---|---|
token |
str
|
API token. |
required |
base_url |
str
|
The API base url. |
required |
Source code in module/mattermost_bot.py
find_possible_mid
staticmethod
¶
Find any possible mattermost user id
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uid |
str
|
User id. |
required |
mail |
str
|
User email address. |
None
|
Returns:
Type | Description |
---|---|
str
|
Return the user's mattermost id or |
Source code in module/mattermost_bot.py
find_user_name
staticmethod
¶
Find user_name by mid
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mid |
str
|
Mattermost user id. |
required |
Returns:
Type | Description |
---|---|
str
|
Return the user's mattermost user name or |
Source code in module/mattermost_bot.py
module/mattermost_link.py¶
module.mattermost_link ¶
MattermostLink
MattermostLink ¶
MattermostLink
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uid |
str
|
User id. |
required |
Source code in module/mattermost_link.py
reset
staticmethod
¶
verify_save
classmethod
¶
verify and save data
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
dict
|
Check the |
required |
Returns:
Type | Description |
---|---|
bool
|
|