added phone status

This commit is contained in:
Histmy 2020-11-18 23:24:08 +01:00
parent fda24d0441
commit 92020326f5

15
app.js
View File

@ -5,7 +5,7 @@ const client = new Client();
dotenv.config(); dotenv.config();
const prefix = process.env.PREFIX || 'more'; const prefix = process.env.PREFIX || 'more';
const role = {online: '684443816383610916', idle: '684444083065978941', dnd: '684444020558135399', offline: '684443903759614049'}; const role = {online: '684443816383610916', idle: '684444083065978941', dnd: '684444020558135399', offline: '684443903759614049', onlinephone: '777989420728975390'};
const akce = {hraj: 'PLAYING', sleduj: 'WATCHING', poslouchej: 'LISTENING', soutez: 'COMPETING', soutěž: 'COMPETING', nedelej: '', nedělej: ''}; const akce = {hraj: 'PLAYING', sleduj: 'WATCHING', poslouchej: 'LISTENING', soutez: 'COMPETING', soutěž: 'COMPETING', nedelej: '', nedělej: ''};
const spostece = ['mares', 'mareš', 'purfie', 'denim', '<@!639142938965704745>']; const spostece = ['mares', 'mareš', 'purfie', 'denim', '<@!639142938965704745>'];
const emouty = ['purfiek3:616026189269696512', 'purfiek3:616026189269696512', 'purfiek3:616026189269696512', 'purfieUchyl:576487602203525138', 'bafW:574646319696576532', 'purfiek4:616026180889477258']; const emouty = ['purfiek3:616026189269696512', 'purfiek3:616026189269696512', 'purfiek3:616026189269696512', 'purfieUchyl:576487602203525138', 'bafW:574646319696576532', 'purfiek4:616026180889477258'];
@ -285,13 +285,12 @@ client.on('message', mes => {
client.on('presenceUpdate', (bef, aft) => { client.on('presenceUpdate', (bef, aft) => {
if (aft.guild.id !== '555779161067749446') return; if (aft.guild.id !== '555779161067749446') return;
let Return = false;
try { if (!bef) bef = {status: 'offline', clientStatus: {}};
if (bef.status === aft.status) Return = true; if (bef.clientStatus.mobile === 'online' && bef.clientStatus.desktop !== 'online') bef.status = 'onlinephone';
} catch { if (aft.clientStatus.mobile === 'online' && aft.clientStatus.desktop !== 'online') aft.status = 'onlinephone';
bef = {status: 'offline'}; if (bef.status === aft.status) return;
}
if (Return) return;
aft.member.roles.add(role[aft.status]); aft.member.roles.add(role[aft.status]);
aft.member.roles.remove(role[bef.status]); aft.member.roles.remove(role[bef.status]);
console.log(`${aft.user.username} změnil status z ${bef.status} na ${aft.status}`); console.log(`${aft.user.username} změnil status z ${bef.status} na ${aft.status}`);