setPresence: Replace <prefix> with global prefix

This commit is contained in:
SileNce5k 2021-07-02 12:31:18 +02:00
parent 7d8c407a03
commit ea65547701
No known key found for this signature in database
GPG key ID: C507260E7F2583AD

View file

@ -3,7 +3,7 @@ module.exports = {
description: 'Set the presence for the bot',
moreHelp: ["Presence types you can use:","PLAY, LISTEN, WATCH","Presence type have to be the first argument"],
admin: true,
execute({message, client, args}) {
execute({message, client, args, globalPrefix}) {
const savePresence = require("../util/savePresence");
let presenceType = args[0].toLocaleUpperCase();
if(presenceType == "PLAY" || presenceType == "LISTEN" || presenceType == "WATCH"){
@ -20,6 +20,8 @@ module.exports = {
}
const firstArg = args[0].length + 1;
let temp = args.join(" ");
let regex = /<prefix>/g
temp = temp.replace(regex, globalPrefix)
let presenceText = temp.slice(firstArg, temp.length)
client.user.setActivity(presenceText, { type: presenceType });
savePresence(presenceType, presenceText);