Icing on the cake! My main example is done. - Update app.js, bootscreen.js, and 9 more files...

This commit is contained in:
2020-10-12 16:13:01 +02:00
parent 1ffd928545
commit beb3d5595b
9 changed files with 132 additions and 43 deletions

View File

@@ -7,34 +7,25 @@ var fs = require('fs');
zoizbot.commands = new Discord.Collection();
console.log("==============================================");
console.log(`starting zoizbot...`);
console.log(" ==============================================");
console.log(` starting zoizbot...`);
eval(fs.readFileSync('./bootscreen.js') + ''); // please delete this, using readFileSync 1 time was bad enough. But I didnt want ascii art in my main file ;)
console.log(`loading configuration file...`)
console.log(` loading configuration file...`)
const config = require("./conf.json"); // de conf ophalen die we net gemaakt hadden / picking up the config file we made
console.log(`configuration loaded!`) // should make an catch error to debug conf file but whatever
console.log("==============================================");
console.log(`loading the commandhandler...`)
console.log(` configuration loaded!`) // should make an catch error to debug conf file but whatever
console.log(" ==============================================");
console.log(` loading the commandhandler...`)
eval(fs.readFileSync('./commandhandler.js') + '');
console.log(`commandhandler loaded!`)
console.log("==============================================");
console.log(`loading command-files...`)
console.log(` commandhandler loaded!`)
console.log(" ==============================================");
console.log(" ")
console.log(` loading command-files...`)
console.log(" ")
fs.readdir(`./commands/`, (err, files) => {
if (err) return console.error(err);
files.forEach(file => {
if (!file.endsWith(".js")) return; // only load js files. no garbage collection
let props = require(`./commands/${file}`); // get the command name from the file.js
let commandName = file.split(".")[0];
console.log(`attempting to load command ${commandName}`); // adding everything to the collection
zoizbot.commands.set(commandName, props);
});
console.log(`all commands loaded!`);
console.log("==============================================");
});
eval(fs.readFileSync('./commandloader.js') + ''); // Loading from command folders. easy mode :)
zoizbot.login(config.token).catch(console.error); //reading the "token" from the const config = conf.json btw the one you see is invalid now

View File

@@ -1,15 +1,15 @@
// bad practice please remove this file and the fileReadSync function
console.log("==============================================");
console.log(" ,--, ");
console.log(" ,----, ,---. ,--.'| ,----, ");
console.log(" .' .`| ' ,'\ | |, .' .`| ");
console.log(" .' .' .' / / |`--'_ .' .' .' ");
console.log(",---, ' ./ . ; ,. :,' ,'| ,---, ' ./ ");
console.log("; | .' / ' | |: :' | | ; | .' / ");
console.log("`---' / ;--,' | .; :| | : `---' / ;--, ");
console.log(" / / / .`|| : |' : |__ / / / .`| ");
console.log("./__; .' \ \ / | | '.'|./__; .' ");
console.log("; | .' `----' ; : ;; | .' ");
console.log("`---' | , / `---' ");
console.log(" ---`-' ");
console.log("==============================================");
console.log(" ==============================================");
console.log(" ,--, ");
console.log(" ,----, ,---. ,--.'| ,----, ");
console.log(" .' .`| ' ,'\ | |, .' .`| ");
console.log(" .' .' .' / / | `--'_ .' .' .' ");
console.log(" ,---, ' ./ . ; ,. : ,' ,'| ,---, ' ./ ");
console.log(" ; | .' / ' | |: : ' | | ; | .' / ");
console.log(" `---' / ;--,' | .; : | | : `---' / ;--, ");
console.log(" / / / .`|| : | ' : | / / / .`| ");
console.log(" ./__; .' \ \ / | | | /__; .' ");
console.log(" ; | .' `----' ; : | ;; | .' ");
console.log(" `---' | , : `---' ");
console.log(" ---` ");
console.log(" ==============================================");

View File

@@ -1,16 +1,17 @@
zoizbot.on("ready", () => {
zoizbot.user.setActivity(config.activity); // change this to whatever you want (in conf.json).
console.log(`Zoizbot has started, and is serving ${zoizbot.users.cache.size} users, in ${zoizbot.guilds.cache.size} guilds.`); // you can display anything you want here, all the functions are available in de documentation from discord.js
console.log("==================LISTENING===================");
console.log(` Zoizbot is listening, `); // you can display anything you want here, all the functions are available in de documentation from discord.js
console.log(` and is currently serving ${ zoizbot.users.cache.size } users, in ${ zoizbot.guilds.cache.size } guilds.`)
console.log(" ==================LISTENING===================");
});
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!`);
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("guildLeave", guild => {
console.log(`Adios! i will be leaving: ${guild.name}, it was fun while it lasted!`); //letting you know he be headin out
console.log(` Adios! i will be leaving: ${guild.name}, it was fun while it lasted!`); //letting you know he be headin out
});
zoizbot.on("message", async message => {

69
zoizbot/commandloader.js Normal file
View File

@@ -0,0 +1,69 @@
var loaded = 0
fs.readdir (`./commands/`, (err, files) => {
if (err) return console.error(err);
files.forEach(file => {
if (!file.endsWith(".js")) return; // only load js files. no garbage collection
let props = require(`./commands/${file}`); // get the command name from the file.js
let commandName = file.split(".")[0];
console.log(` attempting to load command: ${commandName}`); // adding everything to the collection
zoizbot.commands.set(commandName, props);
loaded++; // beginners trick to check if all the folder-commands where loaded // i really dont know what im doing here hahahaha
});
if (loaded == 4) { // this is the funniest shit i have ever done. pure for asthetics. please change this to a different way
console.log(" ")
console.log(` all commands loaded!`);
console.log(" ")
console.log(" ==============================================");
}
});
fs.readdir (`./commands/fun/`, (err, files) => {
if (err) return console.error(err);
files.forEach(file => {
if (!file.endsWith(".js")) return;
let props = require(`./commands/fun/${file}`);
let commandName = file.split(".")[0];
console.log(` attempting to load command: ${commandName}`);
zoizbot.commands.set(commandName, props);
loaded++;
});
if (loaded == 4) {
console.log(" ")
console.log(` all commands loaded!`);
console.log(" ")
console.log(" ==============================================");
}
});
fs.readdir(`./commands/general/`, (err, files) => {
if (err) return console.error(err);
files.forEach(file => {
if (!file.endsWith(".js")) return;
let props = require(`./commands/general/${file}`);
let commandName = file.split(".")[0];
console.log(` attempting to load command: ${commandName}`);
zoizbot.commands.set(commandName, props);
loaded++;
});
if (loaded == 4) {
console.log(" ")
console.log(` all commands loaded!`);
console.log(" ")
console.log(" ==============================================");
}
});
fs.readdir(`./commands/moderation/`, (err, files) => { //copy paste for different folders works fine. dirty fix no.394 haha
if (err) return console.error(err);
files.forEach(file => {
if (!file.endsWith(".js")) return;
let props = require(`./commands/moderation/${file}`);
let commandName = file.split(".")[0];
console.log(` attempting to load command: ${commandName}`);
zoizbot.commands.set(commandName, props);
loaded++;
});
if (loaded == 4) {
console.log(" ")
console.log(` all commands loaded!`);
console.log(" ")
console.log(" ==============================================");
}
});

View File

@@ -0,0 +1,18 @@
exports.run = async (zoizbot, message, args) => {
if (!message.member.hasPermission("KICK_MEMBERS"))
return message.reply("Sorry, you don't have permissions to use this!");
let member = message.guild.member(message.mentions.users.first()) || message.mentions.members.first(args[0])
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}`);
}

View File

@@ -1,4 +1,5 @@
{
"token": "",
"prefix": ">"
"prefix": ">",
"activity": "Ask me something with >"
}

View File

@@ -42,10 +42,16 @@
<Content Include="commandhandler.js">
<SubType>Code</SubType>
</Content>
<Content Include="commands\hello.js">
<Content Include="commandloader.js">
<SubType>Code</SubType>
</Content>
<Content Include="commands\ping.js">
<Content Include="commands\general\hello.js">
<SubType>Code</SubType>
</Content>
<Content Include="commands\general\ping.js">
<SubType>Code</SubType>
</Content>
<Content Include="commands\moderation\kick.js">
<SubType>Code</SubType>
</Content>
<Content Include="commands\reload.js">
@@ -57,6 +63,9 @@
</ItemGroup>
<ItemGroup>
<Folder Include="commands\" />
<Folder Include="commands\general\" />
<Folder Include="commands\moderation\" />
<Folder Include="commands\fun\" />
<Folder Include="Legacy Commands\" />
</ItemGroup>
<!-- Do not delete the following Import Project. While this appears to do nothing it is a marker for setting TypeScript properties before our import that depends on them. -->