Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecations & Errors corrected. #2

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 19 additions & 15 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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"));
Expand Down Expand Up @@ -108,15 +111,16 @@ client.on('message', (message) => {
message.author.send({
embed: {
color: 0x0000ff,
description: "Write `!verify` <code> in the guild to write in all channel. \n\n**Verification Bot modified by Shekelstein#8863**"
description: "\n**Please memorise the Captha <code> below!** \nReturn to #verify channel. \nWrite `!verify` <code> in the #verify channel \nto see the protected server channels."
}
});
message.delete();

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);


Expand Down Expand Up @@ -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();
}
}
Expand Down Expand Up @@ -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```");
Expand Down
13 changes: 7 additions & 6 deletions src/config.json
Original file line number Diff line number Diff line change
@@ -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":[
Expand All @@ -20,4 +21,4 @@
"blockedIDs":{

}
}
}