cli (message/retract): message retractation command:
rel 367
This commit is contained in:
parent
bfd9168449
commit
a44acbc1bb
1 changed files with 28 additions and 1 deletions
|
|
@ -187,6 +187,33 @@ class Send(base.CommandBase):
|
|||
await self.sendStdin(jid_)
|
||||
|
||||
|
||||
class Retract(base.CommandBase):
|
||||
|
||||
def __init__(self, host):
|
||||
super().__init__(host, "retract", help=_("retract a message"))
|
||||
|
||||
def add_parser_options(self):
|
||||
self.parser.add_argument(
|
||||
"message_id",
|
||||
help=_("ID of the message (internal ID)")
|
||||
)
|
||||
|
||||
async def start(self):
|
||||
try:
|
||||
await self.host.bridge.messRetract(
|
||||
self.args.message_id,
|
||||
self.profile
|
||||
)
|
||||
except Exception as e:
|
||||
self.disp(f"can't retract message: {e}", error=True)
|
||||
self.host.quit(C.EXIT_BRIDGE_ERRBACK)
|
||||
else:
|
||||
self.disp(
|
||||
"message retraction has been requested, please note that this is a "
|
||||
"request which can't be enforced (see documentation for details).")
|
||||
self.host.quit(C.EXIT_OK)
|
||||
|
||||
|
||||
class MAM(base.CommandBase):
|
||||
|
||||
def __init__(self, host):
|
||||
|
|
@ -269,7 +296,7 @@ class MAM(base.CommandBase):
|
|||
|
||||
|
||||
class Message(base.CommandBase):
|
||||
subcommands = (Send, MAM)
|
||||
subcommands = (Send, Retract, MAM)
|
||||
|
||||
def __init__(self, host):
|
||||
super(Message, self).__init__(
|
||||
|
|
|
|||
Loading…
Reference in a new issue