mirror of
https://github.com/danbulant/cnmc-bot
synced 2026-06-19 22:51:38 +00:00
Add hint command
This commit is contained in:
parent
ba503b123e
commit
4e41674272
2 changed files with 7 additions and 8 deletions
4
index.js
4
index.js
|
|
@ -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;
|
||||
|
|
|
|||
11
src/index.js
11
src/index.js
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Reference in a new issue