diff --git a/index.js b/index.js index c2df5bf..747535e 100644 --- a/index.js +++ b/index.js @@ -6,10 +6,10 @@ const token = config.token; const clientID = config.clientid; const prefix = "!" const normalChat = config.chat; -const userRoleID = "367789057352400908" +const userRoleID = "815623323761115176" const evalPerm = config.evalAllowed; -const owner = "322727506736185346" -const streamingGame = "CombineControl" +const owner = "446081437301604352" +const streamingGame = "Captcha-BOT" const streamingLink = config.streamingLink; const colors = config.possibleCaptchaColors; const blockedAccountIDs = config.blockedIDs; @@ -23,17 +23,20 @@ client.on("guildMemberAdd", (member) => { member.user.send({ embed: { color: 0xffff00, - description: "To verify yourself as a human, write `" + prefix + "receive` in the guild to receive your captcha" + description: "To verify yourself as a human, write `" + prefix + "receive` in the #verify channel to receive your captcha via Direct Message" } }); }); - -client.on("ready", () => { - console.log("Logged in!") - client.user.setGame(streamingGame, streamingLink); +client.on('ready', () => { + console.log(config.botStarted + ` ${client.user.tag}!`); + client.user.setPresence({ status: 'online', game: { name: config.gameMessage } }); + if(config.setNewAvatar){ + client.user.setAvatar(config.avatar); + } }); + client.on('message', (message) => { if (!message.guild) return; let file = JSON.parse(fs.readFileSync("./src/config.json", "utf8")); @@ -108,7 +111,7 @@ client.on('message', (message) => { message.author.send({ embed: { color: 0x0000ff, - description: "Write `!verify` in the guild to write in all channel. \n\n**Verification Bot modified by Shekelstein#8863**" + description: "\n**Please memorise the Captha below!** \nReturn to #verify channel. \nWrite `!verify` in the #verify channel \nto see the protected server channels." } }); message.delete(); @@ -116,7 +119,8 @@ client.on('message', (message) => { queryFile.query[author + "x" + captcha] = { verified: "false" }; - fs.writeFile("./src/Query.json", JSON.stringify(queryFile)); + fs.writeFile("./src/Query.json", JSON.stringify(queryFile), (error) => { console.log ("Error=" + (error)); }); + queue.push(author + "x" + captcha); @@ -150,17 +154,17 @@ client.on('message', (message) => { description: "Successfully verified on `" + message.guild.name + "`" } }); - client.channels.find('name', normalChat).send("<@" + message.author.id + "> was successfully verified."); + client.channels.find(channel => channel.name == normalChat).send("<@" + message.author.id + "> was successfully verified."); queryFile.query[message.author.id + "x" + oldcaptcha].verified = "true"; queue.pop(); fs.appendFileSync("./verify_logs.txt", "[VerifyBot] " + time.getHours() + ":" + time.getMinutes() + ":" + time.getSeconds() + "| " + message.author.tag + "(" + message.author.id + ") verified himself.\n"); - message.member.addRole(userRoleID).catch(error => console.log(error)); + message.member.addRoles(userRoleID).catch(error => console.log(error)); } } else { if (message.content.toLowerCase() != prefix + "verify") { - message.author.send("You were kicked from " + message.guild.name + " (WRONG_CAPTCHA)"); - message.delete(); + message.author.send("You were kicked from " + message.guild.name + " (WRONG CAPTCHA) \nIf you feel this is wrong - re-join " + message.guild.name + " \nand try to pass verification again").catch(error => console.log(error)); +// message.delete(); message.member.kick(); } } @@ -209,7 +213,7 @@ client.on('message', (message) => { } } if (message.channel.name === "verify") { - message.delete(); +// message.delete(); } if (message.author.id === owner && evalPerm === "true" && message.content.startsWith(prefix + "eval")) { message.channel.send(":outbox_tray: Output: ```JavaScript\n" + eval(message.content.substr(6)) + "\n```"); diff --git a/src/config.json b/src/config.json index 2c26039..8005c26 100644 --- a/src/config.json +++ b/src/config.json @@ -1,11 +1,12 @@ { - "token":"Mzc3MDUwNTMwNDkwNDgyNjg5.DOHTkw.O_85jYRgyBFKsC-KgjCZScHymt8", - "clientid":"377050530490482689", + "token":"BOT_Token_goes_here", + "clientid":"BOT_client_ID_number_goes_here", "prefix":"!", "chat":"verify", - "userrole":"377062274336030720", - "streamingGame":"CombineControl", - "streamingLink":"", + "userrole":"user_role_ID_numer_before_verification-usually_@everyone", + "gameMessage":"Catching SPAM bots", + "botStarted": "Bot started and online as", + "avatar":"./avatar.png", "evalAllowed":"false", "ownerid":"322727506736185346", "possibleCaptchaColors":[ @@ -20,4 +21,4 @@ "blockedIDs":{ } -} \ No newline at end of file +}