homes/desktop/.local/share/poezio/plugins/mirror.py
kujiu (@uberwald) 8ca6287fb1
Update all tools
-> Passwords in KeePassXC (access by keyring)
-> Neomutt + Aerc (mail)
-> vdirsyncer + khal + khard (calendar and contacts)
zsh -> fish
-> poezio (XMPP)
-> newsboat (RSS with FreshRSS)
-> toot (Mastodon client)
vim -> neovim (with lunarvim)
-> nvimpager (pager based on neovim)
-> konsole

With Nightfox theme.
2023-09-02 00:40:34 +02:00

33 lines
911 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""
Repeats the last message in the conversation.
Command
-------
.. glossary::
/mirror
**Usage:** ``/mirror``
"""
from poezio.plugin import BasePlugin
from poezio import tabs
class Plugin(BasePlugin):
def init(self):
for tab_type in (tabs.MucTab, tabs.PrivateTab, tabs.DynamicConversationTab, tabs.StaticConversationTab):
self.api.add_tab_command(
tab_type,
'mirror',
handler=self.mirror,
help='Repeat the last message from the conversation.',
short='Repeat the last message from the conversation.')
def mirror(self, args):
messages = self.api.get_conversation_messages()
if not messages:
# Do nothing if the conversation doesnt contain any message
return
last_message = messages[-1]
self.api.send_message(last_message.txt)