mirror of
https://gitea.phreedom.club/localhost_frssoft/FMN_bot.git
synced 2025-07-27 03:54:16 +00:00
Changes:
* Имплементация fail limit * Добавлен api endpoit mute * Изменения в конфигурации и уточнения
This commit is contained in:
parent
aee5d2a9c9
commit
cc2993e59c
4 changed files with 55 additions and 16 deletions
|
@ -1,6 +1,9 @@
|
|||
from config import instance
|
||||
import json
|
||||
import requests
|
||||
from config import instance
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger('fedi_api')
|
||||
|
||||
instance_point = f"https://{instance}/api/v1"
|
||||
|
||||
|
@ -67,4 +70,14 @@ def upload_attachment(file_path):
|
|||
r = requests.post(instance_point + "/media", params, files=file, headers=headers)
|
||||
return r.json()['id']
|
||||
|
||||
|
||||
|
||||
def mute_user(acct_id=str, acct=str, duration=None):
|
||||
params = {
|
||||
"duration": duration
|
||||
}
|
||||
r = requests.post(instance_point + '/accounts' + f"/{acct_id}/mute", params, headers=headers)
|
||||
if r.status_code == 200:
|
||||
logger.info(f'Пользователь {acct} был заглушен на {duration} secs')
|
||||
else:
|
||||
logger.error(f'Ошибка глушения {r.status_code} - {acct}')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue