setPresence: Replace <prefix> with global prefix
This commit is contained in:
parent
7d8c407a03
commit
ea65547701
1 changed files with 3 additions and 1 deletions
|
@ -3,7 +3,7 @@ module.exports = {
|
||||||
description: 'Set the presence for the bot',
|
description: 'Set the presence for the bot',
|
||||||
moreHelp: ["Presence types you can use:","PLAY, LISTEN, WATCH","Presence type have to be the first argument"],
|
moreHelp: ["Presence types you can use:","PLAY, LISTEN, WATCH","Presence type have to be the first argument"],
|
||||||
admin: true,
|
admin: true,
|
||||||
execute({message, client, args}) {
|
execute({message, client, args, globalPrefix}) {
|
||||||
const savePresence = require("../util/savePresence");
|
const savePresence = require("../util/savePresence");
|
||||||
let presenceType = args[0].toLocaleUpperCase();
|
let presenceType = args[0].toLocaleUpperCase();
|
||||||
if(presenceType == "PLAY" || presenceType == "LISTEN" || presenceType == "WATCH"){
|
if(presenceType == "PLAY" || presenceType == "LISTEN" || presenceType == "WATCH"){
|
||||||
|
@ -20,6 +20,8 @@ module.exports = {
|
||||||
}
|
}
|
||||||
const firstArg = args[0].length + 1;
|
const firstArg = args[0].length + 1;
|
||||||
let temp = args.join(" ");
|
let temp = args.join(" ");
|
||||||
|
let regex = /<prefix>/g
|
||||||
|
temp = temp.replace(regex, globalPrefix)
|
||||||
let presenceText = temp.slice(firstArg, temp.length)
|
let presenceText = temp.slice(firstArg, temp.length)
|
||||||
client.user.setActivity(presenceText, { type: presenceType });
|
client.user.setActivity(presenceText, { type: presenceType });
|
||||||
savePresence(presenceType, presenceText);
|
savePresence(presenceType, presenceText);
|
||||||
|
|
Loading…
Add table
Reference in a new issue