Use a for loop instead of being an idiot

This commit is contained in:
SileNce5k 2021-08-31 18:20:25 +02:00
parent b8b272c099
commit 607ae7d853
No known key found for this signature in database
GPG key ID: C507260E7F2583AD

View file

@ -3,9 +3,10 @@ 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)
let regex = [/<guilds>/g,/<prefix>/g];
let replaceValue = [guildCount, globalPrefix];
for(let i = 0; i < regex.length; i++){
presenceText = presenceText.replace(regex[i], replaceValue[i]);
}
client.user.setActivity(presenceText, { type: presenceType });
}