diff --git a/modules/hovna.js b/modules/hovna.js index 13d3a0b..f26ee85 100644 --- a/modules/hovna.js +++ b/modules/hovna.js @@ -40,6 +40,32 @@ module.exports = (mes, komand, celArgs) => { mes.channel.send('toto me trickeruje'); break; + case 'status': + const ping = /^<@!?\d+>$/; + if (!ping.test(celArgs)) { + mes.channel.send('tak si kokot ti kokote'); + break; + } + const uzivatel = mes.mentions.users.first(); + const embed = { + title: `Informace o statusech pro ${uzivatel.username}:`, + color: 431075 + }; + const zarizeni = { desktop: 'Počítač', mobile: 'Mobil', web: 'Web' }; + const statusy = { online: '🟢', idle: '🟡', dnd: '🔴' }; + const presence = uzivatel.presence.clientStatus; + if (!presence) { + embed.description = '*Všude je offline*'; + } else { + const uStatusy = []; + Object.keys(presence).forEach(status => { + uStatusy.push(`${zarizeni[status]}: ${statusy[presence[status]]}`); + }); + embed.description = uStatusy.join('\n'); + } + mes.channel.send({ embed }); + break; + default: return false; }