/// <summary> /// Replaces all instances of all registered emotes passing the provided /// <see cref="EmoteFilterDelegate"/> with their designated /// <see cref="MessageEmote.ReplacementString"/>s /// </summary> /// <param name="originalMessage"> /// The original message which needs to be processed for emotes. /// </param> /// <param name="del"> /// An <see cref="EmoteFilterDelegate"/> which returns true if its /// received <see cref="MessageEmote"/> is to be replaced. /// Defaults to <see cref="CurrentEmoteFilter"/>. /// </param> /// <returns> /// A string where all of the original emote text has been replaced with /// its designated <see cref="MessageEmote.ReplacementString"/>s /// </returns> public string ReplaceEmotes(string originalMessage, EmoteFilterDelegate del = null) { if (CurrentRegex == null) { return(originalMessage); } if (del != null && del != CurrentEmoteFilter) { CurrentEmoteFilter = del; } string newMessage = CurrentRegex.Replace(originalMessage, GetReplacementString); CurrentEmoteFilter = _preferredFilter; return(newMessage); }
/// <summary> /// Constructor which specifies a particular preferred <see cref="EmoteFilterDelegate"/> /// </summary> /// <param name="preferredFilter"></param> public MessageEmoteCollection(EmoteFilterDelegate preferredFilter) : this() { _preferredFilter = preferredFilter; }
/// <summary> /// Default, empty constructor initializes the list and sets the preferred /// <see cref="EmoteFilterDelegate"/> to <see cref="AllInclusiveEmoteFilter(MessageEmote)"/> /// </summary> public MessageEmoteCollection() { _emoteList = new SortedList <string, MessageEmote>(); _preferredFilter = AllInclusiveEmoteFilter; }