From 955fe8c462c38fa673485734768ef43610f550da Mon Sep 17 00:00:00 2001 From: Jan <26145882+imverum@users.noreply.github.com> Date: Sun, 27 Dec 2020 14:32:23 +0100 Subject: [PATCH] Set activity --- util/login.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/util/login.js b/util/login.js index bb52d90..d1597fe 100644 --- a/util/login.js +++ b/util/login.js @@ -26,6 +26,20 @@ module.exports.run = () => { ]) ); resolve(); + + // Set the bot's activity and update it every 60 seconds in case it gets reset + let setActivity = () => { + try { + // Activity type 5 corresponds to 'Competing in': https://discord.com/developers/docs/game-sdk/activities#data-models-activitytype-enum + client.user.setPresence({ activity: { type: 5, name: 'being Obama' }, status: 'dnd' }) + .then(() => logger.debug('Updated activity')); + } catch(e) { + console.error(e); + } + } + + setActivity(); + setInterval(setActivity, (1000 * 60)); }); }); } \ No newline at end of file