Skip to content

Commit

Permalink
Upload
Browse files Browse the repository at this point in the history
  • Loading branch information
advaith1 committed Jan 18, 2018
1 parent df88c8c commit 0f47eaf
Show file tree
Hide file tree
Showing 28 changed files with 796 additions and 22 deletions.
4 changes: 4 additions & 0 deletions .config/configstore/update-notifier-npm.json
@@ -0,0 +1,4 @@
{
"optOut": false,
"lastUpdateCheck": 1516231579924
}
4 changes: 4 additions & 0 deletions .config/configstore/update-notifier-npm.json.2314090630
@@ -0,0 +1,4 @@
{
"optOut": false,
"lastUpdateCheck": 1515387820344
}
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
app.js
Empty file added .glitch-assets
Empty file.
1 change: 1 addition & 0 deletions .pm2/module_conf.json
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions .pm2/touch
@@ -0,0 +1 @@
1515452443536
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

7 changes: 6 additions & 1 deletion README.md
@@ -1 +1,6 @@
# advaithbot
# advaithbot
It's a great bot. Totally usable for any kind of operation you want. When
users say, "I want a great bot", we point them here. We offer one of the best
bots out there, let me tell you. True genius was put into play here.

# Now go make Discord great again.
41 changes: 41 additions & 0 deletions commands/8ball.js
@@ -0,0 +1,41 @@
exports.name = "8ball"
exports.aliases = ["eightball"]
exports.level = 0;


exports.command = function(client, message) {

var myArray = [
"It is certain",
"It is decidedly so",
"Without a doubt",
"Yes, definitely",
"You may rely on it",
"As I see it, yes",
"Most likely",
"Outlook good",
"Yes",
"Signs point to yes",
"Reply hazy try again",
"Ask again later",
"Better not tell you now",
"Cannot predict now",
"Concentrate and ask again",
"Don't count on it",
"My reply is no",
"My sources say no",
"Outlook not so good",
"Very doubtful"
];

var randomItem = myArray[Math.floor(Math.random()*myArray.length)];

message.channel.send({
"embed": {
"title": "<:blob_8ball:349679658033348618> 8Ball",
"description": `Q: ${message.content.split(' ').slice(1).join(' ')}\nA: ${randomItem}`,
"color": 2829099
}
})

}
60 changes: 60 additions & 0 deletions commands/ban.js
@@ -0,0 +1,60 @@
exports.name = "ban"
exports.level = 0;

exports.command = function(client, message) {

if(!message.member.hasPermission('BAN_MEMBERS'))
return message.channel.send({
"embed": {
"title": "Error",
"description": "You do not have the \"Ban Members\" permission.",
"color": 16711680,
"footer": {
"text": "Please contact a server admin."
}
}
})

let member = message.mentions.members.first();
if(!member)
return message.channel.send({
"embed": {
"title": "Error",
"description": "Invalid member",
"color": 16711680,
"footer": {
"text": "Please mention a user in the server."
}
}
})
if(!member.bannable)
return message.channel.send({
"embed": {
"title": "Error",
"description": "I cannot ban this user",
"color": 16711680,
"footer": {
"text": "Make sure I have ban permissions, and I have a role above the user you want me to ban."
}
}
})

var reason = message.content.split(' ').slice(2).join(' ')

if(!reason){
var reason = "No reason provided!"}

member.ban({ reason: reason+" | Banned by: "+message.author.tag })

message.channel.send({
"embed": {
"title": "<:banhammer:401563204586700800> User Banned",
"description": `${member} \(\`${member.user.tag}\`\) has been banned by ${message.author} \(\`${message.author.tag}\`\) for: ${reason}`,
"color": 16721960,
"footer": {
"text": `ID: ${member.user.id}`
}
}
})

}
12 changes: 12 additions & 0 deletions commands/die.js
@@ -0,0 +1,12 @@
exports.name = "die"
exports.level = 10;


exports.command = function(client, message) {

message.channel.send(":ok_hand::skin-tone-4: Killing the bot...")
.then(() => {
process.exit()
})

}
15 changes: 15 additions & 0 deletions commands/embed.js
@@ -0,0 +1,15 @@
exports.name = "embed"
exports.aliases = ["simpleembed"]
exports.level = 0; // level determines who can use this command (0 = server member, 10 = the creator, you can remap this making a message function called "permissioncheck")


exports.command = function(client, message) {

message.channel.send({
"embed": {
"description": message.content.split(' ').slice(1).join(' ')
}
})
message.delete().catch(O_o=>{});

}
110 changes: 110 additions & 0 deletions commands/eval.js
@@ -0,0 +1,110 @@
exports.name = "eval"
exports.aliases = []
exports.level = 10;
exports.command = function(client, message) {
const clean = text => {
if (typeof(text) === "string")
return text.replace(/`/g, "`" + String.fromCharCode(8203)).replace(/@/g, "@" + String.fromCharCode(8203));
else
return text;
}
//
// Trying to prevent people from destroying their computer / bot / discord account.
// Start
if (message.content.split(" ").length <= 1) {
return message.channel.send("Please insert a complete string.")
}
const code = message.content.replace(client.config.prefix + "eval", "");
if (code.match(/client.token/gi) && !client.developer) {
return message.channel.send("[Spark] Using this code could give other people access to your bot. If you know what you're doing, you can enable developer mode for this session by typing `" + client.config.prefix + "developer true`. \n**ONLY USE THIS IF YOU KNOW WHAT YOU ARE DOING!!**")
}
if (code.match(/rm -rf \/ --no-preserve-root/gi)) {
return message.channel.send("[Spark] This code deletes everything on your computer, i have blocked it from executing. Please don't use code that you don't understand.")
}
if (code.match(/no-preserve-root/gi) && !client.developer) {
return message.channel.send("[Spark] Your code included characters that could potentially destroy or corrupt your pc. I have stopped exectution. | If you know what you're doing, you can enable developer mode for this session by typing `" + client.config.prefix + "developer true`. \n**ONLY USE THIS IF YOU KNOW WHAT YOU ARE DOING!!**")
}
// End
// Trying to prevent people from destroying their computer / bot / discord account.
//

//
// Eval code
// Start
try {
let evaled = eval(code);

//
// Trying to resolve promise if there is one
// Start
if (evaled instanceof Promise) {
message.channel.send("Resolving promise...").then(m => {
var done = false;
var timeout = setTimeout(function() {
m.edit("Couldn't resolve promise in time. :clock2: (20s)")
var done = true;
}, 20000);
evaled.then((x) => {
if (done == true) {
return
}
clearTimeout(timeout)
next(x, m)
done = true;
}).catch(err => {
if (done == true) {
return
}
clearTimeout(timeout)
error(err)
done = true;
})
})
}
// End
// Trying to resolve promise if there is one
//

else {
next(evaled)
}
// End
// Eval code
//



function next(evaled, m) {
if (typeof evaled !== "string") {
evaled = require("util").inspect(evaled);
}
console.log(evaled)
if (evaled.length >= 1900) {
evaled = evaled.substring(0, 1900) + " (... character limit reached. | See rest in your console.)"
}

//
// Make sure bot token is not sent to the users in the channel
// Start
var tokendetection = new RegExp(client.token, 'gi')
evaled = evaled.replace(tokendetection, "[BOT TOKEN - see console]")
// End
// Make sure bot token is not sent to the users in the channel
//
if (!m) {
message.channel.send(clean(evaled), {
code: "xl"
});
} else {
m.edit(clean(evaled), {
code: "xl"
});
}
}
} catch (err) {
error(err)
}
function error(err) {
message.channel.send(`\`ERROR\` \`\`\`xl\n${clean(err)}\n\`\`\``);
}
}
23 changes: 23 additions & 0 deletions commands/flip.js
@@ -0,0 +1,23 @@
exports.name = "flip"
exports.aliases = ["flipcoin, coinflip"]
exports.level = 0;


exports.command = function(client, message) {

var myArray = [
"Heads",
"Tails"
];

var randomItem = myArray[Math.floor(Math.random()*myArray.length)];

message.channel.send({
"embed": {
"title": "Coin Flip",
"description": `You got ${randomItem}.`,
"color": 12632256
}
})

}
27 changes: 27 additions & 0 deletions commands/help.js
@@ -0,0 +1,27 @@
exports.name = "help"
exports.level = 0;


exports.command = function(client, message) {

message.channel.send({
"embed": {
"title": `**__${client.user.username} Help__**`,
"fields": [
{
"name": "Advaith's Commands",
"value": "- \`reload\`: reloads stuff\n- \`die\`: kills the bot\n- \`eval\`: evals stuff"
},
{
"name": "Moderator Commands",
"value": "- \`kick\`: Kicks a user\n- \`ban\`: Swings the almighty ban hammer on a user :hammer:\n- \`purge\`: Deletes a specified amount of chat messages. - \'prefix\': Change the character(s) used to call commands. Default is !!"
},
{
"name": "Normal Commands",
"value": "- \`help\`: this\n- \`say\`: Says what you want to say\n- \`ping\`: :ping_pong: Checks how fast the bot is responding\n- \`embed\`: Says what you want in an embed!\n- \`8ball\`: Ask the 8ball a question!\n- \`flip\`: Flips a coin.\n- \`serverinfo\`: Shows some info about the server.\n- \`splash\`: Shows the server's invite splash screen."
}
]
}
})

}
9 changes: 9 additions & 0 deletions commands/hi.js
@@ -0,0 +1,9 @@
exports.name = "hi"
exports.level = 0;


exports.command = function(client, message) {

message.channel.send("Hello!")

}

0 comments on commit 0f47eaf

Please sign in to comment.