Refactor presence stuff

* Create new function that sets presence which replaces with correct
  variables
* Probably some more shit I don't remember
This commit is contained in:
SileNce5k 2021-07-09 18:10:49 +02:00
parent 7b069ad429
commit bf1a7985aa
No known key found for this signature in database
GPG key ID: C507260E7F2583AD
4 changed files with 19 additions and 18 deletions

11
util/setPresence.js Normal file
View file

@ -0,0 +1,11 @@
const getGuildCount = require("./getGuildCount")
module.exports = function ({presenceText, presenceType, client}) {
const {globalPrefix} = require ('../data/config.json')
let guildCount = getGuildCount(client)
let regex = /<guilds>/g
presenceText = presenceText.replace(regex, guildCount)
regex = /<prefix>/g
presenceText = presenceText.replace(regex, globalPrefix)
client.user.setActivity(presenceText, { type: presenceType });
}