Exemplo n.º 1
0
 public static string ReplaceDiscordValues(string text, IBot bot, DateTime dt, SocketMessage Original = null)
 {
     text = Nursery.Utility.Messages.ReplaceGeneralValues(text, dt);
     // replace reply
     if (Original != null)
     {
         text = text.Replace("${reply}", Original.Author.Mention);
         text = text.Replace("${username}", Original.Author.Username);
         var nn = bot.GetNickName(Original.Author.Id.ToString());
         text = text.Replace("${nickname}", nn);
     }
     // replace username and nickname
     text = Regex.Replace(text, UserNameRegex, m => bot.GetUserName(m.Groups[1].Value));
     text = Regex.Replace(text, NickNameRegex, m => bot.GetNickName(m.Groups[1].Value));
     // replace announce or speak flag
     text = text.Replace("${announce}", bot.AnnounceLabel).Replace("${speak}", bot.SpeakLabel);
     return(text);
 }