SignalAPI: improve error messages
This commit is contained in:
parent
6fa7cf5766
commit
acb8ae2847
6
main.py
6
main.py
@ -166,7 +166,7 @@ class SignalAPI:
|
|||||||
if r.status_code == 204:
|
if r.status_code == 204:
|
||||||
return Ok(None)
|
return Ok(None)
|
||||||
else:
|
else:
|
||||||
return Err(r.json().error)
|
return Err(r.json()['error'])
|
||||||
|
|
||||||
def remove_group_admins(self, group_id: str, admins: List[str]) -> Result[None, str]:
|
def remove_group_admins(self, group_id: str, admins: List[str]) -> Result[None, str]:
|
||||||
r = requests.delete(f"{self.apiurl}/v1/groups/{self.number}/{group_id}/admins", json={"admins": admins})
|
r = requests.delete(f"{self.apiurl}/v1/groups/{self.number}/{group_id}/admins", json={"admins": admins})
|
||||||
@ -174,7 +174,7 @@ class SignalAPI:
|
|||||||
if r.status_code == 204:
|
if r.status_code == 204:
|
||||||
return Ok(None)
|
return Ok(None)
|
||||||
else:
|
else:
|
||||||
return Err(r.json().error)
|
return Err(r.json()['error'])
|
||||||
|
|
||||||
def update_group_admins(self, group_id: str, other_admins: List[str], remove: bool = True) -> Result[Changes[str], str]:
|
def update_group_admins(self, group_id: str, other_admins: List[str], remove: bool = True) -> Result[Changes[str], str]:
|
||||||
# Add and remove admins from the group, such that the only remaining
|
# Add and remove admins from the group, such that the only remaining
|
||||||
@ -233,7 +233,7 @@ class SignalAPI:
|
|||||||
if r.status_code == 201:
|
if r.status_code == 201:
|
||||||
return parse_response(SendMessageResponse, r.text)
|
return parse_response(SendMessageResponse, r.text)
|
||||||
else:
|
else:
|
||||||
return Err("Failed to send message")
|
return Err(r.json()['error'])
|
||||||
|
|
||||||
|
|
||||||
class LabCleaningBot:
|
class LabCleaningBot:
|
||||||
|
Loading…
Reference in New Issue
Block a user