Added media removal
This commit is contained in:
@@ -208,10 +208,28 @@ async def find_pic(
|
||||
async def move_pic(id: str, token: Union[str, None] = None) -> bool:
|
||||
token = await authorize() if token is None else token
|
||||
try:
|
||||
await http_session.patch(
|
||||
response = await http_session.patch(
|
||||
f'{configGet("address", "posting", "api")}/photos/{id}?caption=sent',
|
||||
headers={"Authorization": f"Bearer {token}"},
|
||||
)
|
||||
if response.status != 200:
|
||||
logWrite(f"Media moving failed with HTTP {response.status}", debug=True)
|
||||
return False
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
|
||||
|
||||
async def remove_pic(id: str, token: Union[str, None] = None) -> bool:
|
||||
token = await authorize() if token is None else token
|
||||
try:
|
||||
response = await http_session.delete(
|
||||
f'{configGet("address", "posting", "api")}/photos/{id}',
|
||||
headers={"Authorization": f"Bearer {token}"},
|
||||
)
|
||||
if response.status != 204:
|
||||
logWrite(f"Media removal failed with HTTP {response.status}", debug=True)
|
||||
return False
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
|
Reference in New Issue
Block a user