1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-07-05 18:48:31 +00:00

Add hard-coded values for the emotes that use regular expressions rather than set strings for their tokens. All the smileys like :-) basically.

This commit is contained in:
SirStendec 2018-06-27 20:17:45 -04:00
parent 038270d232
commit 8befc8850b
3 changed files with 35 additions and 4 deletions

View file

@ -1,4 +1,9 @@
<div class="list-header">4.0.0-rc3<span>@440f1fb9360578cbde7b</span> <time datetime="2018-05-31">(2018-06-27)</time></div>
<div class="list-header">4.0.0-rc3.1<span>@662c50c7e3e4ac110441</span> <time datetime="2018-05-31">(2018-06-27)</time></div>
<ul class="chat-menu-content menu-side-padding">
<li>Fixed: Display smileys like <code>:-)</code> correctly as emotes in locally echoed messages.</li>
</ul>
<div class="list-header">4.0.0-rc3<span>@f48b64e778d576602925</span> <time datetime="2018-05-31">(2018-06-27)</time></div>
<ul class="chat-menu-content menu-side-padding">
<li>Added: Display a warning if filter terms are invalid or potentially complex.</li>
<li>Changed: Separate <code>Regex</code> and <code>Regex (Word)</code> term modes to allow matching regular expressions without your expression being wrapped in separators.</li>

View file

@ -100,7 +100,7 @@ class FrankerFaceZ extends Module {
FrankerFaceZ.Logger = Logger;
const VER = FrankerFaceZ.version_info = {
major: 4, minor: 0, revision: 0, extra: '-rc2',
major: 4, minor: 0, revision: 0, extra: '-rc3.1',
build: __webpack_hash__,
toString: () =>
`${VER.major}.${VER.minor}.${VER.revision}${VER.extra || ''}${DEBUG ? '-dev' : ''}`

View file

@ -20,6 +20,24 @@ import EmoteMenu from './emote_menu';
import TabCompletion from './tab_completion';
const REGEX_EMOTES = {
'B-?\\)': ['B)', 'B-)'],
'R-?\\)': ['R)', 'R-)'],
'[oO](_|\\.)[oO]': ['o_o', 'O_o', 'o_O', 'O_O', 'o.o', 'O.o', 'o.O', 'O.O'],
'\\&gt\\;\\(': ['>('],
'\\&lt\\;3': ['<3'],
'\\:-?(o|O)': [':o', ':O', ':-o', ':-O'],
'\\:-?(p|P)': [':p', ':P', ':-p', ':-P'],
'\\:-?D': [':D', ':-D'],
'\\:-?[\\\\/]': [':/', ':-/', ':\\', ':-\\'],
'\\:-?[z|Z|\\|]': [':z', ':Z', ':|', ':-z', ':-Z', ':-|'],
'\\:-?\\(': [':(', ':-('],
'\\:-?\\)': [':)', ':-)'],
'\\;-?(p|P)': [';p', ';P', ';-p', ';-P'],
'\\;-?\\)': [';)', ';-)']
};
const MESSAGE_TYPES = ((e = {}) => {
e[e.Post = 0] = 'Post';
e[e.Action = 1] = 'Action';
@ -578,8 +596,16 @@ export default class ChatHook extends Module {
for(const set of emote_sets)
if ( set && set.emotes )
for(const emote of set.emotes)
if ( emote )
emotes[emote.token] = emote.id;
if ( emote ) {
const token = emote.token;
if ( has(REGEX_EMOTES, token) ) {
for(const token of REGEX_EMOTES[token] )
if ( ! has(emotes, token) )
emotes[token] = emote.id;
} else if ( ! has(emotes, token) )
emotes[token] = emote.id;
}
return emotes;
}