*
* @param string $user
* @return stdClass|array|bool
- * @throws Exception
*/
public function add(string $name, string $type, string $duration, string $reason): stdClass|array|bool
{
- return $this->connection->query('server_ban.add', [
+ $response = $this->connection->query('server_ban.add', [
'name' => $name,
'type' => $type,
'reason' => $reason,
'duration_string' => $duration ?? '1d',
]);
+
+ if (is_bool($response))
+ return false;
+
+ if (property_exists($response, 'tkl'))
+ return $response->tkl;
+ return FALSE;
}
/**
*
* @param string $name
* @return stdClass|array|bool
- * @throws Exception
*/
public function delete(string $name, string $type): stdClass|array|bool
{
- return $this->connection->query('server_ban.del', [
+ $response = $this->connection->query('server_ban.del', [
'name' => $name,
'type' => $type,
]);
+
+ if (is_bool($response))
+ return false;
+
+ if (property_exists($response, 'tkl'))
+ return $response->tkl;
+ return FALSE;
}
/**
]);
if (!is_bool($response)) {
- return $response;
+ return $response->tkl;
}
- throw new Exception('Invalid JSON Response from UnrealIRCd RPC.');
+ return false; // didn't exist
}
}