implement Dbus stickerpack method (#740)

implement uploadStickerPack

update documentation
This commit is contained in:
John Freed 2021-09-26 08:59:38 +02:00 committed by GitHub
parent 982e887c9f
commit 1ca0e75ef1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 0 deletions

View file

@ -5,6 +5,7 @@ import org.asamk.signal.BaseConfig;
import org.asamk.signal.manager.AttachmentInvalidException;
import org.asamk.signal.manager.Manager;
import org.asamk.signal.manager.NotMasterDeviceException;
import org.asamk.signal.manager.StickerPackInvalidException;
import org.asamk.signal.manager.UntrustedIdentityException;
import org.asamk.signal.manager.api.Message;
import org.asamk.signal.manager.api.RecipientIdentifier;
@ -536,6 +537,18 @@ public class DbusSignalImpl implements Signal {
}
}
@Override
public String uploadStickerPack(String stickerPackPath) {
File path = new File(stickerPackPath);
try {
return m.uploadStickerPack(path).toString();
} catch (IOException e) {
throw new Error.Failure("Upload error (maybe image size is too large):" + e.getMessage());
} catch (StickerPackInvalidException e) {
throw new Error.Failure("Invalid sticker pack: " + e.getMessage());
}
}
private static void checkSendMessageResult(long timestamp, SendMessageResult result) throws DBusExecutionException {
var error = ErrorUtils.getErrorMessageFromSendMessageResult(result);