emoji refactor
This commit is contained in:
parent
f0fb725e02
commit
f4eee05ce6
|
@ -545,6 +545,7 @@ namespace telegram
|
|||
if (inputParams.Count == 0)
|
||||
{
|
||||
currentInputLine = "/e " + ((TdApi.MessageContent.MessageText) lastMessage?.Content)?.Text?.Text;
|
||||
Emojis.ForEach(em => currentInputLine = currentInputLine.Replace(em.Item2, em.Item1));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -194,10 +194,7 @@ namespace telegram
|
|||
|
||||
public static void ClearCurrentConsoleLine()
|
||||
{
|
||||
do
|
||||
{
|
||||
Console.Write("\b \b");
|
||||
} while (Console.CursorLeft > 0);
|
||||
Console.Write("\u001b[2K\r");
|
||||
//TODO is there a better solution?
|
||||
|
||||
//Console.SetCursorPosition(0, Console.WindowHeight);
|
||||
|
@ -238,14 +235,7 @@ namespace telegram
|
|||
{
|
||||
if (string.IsNullOrWhiteSpace(message))
|
||||
return;
|
||||
message = message.Replace("⏎", "\n")
|
||||
.Replace(":xd:", Emoji.FaceWithTearsOfJoy.Sequence.AsString)
|
||||
.Replace(":check:", Emoji.WhiteHeavyCheckMark.Sequence.AsString)
|
||||
.Replace(":thinking:", Emoji.ThinkingFace.Sequence.AsString)
|
||||
.Replace(":heart:", Emoji.RedHeart.Sequence.AsString)
|
||||
.Replace(":shrug:", Emoji.PersonShrugging.Sequence.AsString)
|
||||
.Replace(":shrugf:", Emoji.WomanShrugging.Sequence.AsString)
|
||||
.Replace(":shrugm:", Emoji.ManShrugging.Sequence.AsString);
|
||||
Emojis.ForEach(em => message = message.Replace(em.Item1, em.Item2));
|
||||
client.ExecuteAsync(new SendMessage
|
||||
{
|
||||
ChatId = chatId,
|
||||
|
@ -263,6 +253,8 @@ namespace telegram
|
|||
|
||||
public static Message EditMessage(string newText, Message message)
|
||||
{
|
||||
Emojis.ForEach(em => newText = newText.Replace(em.Item1, em.Item2));
|
||||
|
||||
var msg = client.ExecuteAsync(new EditMessageText
|
||||
{
|
||||
ChatId = message.ChatId,
|
||||
|
@ -403,6 +395,19 @@ namespace telegram
|
|||
return input.Length <= maxLen ? input : "<" + input.Substring(input.Length - maxLen + 1);
|
||||
}
|
||||
|
||||
public static readonly List<Tuple<string, string>> Emojis = new List<Tuple<string, string>>
|
||||
{
|
||||
new Tuple<string, string>("⏎", "\n"),
|
||||
new Tuple<string, string>(":xd:", Emoji.FaceWithTearsOfJoy.Sequence.AsString),
|
||||
new Tuple<string, string>(":check:", Emoji.WhiteHeavyCheckMark.Sequence.AsString),
|
||||
new Tuple<string, string>(":thinking:", Emoji.ThinkingFace.Sequence.AsString),
|
||||
new Tuple<string, string>(":eyes:", Emoji.Eyes.Sequence.AsString),
|
||||
new Tuple<string, string>(":heart:", Emoji.RedHeart.Sequence.AsString),
|
||||
new Tuple<string, string>(":shrug:", Emoji.PersonShrugging.Sequence.AsString),
|
||||
new Tuple<string, string>(":shrugf:", Emoji.WomanShrugging.Sequence.AsString),
|
||||
new Tuple<string, string>(":shrugm:", Emoji.ManShrugging.Sequence.AsString)
|
||||
};
|
||||
|
||||
public static readonly List<ConsoleKey> SpecialKeys = new List<ConsoleKey>
|
||||
{
|
||||
ConsoleKey.Backspace,
|
||||
|
|
|
@ -14,7 +14,6 @@ namespace telegram
|
|||
{
|
||||
/*
|
||||
* TODO:
|
||||
* replace emoji on send & un-replace on edit, two-way dictionary!!
|
||||
* waaay more error messages instead of just doing nothing or crashing (search for "do something")
|
||||
* add option to disable terminal bell
|
||||
* make commands & keybinds more consistent (maybe configurable?)
|
||||
|
|
Loading…
Reference in a new issue