diff --git a/zoizbot/app.js b/zoizbot/app.js
index d570a3a..36c3aff 100644
--- a/zoizbot/app.js
+++ b/zoizbot/app.js
@@ -3,7 +3,7 @@
const Discord = require("discord.js");// bring us the magic / kom maar op met die voorgeschreven library
const zoizbot = new Discord.Client(); // discord client is now made zoizbot. wat een lol zeg tjonge
-
+var fs = require('fs');
console.log(`starting zoizbot...`);
console.log(`loading configuration file...`)
@@ -18,14 +18,17 @@ zoizbot.on("ready", () => {
zoizbot.user.setActivity(`Ask me something with >`); // change this to whatever you want. check out https://discord.js.org/#/docs/main/12.3.1/general/welcome
});
-zoizbot.on("guildCreate", guild => {
+zoizbot.on("guildJoin", guild => {
console.log(`I have joined ${guild.name}, I will be serving ${guild.memberCount} members!`); // Join server message in the console
message.channel.send(`Hello ${guild.name} thank you for having me!`);
});
-zoizbot.on("guildDelete", guild => {
+zoizbot.on("guildLeave", guild => {
console.log(`Adios! i will be leaving: ${guild.name} It was fun while it lasted!`);
});
+eval(fs.readFileSync('./commands/examples.js') + ''); //dirty but working trick to keep app main clean...
+
+
zoizbot.login(config.token); //reading the "token" from the const config = conf.json btw the one you see is invalid now
diff --git a/zoizbot/commands/examples.js b/zoizbot/commands/examples.js
new file mode 100644
index 0000000..eeb1fc2
--- /dev/null
+++ b/zoizbot/commands/examples.js
@@ -0,0 +1,67 @@
+
+zoizbot.on("message", async message => {
+
+ if (message.author.bot) return; // dont listen to other bots
+ if (!message.content.startsWith(config.prefix)) return; // dont waste time listening to non prefix messages
+
+ const args = message.content.slice(config.prefix.length).trim().split(/ +/g); // cut the arguments away from the command.
+ const command = args.shift().toLowerCase();
+
+
+
+ //ping pong, example from documentation
+ if (command === "ping") {
+ const m = await message.channel.send("Ping?");
+ m.edit(`Pong! Latency is ${m.createdTimestamp - message.createdTimestamp}ms. API Latency is ${Math.round(zoizbot.ws.ping)}ms`);
+ }
+
+ //simple kick command
+ if (command === "kick") {
+ //if (!message.member.roles.cache.some(r => ["Administrator", "Moderator"].includes(r.name))) checks the roles for permissions
+ if (!message.member.hasPermission("KICK_MEMBERS"))
+ return message.reply("Sorry, you don't have permissions to use this!");
+
+ let member = message.mentions.members.first() || message.guild.members.get(args[0]);
+ if (!member)
+ return message.channel.send("Invalid User")
+ if (!member)
+ return message.reply("Please mention a valid member of this server");
+ if (!member.kickable)
+ return message.reply("I cannot kick this user! Do they have a higher role? Do I have kick permissions?");
+
+ let KickReason = args.slice(1).join(' '); // slicing the arguments
+ if (!KickReason) KickReason = "No reason provided";
+
+
+ await member.kick(KickReason)
+ .catch(error => message.reply(`Sorry ${message.author} I couldn't kick because of : ${error}`)); // now an adios moment
+ message.reply(`${member.user.tag} has been kicked by ${message.author.tag} because: ${KickReason}`);
+
+ }
+
+ //simple ban command
+
+ if (command === "ban") {
+ if (!message.member.hasPermission("BAN_MEMBERS"))
+ return message.channel.send("Sorry, you don't have permissions to use this!")
+ let member = message.guild.member(message.mentions.users.first()) || message.guild.members.get(args[0])
+
+ if (!member)
+ return message.channel.send("Please mention a valid member of this server")
+ if (member.hasPermission("BAN_MEMBERS"))
+ return message.reply("I cannot ban this user! Invalid Permissions")
+ let banReason = args.join(" ").slice(22);
+ if (!banReason) {
+ banReason = "No reason provided"
+ }
+
+ member.ban({ reason: banReason })
+ return message.reply(`${member.user.tag} has been banned by ${message.author.tag} because: ${banReason}`)
+ }
+
+ else return
+});
+
+
+
+
diff --git a/zoizbot/conf.json b/zoizbot/conf.json
index ff275b3..aeacca4 100644
--- a/zoizbot/conf.json
+++ b/zoizbot/conf.json
@@ -1,4 +1,4 @@
{
- "token": "NzY0ODI0MDU3OTcxMjEyMjkw.X4L36Q.L6He_QtvNyPcmDRXBxSa2ze3YtM",
- "prefix": ">"
+ "token": "null",
+ "prefix": ">"
}
diff --git a/zoizbot/zoizbot.njsproj b/zoizbot/zoizbot.njsproj
index 4857110..1b05c06 100644
--- a/zoizbot/zoizbot.njsproj
+++ b/zoizbot/zoizbot.njsproj
@@ -36,6 +36,9 @@
Code
+
+ Code
+