add: fixchat command

This commit is contained in:
Neko Life 2021-06-01 10:44:37 +00:00
parent 648ab8be67
commit 7ad96907a8
2 changed files with 65 additions and 40 deletions

24
cmds/utility/fixchat.js Normal file
View file

@ -0,0 +1,24 @@
'use strict';
const commando = require("@iceprod/discord.js-commando"),
{ fixChat } = require("../../resources/shaChat");
const { trySend } = require("../../resources/functions");
module.exports = class fixchat extends commando.Command {
constructor(client) {
super(client, {
name: "fixchat",
memberName: "fixchat",
group: "utility",
description: "Fix broken chat."
});
}
async run(msg) {
const r;// = await fixChat();
if (r === 3) {
return trySend(this.client, msg, "Fixed!");
} else {
return trySend(this.client, msg, "Oopsie somethin's wrong...");
}
}
};

View file

@ -1,8 +1,7 @@
'use strict'; 'use strict';
const puppeteer = require('puppeteer'); const puppeteer = require('puppeteer');
const { trySend, ranLog, noPerm } = require('./functions'); const { trySend, noPerm } = require('./functions');
const Commando = require("@iceprod/discord.js-commando"); const Commando = require("@iceprod/discord.js-commando");
require("discord.js"); require("discord.js");
@ -70,11 +69,9 @@ async function fetchAnswer(page, index) {
} }
} }
let chatIndex = 3; let chatIndex = 3;
/**
/**
* @param {Commando.Client} client * @param {Commando.Client} client
* @param {Commando.CommandoMessage} message * @param {Commando.CommandoMessage} message
* @returns * @returns
@ -99,7 +96,7 @@ let chatIndex = 3;
message.channel.stopTyping(); message.channel.stopTyping();
}); });
} }
return ranLog(message, message.content.trim(), answer); return //ranLog(message, message.content.trim(), answer);
}).catch(e => { }).catch(e => {
noPerm(message); noPerm(message);
message.channel.stopTyping(); message.channel.stopTyping();
@ -109,6 +106,10 @@ let chatIndex = 3;
message.channel.stopTyping(); message.channel.stopTyping();
} }
} }
} }
module.exports = { chatAnswer } async function fixChat() {
return page1.then(r => r.reload()).then(() => {return chatIndex = 3}).catch(e => {return console.log(e)});
}
module.exports = { chatAnswer, fixChat }