mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
parent
3f315df6c8
commit
23845eab47
6 changed files with 228 additions and 0 deletions
|
@ -0,0 +1,36 @@
|
|||
package org.asamk.signal.commands;
|
||||
|
||||
import net.sourceforge.argparse4j.inf.Namespace;
|
||||
import net.sourceforge.argparse4j.inf.Subparser;
|
||||
|
||||
import org.asamk.signal.StickerPackInvalidException;
|
||||
import org.asamk.signal.manager.Manager;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class UploadStickerPackCommand implements LocalCommand {
|
||||
|
||||
@Override
|
||||
public void attachToSubparser(final Subparser subparser) {
|
||||
subparser.addArgument("path")
|
||||
.help("The path of the manifest.json or a zip file containing the sticker pack you wish to upload.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int handleCommand(final Namespace ns, final Manager m) {
|
||||
try {
|
||||
String path = ns.getString("path");
|
||||
String url = m.uploadStickerPack(path);
|
||||
System.out.println("");
|
||||
System.out.println("Upload complete! Sticker pack URL:");
|
||||
System.out.println(url);
|
||||
return 0;
|
||||
} catch (IOException e) {
|
||||
System.err.println("Upload error: " + e.getMessage());
|
||||
return 3;
|
||||
} catch (StickerPackInvalidException e) {
|
||||
System.err.println("Invalid sticker pack: " + e.getMessage());
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue