Catch setactivity so bot doesn't crash
This commit is contained in:
parent
d0af91dda4
commit
4d87294196
1 changed files with 7 additions and 2 deletions
|
@ -1,10 +1,10 @@
|
|||
const getGuildCount = require("./getGuildCount")
|
||||
const parseMS = require('parse-ms');
|
||||
const convertDateToISOString = require('./convertDateToISOString')
|
||||
module.exports = function ({presenceText, presenceType, client}) {
|
||||
const {globalPrefix} = require ('../data/config.json')
|
||||
let guildCount = getGuildCount(client)
|
||||
let uptime = parseMS(client.uptime);
|
||||
|
||||
let uptimeFormat = "";
|
||||
let uptimeSingularOrPlural;
|
||||
if(uptime.hours >= 1 || uptime.days >= 1){
|
||||
|
@ -22,5 +22,10 @@ module.exports = function ({presenceText, presenceType, client}) {
|
|||
for(let i = 0; i < regex.length; i++){
|
||||
presenceText = presenceText.replace(regex[i], replaceValue[i]);
|
||||
}
|
||||
|
||||
try {
|
||||
client.user.setActivity(presenceText, { type: presenceType });
|
||||
}catch(e){
|
||||
console.error(`${convertDateToISOString(new Date)}\n${e}`);
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue