mirror of
https://github.com/SEPPDROID/zoizbot.git
synced 2025-10-22 07:54:28 +00:00
added examples and fixed the reload tool - Update examples.js, commandloader.js, and 8 more files...
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
|
||||
/*
|
||||
* This is for your reference. this is how we dit it first
|
||||
* This is for your reference. this is how we did it first
|
||||
* check commit 459446526602d35af9cec596b552cddeeac4c992
|
||||
*
|
||||
* we now use a "handler" and keep it organised with command files
|
||||
|
@@ -7,8 +7,8 @@ fs.readdir (`./commands/`, (err, files) => {
|
||||
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
|
||||
});
|
||||
loaded++; // beginners trick to check if all the folder-commands where loaded // i really dont know what im doing here hahahaha //edit2 i made it even worse :(
|
||||
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!`);
|
||||
@@ -24,8 +24,8 @@ fs.readdir (`./commands/fun/`, (err, files) => {
|
||||
let commandName = file.split(".")[0];
|
||||
console.log(` attempting to load command: ${commandName}`);
|
||||
zoizbot.commands.set(commandName, props);
|
||||
loaded++;
|
||||
});
|
||||
loaded++;
|
||||
if (loaded == 4) {
|
||||
console.log(" ")
|
||||
console.log(` all commands loaded!`);
|
||||
@@ -41,8 +41,8 @@ fs.readdir(`./commands/general/`, (err, files) => {
|
||||
let commandName = file.split(".")[0];
|
||||
console.log(` attempting to load command: ${commandName}`);
|
||||
zoizbot.commands.set(commandName, props);
|
||||
loaded++;
|
||||
});
|
||||
loaded++;
|
||||
if (loaded == 4) {
|
||||
console.log(" ")
|
||||
console.log(` all commands loaded!`);
|
||||
@@ -58,8 +58,8 @@ fs.readdir(`./commands/moderation/`, (err, files) => { //copy paste for differe
|
||||
let commandName = file.split(".")[0];
|
||||
console.log(` attempting to load command: ${commandName}`);
|
||||
zoizbot.commands.set(commandName, props);
|
||||
loaded++;
|
||||
});
|
||||
loaded++;
|
||||
if (loaded == 4) {
|
||||
console.log(" ")
|
||||
console.log(` all commands loaded!`);
|
||||
|
20
zoizbot/commands/fun/reloadfun.js
Normal file
20
zoizbot/commands/fun/reloadfun.js
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* a command that reloads the command you have edited to memory
|
||||
* so you dont have to reboot the bot
|
||||
* good for testing, not so much for production
|
||||
* ive added the permission test, to make sure not everybody spams reload
|
||||
*/
|
||||
exports.run = (zoizbot, message, args) => {
|
||||
if (!message.member.hasPermission("ADMINISTRATOR"))
|
||||
return message.reply("Sorry, you don't have permissions to use this!");
|
||||
if (!args || args.length < 1) return message.reply("Please provide the command name to reload.");
|
||||
const commandName = args[0];
|
||||
if (!zoizbot.commands.has(commandName)) {
|
||||
return message.reply("That command does not exist");
|
||||
}
|
||||
delete require.cache[require.resolve(`./${commandName}.js`)];
|
||||
zoizbot.commands.delete(commandName);
|
||||
const props = require(`./${commandName}.js`);
|
||||
zoizbot.commands.set(commandName, props);
|
||||
message.reply(`The command ${commandName} has been reloaded`);
|
||||
};
|
20
zoizbot/commands/general/reloadgeneral.js
Normal file
20
zoizbot/commands/general/reloadgeneral.js
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* a command that reloads the command you have edited to memory
|
||||
* so you dont have to reboot the bot
|
||||
* good for testing, not so much for production
|
||||
* ive added the permission test, to make sure not everybody spams reload
|
||||
*/
|
||||
exports.run = (zoizbot, message, args) => {
|
||||
if (!message.member.hasPermission("ADMINISTRATOR"))
|
||||
return message.reply("Sorry, you don't have permissions to use this!");
|
||||
if (!args || args.length < 1) return message.reply("Please provide the command name to reload.");
|
||||
const commandName = args[0];
|
||||
if (!zoizbot.commands.has(commandName)) {
|
||||
return message.reply("That command does not exist");
|
||||
}
|
||||
delete require.cache[require.resolve(`./${commandName}.js`)];
|
||||
zoizbot.commands.delete(commandName);
|
||||
const props = require(`./${commandName}.js`);
|
||||
zoizbot.commands.set(commandName, props);
|
||||
message.reply(`The command ${commandName} has been reloaded`);
|
||||
};
|
18
zoizbot/commands/moderation/ban.js
Normal file
18
zoizbot/commands/moderation/ban.js
Normal file
@@ -0,0 +1,18 @@
|
||||
exports.run = async (zoizbot, message, args) => {
|
||||
if (!message.member.hasPermission("BAN_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 (message.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}`)
|
||||
}
|
18
zoizbot/commands/moderation/embeddedkick.js
Normal file
18
zoizbot/commands/moderation/embeddedkick.js
Normal 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(' ');
|
||||
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({ embed: { "title": "Kicked", "color": 15746887, "fields": [{ "name": "Information", "value": `${member.user.tag} has been kicked by ${message.author.tag}.\nReason: ${KickReason}` }] } }); // sebastiaan created this one, he likes the embedded stuff
|
||||
}
|
@@ -8,11 +8,12 @@ exports.run = async (zoizbot, message, args) => {
|
||||
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
|
||||
let KickReason = args.slice(1).join(' '); // joining the sliced 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}`);
|
||||
|
||||
message.reply(`${member.user.tag} has been kicked by ${message.author.tag} because: ${KickReason}`);
|
||||
}
|
20
zoizbot/commands/moderation/reloadmoderation.js
Normal file
20
zoizbot/commands/moderation/reloadmoderation.js
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* a command that reloads the command you have edited to memory
|
||||
* so you dont have to reboot the bot
|
||||
* good for testing, not so much for production
|
||||
* ive added the permission test, to make sure not everybody spams reload
|
||||
*/
|
||||
exports.run = (zoizbot, message, args) => {
|
||||
if (!message.member.hasPermission("ADMINISTRATOR"))
|
||||
return message.reply("Sorry, you don't have permissions to use this!");
|
||||
if (!args || args.length < 1) return message.reply("Please provide the command name to reload.");
|
||||
const commandName = args[0];
|
||||
if (!zoizbot.commands.has(commandName)) {
|
||||
return message.reply("That command does not exist");
|
||||
}
|
||||
delete require.cache[require.resolve(`./${commandName}.js`)];
|
||||
zoizbot.commands.delete(commandName);
|
||||
const props = require(`./${commandName}.js`);
|
||||
zoizbot.commands.set(commandName, props);
|
||||
message.reply(`The command ${commandName} has been reloaded`);
|
||||
};
|
@@ -5,6 +5,14 @@
|
||||
* ive added the permission test, to make sure not everybody spams reload
|
||||
*/
|
||||
exports.run = (zoizbot, message, args) => {
|
||||
const config = require("../conf.json");
|
||||
message.channel.send({ embed: { "title": "Reload Tool", "color": 15746887, "fields": [{ "name": "Reload command file Syntax", "value": ` \n${config.prefix}reloadmoderation "command"\n${config.prefix}reloadgeneral "command" \n${config.prefix}reloadfun "command"` }] } });
|
||||
|
||||
|
||||
/*
|
||||
* uncomment if you have commandfiles in de /commands folder
|
||||
* i did it the easy way. so should you haha
|
||||
*
|
||||
if (!message.member.hasPermission("ADMINISTRATOR"))
|
||||
return message.reply("Sorry, you don't have permissions to use this!");
|
||||
if (!args || args.length < 1) return message.reply("Please provide the command name to reload.");
|
||||
@@ -17,4 +25,5 @@ exports.run = (zoizbot, message, args) => {
|
||||
const props = require(`./${commandName}.js`);
|
||||
zoizbot.commands.set(commandName, props);
|
||||
message.reply(`The command ${commandName} has been reloaded`);
|
||||
*/
|
||||
};
|
@@ -45,15 +45,24 @@
|
||||
<Content Include="commandloader.js">
|
||||
<SubType>Code</SubType>
|
||||
</Content>
|
||||
<Content Include="commands\fun\reloadfun.js" />
|
||||
<Content Include="commands\general\hello.js">
|
||||
<SubType>Code</SubType>
|
||||
</Content>
|
||||
<Content Include="commands\general\ping.js">
|
||||
<SubType>Code</SubType>
|
||||
</Content>
|
||||
<Content Include="commands\general\reloadgeneral.js" />
|
||||
<Content Include="commands\moderation\ban.js">
|
||||
<SubType>Code</SubType>
|
||||
</Content>
|
||||
<Content Include="commands\moderation\embeddedkick.js">
|
||||
<SubType>Code</SubType>
|
||||
</Content>
|
||||
<Content Include="commands\moderation\kick.js">
|
||||
<SubType>Code</SubType>
|
||||
</Content>
|
||||
<Content Include="commands\moderation\reloadmoderation.js" />
|
||||
<Content Include="commands\reload.js">
|
||||
<SubType>Code</SubType>
|
||||
</Content>
|
||||
|
Reference in New Issue
Block a user