Simp-O-Matic

Dumb Discord bot in TS.
git clone git://git.knutsen.co/Simp-O-Matic
Log | Files | Refs | README | LICENSE

commit 8169506ea27cfe1d89cc836bbd4108446e488efb
parent 22e998f4e25671985e6b6f3d512d7e27ecdc9dfb
Author: Bruno <b-coimbra@hotmail.com>
Date:   Fri, 20 Mar 2020 07:12:37 -0300

I forgot regex exists
Diffstat:
Mlib/commands/emojify.ts | 3+--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/commands/emojify.ts b/lib/commands/emojify.ts @@ -1,6 +1,5 @@ import { Message } from 'discord.js'; -const ALPHABET = 'abcdefghijklmnopqrstuvwxyz'; const NUMBER_NAMES = [ 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'keycap_ten' @@ -17,7 +16,7 @@ export default home_scope => { const letters = [...input].map((chr: any) => { if (chr === ' ') return chr; - if (isNaN(chr) && ALPHABET.includes(chr)) + if (isNaN(chr) && /[a-z]/i.test(chr)) return chr === 'b' ? chr.emojify() : `regional_indicator_${chr}`.emojify();