Add hint command

This commit is contained in:
danbulant 2020-09-03 16:43:28 +02:00
parent ba503b123e
commit 4e41674272
2 changed files with 7 additions and 8 deletions

View file

@ -70,7 +70,9 @@ client.on("messageReactionAdd", async (react, user) => {
var hint = false;
if(challenge.get("hint")) {
var msg = await react.message.channel.messages.fetch(challenge.get("hint"));
var hint = challenge.get("hint").split("|");
let ch = await client.channels.fetch(hint[0]);
let msg = await ch.messages.fetch(hint[1]);
if(msg.createdTimestamp < react.message.createdTimestamp) {
points -= 0.5;
hint = true;

View file

@ -20,6 +20,10 @@ app
challenge.set("type", 0);
msg.reply("Done.");
return false;
} else if(msg.author.id === "694395936809418816" && msg.content === "!hint") {
challenge.set("hint", msg.channel.id + "|" + msg.id);
msg.reply("Done.");
return false;
} else if(msg.author.id === "694395936809418816" && msg.content.startsWith("!start")) {
var num = msg.content.split(" ")[1][0];
if(isNaN(parseInt(num))) {
@ -37,13 +41,6 @@ app
msg.cguild = await msg.client.guilds.fetch("745985920116850781");
msg.cmember = await msg.cguild.members.fetch(msg.author.id);
})
.use(msg => {
if(challenge.get("hint")) return;
if(msg.author.id === "694395936809418816") {
challenge.set("hint", msg.id);
return false;
}
})
.use(msg => {
if(!/^\[[0-9.]+\]/.test(msg.cmember.displayName)) {
msg.author.send("You must register first");