suits etzala

This commit is contained in:
Flummi 2023-07-10 20:03:32 +02:00
parent 27cca680bc
commit 2553883571
Signed by: Flummi
GPG Key ID: AA2AEF822A6F4817

View File

@ -4,7 +4,7 @@ import cfg from '../config.json' assert { type: 'json' };
const bot = await new cuffeo(cfg.clients);
const g_cards = { "♠": "S", "♣": "C", "♦": "D", "♥": "H" };
const g_suits = { "♠": "S", "♣": "C", "♦": "D", "♥": "H" };
const stripColors = msg => msg.replace(/\x03\d{0,2}(,\d{0,2}|\x02\x02)?/g, '');
@ -12,9 +12,9 @@ const parseCards = msg => {
const output = [];
for(const c of stripColors(msg).match(/(\w+)([♠♣️♦♥️️])/g)) {
if(c.length === 3)
output.push(`T${g_cards[c[2]]}`);
output.push(`T${g_suits[c[2]]}`);
else
output.push(`${c[0]}${g_cards[c[1]]}`);
output.push(`${c[0]}${g_suits[c[1]]}`);
}
return output;
};