primitivus (chat) Q&D way to see attachments
This commit is contained in:
parent
65dd411a2b
commit
bd490c1d19
1 changed files with 15 additions and 0 deletions
|
|
@ -18,6 +18,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from functools import total_ordering
|
||||
from pathlib import Path
|
||||
import bisect
|
||||
import urwid
|
||||
from urwid_satext import sat_widgets
|
||||
|
|
@ -442,6 +443,20 @@ class Chat(PrimitivusWidget, quick_chat.QuickChat):
|
|||
False is generally used when printing history, when we don't want every
|
||||
message to be notified.
|
||||
"""
|
||||
if message.attachments:
|
||||
# FIXME: Q&D way to see attachments in Primitivus
|
||||
# it should be done in a more user friendly way
|
||||
for lang, body in message.message.items():
|
||||
for attachment in message.attachments:
|
||||
if 'url' in attachment:
|
||||
body+=f"\n{attachment['url']}"
|
||||
elif 'path' in attachment:
|
||||
path = Path(attachment['path'])
|
||||
body+=f"\n{path.as_uri()}"
|
||||
else:
|
||||
log.warning(f'No "url" nor "path" in attachment: {attachment}')
|
||||
message.message[lang] = body
|
||||
|
||||
if self.filters:
|
||||
if not all([f(message) for f in self.filters]):
|
||||
return
|
||||
|
|
|
|||
Loading…
Reference in a new issue