From 1f2e39f1a0667a3aae1668f3a4d0bdfbac479040 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Tue, 10 Dec 2019 13:21:49 +0100 Subject: [PATCH] emoji improvements --- .idea/.idea.tgcli/.idea/contentModel.xml | 1 - .idea/.idea.tgcli/.idea/workspace.xml | 4 +++- telegram/Util.cs | 6 +++++- telegram/tgcli.cs | 10 +++++----- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.idea/.idea.tgcli/.idea/contentModel.xml b/.idea/.idea.tgcli/.idea/contentModel.xml index 94b1955..c6998b5 100644 --- a/.idea/.idea.tgcli/.idea/contentModel.xml +++ b/.idea/.idea.tgcli/.idea/contentModel.xml @@ -1122,7 +1122,6 @@ - diff --git a/.idea/.idea.tgcli/.idea/workspace.xml b/.idea/.idea.tgcli/.idea/workspace.xml index f2c8275..a502d9d 100644 --- a/.idea/.idea.tgcli/.idea/workspace.xml +++ b/.idea/.idea.tgcli/.idea/workspace.xml @@ -2,7 +2,9 @@ + + diff --git a/telegram/Util.cs b/telegram/Util.cs index 3ad317a..94809e9 100644 --- a/telegram/Util.cs +++ b/telegram/Util.cs @@ -142,7 +142,11 @@ namespace telegram { if (string.IsNullOrWhiteSpace(message)) return; - message = message.Replace("⏎", "\n"); + message = message.Replace("⏎", "\n") + .Replace(":xd:", "😂") + .Replace(":shrug:", "🤷") + .Replace(":shrugf:", "🤷‍♀️") + .Replace(":shrugm:", "🤷‍♂️"); client.ExecuteAsync(new SendMessage { ChatId = chatId, diff --git a/telegram/tgcli.cs b/telegram/tgcli.cs index 086e509..bb19466 100644 --- a/telegram/tgcli.cs +++ b/telegram/tgcli.cs @@ -13,7 +13,8 @@ namespace telegram * TODO: * reply to x messages ago * cap length & truncate extremely long chat names! - * make emojis not break terminal -> :shrug: and stuff + * replace emoji on send & un-replace on edit, two-way dictionary!! + * replace more emojis on send (is there a lib for that) * make typing newlines actually good (inputline as list?) * fix history not fully displaying on channel open (query returning less results than expected?) * waaay more error messages instead of just doing nothing @@ -320,7 +321,6 @@ namespace telegram if (!specialKeys.Contains(key.Key)) { currentInputLine += key.KeyChar; - //TODO currentInputLine = currentInputLine.Replace(":xd:", "😂"); ScreenUpdate(); } @@ -415,8 +415,8 @@ namespace telegram var prefix = $"{Ansi.Bold}{Ansi.Green}[{time}] {Ansi.Cyan}{chat.Title} " + $"{(isPrivate || isChannel ? "" : $"{Ansi.Yellow}{username} ")}"; var indent = new string(' ', getActualStringWidth(prefix)); - //var furtherIndent = new string(' ', getActualStringWidth("»»» ")); - var furtherIndent = $"{(msg.IsOutgoing ? $"{Ansi.Blue}»»»" : $"{Ansi.Magenta}«««")} "; + var furtherIndent = new string(' ', getActualStringWidth("»»» ")); + var arrows = $"{(msg.IsOutgoing ? $"{Ansi.Blue}»»»" : $"{Ansi.Magenta}«««")} "; if (isReply && cascade) { @@ -445,7 +445,7 @@ namespace telegram finalOutput += "\n" + indent + lines.First(); lines.RemoveAt(0); } - lines.ForEach(l => finalOutput += "\n" + indent + furtherIndent + l); + lines.ForEach(l => finalOutput += "\n" + indent + arrows + l); return finalOutput; }