diff --git a/maubot.yaml b/maubot.yaml index 1f023cf89bebe203b2d23642c2019b0373e1487a..5d42085b7da1dd3e8025dee90a885b940d0d0c0b 100644 --- a/maubot.yaml +++ b/maubot.yaml @@ -5,7 +5,7 @@ maubot: 0.1.0 id: ch.ethz.phys.rt # A PEP 440 compliant version string. -version: 0.3.2 +version: 0.3.3 # The SPDX license identifier for the plugin. https://spdx.org/licenses/ # Optional, assumes all rights reserved if omitted. diff --git a/rt.py b/rt.py index 4ca64f989aedbb6ae0f032d963388c4de3581444..95e16bb3974aab75f73a18a624652a7bd2bbd140 100755 --- a/rt.py +++ b/rt.py @@ -363,6 +363,21 @@ class RT(Plugin): f'took {self.html_link(number)} ðŸ‘ï¸') await evt.respond(content) + @rt.subcommand('disown', aliases=('di', 'dis'), help='Disown a ticket.') + @command.argument('number', 'ticket number', parser=str) + async def take(self, evt: MessageEvent, number: str) -> None: + if not self.can_manage(evt) or not self.valid_number(number): + return + await evt.mark_read() + displayname = await self._displayname(evt.room_id, evt.sender) + await self._edit(number, {'Owner': 'Nobody'}) + content = TextMessageEventContent( + msgtype=MessageType.NOTICE, format=Format.HTML, + body=f'{displayname} disowned rt#{number} 👎ï¸', + formatted_body=f'<a href="https://matrix.to/#/{evt.sender}">{evt.sender}</a> ' + f'disowned {self.html_link(number)} 👎ï¸') + await evt.respond(content) + @rt.subcommand('give', aliases=('g', 'gi', 'assign'), help='Give the ticket to somebody.') @command.argument('number', 'ticket number', parser=str) @command.argument('user', 'matrix user', parser=str)