Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
devarshishimpi committed Feb 26, 2022
1 parent 4f8740a commit ceb56ab
Show file tree
Hide file tree
Showing 14 changed files with 2,272 additions and 0 deletions.
43 changes: 43 additions & 0 deletions commands/info/help.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
const Discord = require("discord.js");
const { MessageEmbed } = require("discord.js");
const { Color, Prefix } = require("../../config.js");

module.exports = {
name: "help",
aliases: ["h"],
description: "Help Command!",
usage: "Help | <Command Name>",
run: async(client, message, args) => {

message.delete();

let embed = new MessageEmbed()
.setColor(Color)
.setTitle(`${client.user.username} Commands!`)
.setDescription(`Use ${Prefix}Help <Command Name> For More Command Information!` +
"`🔐`**Moderation**\n`Clear, Mute, Unmute, Tempmute, Kick,Unban, Tempban, Warn, Warnings, ResetWarns`" + "\n\n"+
"`⌚`**Information**\n`Help")
.setFooter(`Requested By ${message.author.username}`)
.setTimestamp();

if (!args.length) return message.channel.send(embed);

let cmd =
client.commands.get(args[0].toLowerCase()) ||
client.commands.get(client.aliases.get(args[0].toLowerCase()));

let embed2 = new MessageEmbed()
.setColor(Color)
.setTitle(`${cmd.name} Information!`)
.addField(`Aliases`, cmd.aliases || "None!")
.addField(`Usage`, cmd.usage || "No Usage")
.addField(`Description`, cmd.description || "No Description!")
.setTimestamp();

if (cmd) {
return message.channel.send(embed2);
} else {
return message.channel.send(embed);
}
}
};
77 changes: 77 additions & 0 deletions commands/moderation/ban.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
const Discord = require("discord.js");
const { MessageEmbed } = require("discord.js");
const { Color } = require("../../config.js");

module.exports = {
name: "ban",
aliases: [],
description: "Ban A Member!",
usage: "Ban <Mention Member>",
run: async (client, message, args) => {
//Start
message.delete();
if (!message.member.hasPermission("BAN_MEMBERS"))
return message.channel.send(
`You Don't Have Permission To Use This Command!`
);

let Member = message.mentions.users.first();

if (!Member)
return message.channel.send(
`Please Mention A Member That You Want To Ban!`
);

if (!message.guild.members.cache.get(Member.id))
return message.channel.send(`Please Mention A Valid Member!`);

if (Member.id === message.author.id)
return message.channel.send(`You Can't Ban Your Self!`);

if (Member.id === client.user.id)
return message.channel.send(`Please Don't Ban Me ;-;`);

if (Member.id === message.guild.owner.user.id)
return message.channel.send(`You Can't Ban Owner Of Server!`);

let Reason = args.slice(1).join(" ");

let User = message.guild.member(Member);

if (!User.bannable) return message.channel.send(`I Can't Ban That Member!`);

try {
console.log(`Member Is Going To Get Ban!`);
setTimeout(function() {
User.ban({ reason: `${Reason || "No Reason Provided!"}` });
}, 2000);
let embed = new Discord.MessageEmbed()
.setColor(Color)
.setTitle(`Member Banned!`)
.addField(`Moderator`, `${message.author.tag} (${message.author.id}`)
.addField(`Banned Member`, `${Member.tag} (${Member.id})`)
.addField(`Reason`, `${Reason || "No Reason Provided!"}`)
.setFooter(`Requested by ${message.author.username}`)
.setTimestamp();
if (User && Member.bot === false)
Member.send(
`You Have Been Banned From **${message.guild.name}** For ${Reason ||
"No Reason Provided!"}`
);
message.channel.send(embed);
console.log(
`User: ${Member.tag} (${Member.id}) Just Got Banned From ${
message.guild.name
} For ${Reason || "No Reason Provided!"}`
);
} catch (error) {
return message.channel
.send(
`I Can't Ban That Member Maybe Member Has Higher Role Than Me & My Role Is Lower Than Member!`
)
.then(() => console.log(error));
}

//End
}
};
53 changes: 53 additions & 0 deletions commands/moderation/clear.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
const Discord = require("discord.js");
const { MessageEmbed } = require("discord.js");
const { Color } = require("../../config.js");

module.exports = {
name: "clear",
aliases: ["purge", "clearmsgs"],
description: "Clear Your Messages!",
usage: "Clear <Message Amount>",
run: async (client, message, args) => {
//Start
message.delete();
if (!message.member.hasPermission("MANAGE_MESSAGES"))
return message.channel.send(
"You Don't Have Permission To Use This Command!"
);

if (!args[0])
return message.channel.send(`Please Give Me Amounts Of Messages!`);

if (isNaN(args[0]))
return message.channel.send(`Please Give Me Number Value!`);

if (args[0] < 4)
return message.channel.send(
`You Can Delete ${args[0]} By Your Self Its Not Too Many Messages!`
);

if (args[0] > 100)
return message.channel.send(
`I Can't Delete ${args[0]} Because Of Discord Limit!`
);

let Reason = args.slice(1).join(" ") || "No Reason Provided!";

message.channel.bulkDelete(args[0]).then(Message => {
let embed = new Discord.MessageEmbed()
.setColor(Color)
.setTitle(`Messages Deleted!`)
.addField(`Moderator`, `${message.author.tag} (${message.author.id}`)
.addField(`Channel`, `${message.channel.name} (${message.channel.id}`)
.addField(`Deleted Messages`, `${Message.size}`)
.addField(`Reason`, `${Reason}`)
.setFooter(`Requested by ${message.author.username}`)
.setTimestamp();
return message.channel
.send(embed)
.then(msg => msg.delete({ timeout: 10000 }));
});

//End
}
};
79 changes: 79 additions & 0 deletions commands/moderation/kick.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
const Discord = require("discord.js");
const { MessageEmbed } = require("discord.js");
const { Color } = require("../../config.js");

module.exports = {
name: "kick",
aliases: [],
description: "Kick A Member!",
usage: "Kick <Mention Member>",
run: async (client, message, args) => {
//Start
message.delete();
if (!message.member.hasPermission("KICK_MEMBERS"))
return message.channel.send(
`You Don't Have Permission To Use This Command!`
);

let Member = message.mentions.users.first();

if (!Member)
return message.channel.send(
`Please Mention A Member That You Want To Kick!`
);

if (!message.guild.members.cache.get(Member.id))
return message.channel.send(`Please Mention A Valid Member!`);

if (Member.id === message.author.id)
return message.channel.send(`You Can't Kick Your Self!`);

if (Member.id === client.user.id)
return message.channel.send(`Please Don't Kick Me ;-;`);

if (Member.id === message.guild.owner.user.id)
return message.channel.send(`You Can't Kick Owner Of Server!`);

let Reason = args.slice(1).join(" ");

let User = message.guild.member(Member);

if (!User.kickable)
return message.channel.send(`I Can't Kick That Member!`);

try {
console.log(`Member Is Going To Get Kick!`);

setTimeout(function() {
User.kick({ reason: `${Reason || "No Reason Provided!"}` });
}, 2000);
let embed = new Discord.MessageEmbed()
.setColor(Color)
.setTitle(`Member Kicked!`)
.addField(`Moderator`, `${message.author.tag} (${message.author.id}`)
.addField(`Kicked Member`, `${Member.tag} (${Member.id})`)
.addField(`Reason`, `${Reason || "No Reason Provided!"}`)
.setFooter(`Requested by ${message.author.username}`)
.setTimestamp();
if (User && Member.bot === false)
Member.send(
`You Have Been Kicked From **${message.guild.name}** For ${Reason ||
"No Reason Provided!"}`
);
message.channel.send(embed);
console.log(
`User: ${Member.tag} (${Member.id}) Just Got Kicked From ${
message.guild.name
} For ${Reason || "No Reason Provided!"}`
);
} catch (error) {
return message.channel
.send(
`I Can't Kick That Member Maybe Member Has Higher Role Than Me & My Role Is Lower Than Member!`
)
.then(() => console.log(error));
}

//End
}
};
56 changes: 56 additions & 0 deletions commands/moderation/mute.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
const Discord = require("discord.js");
const { MessageEmbed } = require("discord.js");
const { Color } = require("../../config.js");

module.exports = {
name: "mute",
aliases: [],
description: "Mute A User!",
usage: "Mute <Mention User> | <Reason>",
run: async (client, message, args) => {
//Start
message.delete();

if (!message.member.hasPermission("MANAGE_SERVER"))
return message.channel.send(
`You Don't Have Permission To Use This Command!`
);

let Member =
message.mentions.members.first() ||
message.guild.members.cache.get(args[0]);

if (!Member) return message.channel.send(`Please Mention A User!`);

let Role = message.guild.roles.cache.find(role => role.name === "Muted").id;

if (!Role)
return message.channel.send(
`Please Create Mute Role | Role Name : Muted`
);

if (Member.roles.cache.has(Role)) {
return message.channel.send(`Member Is Already Muted!`);
}

let Reason = args.slice(1).join(" ");

let Embed = new MessageEmbed()
.setColor(Color)
.setTitle(`Member Muted!`)
.addField(`Moderator`, `${message.author.tag} (${message.author.id}`)
.addField(`Muted Member`, `${Member.user.tag} (${Member.user.id})`)
.addField(`Reason`, `${Reason || "No Reason Provided!"}`)
.setFooter(`Requested by ${message.author.username}`)
.setTimestamp();

if (Role && !Member.roles.cache.has(Role)) {
Member.roles.add([Role]);
return message.channel.send(Embed);
} else {
return message.channel.send(`Something Went Wrong, Try Again Later!`);
}

//End
}
};
74 changes: 74 additions & 0 deletions commands/moderation/unban.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
const Discord = require("discord.js");
const { MessageEmbed } = require("discord.js");
const { Color } = require("../../config.js");

module.exports = {
name: "unban",
aliases: [],
description: "Unban A Member!",
usage: "Unban <Member ID>",
run: async (client, message, args) => {
//Start
message.delete();
if (!message.member.hasPermission("BAN_MEMBERS"))
return message.channel.send(
`You Don't Have Permission To Use This Command!`
);

if (!args[0])
return message.channel.send(
`Please Give Me Member ID That You Want To Unban!`
);

if (isNaN(args[0])) return message.channel.send(`Please Give Me Valid ID!`);

if (args[0] === message.author.id)
return message.channel.send(`You Are Already Unban!`);

if (args[0] === message.guild.owner.user.id)
return message.channel.send(`Server Owner Is Already Unban!`);

if (args[0] === client.user.id)
return message.channel.send(`I Am Already Unban!`);

let FetchBan = await message.guild.fetchBans();

let Member;
Member =
FetchBan.find(
b => b.user.username.toLowerCase() === args[0].toLocaleLowerCase()
) ||
FetchBan.get(args[0]) ||
FetchBan.find(
bm => bm.user.tag.toLowerCase() === args[0].toLocaleLowerCase()
);

if (!Member)
return message.channel.send(
"Please Give Valid Member ID Or Member Is Not Banned!"
);

let Reason = args.slice(1).join(" ") || "No Reason Provided!";

try {
message.guild.members.unban(Member.user.id, Reason);
} catch (error) {
return message.channel.send(
`I Can't Unban That Member Maybe Member Is Not Banned Or Some Error!`
);
}

let embed = new MessageEmbed()
.setColor(Color)
.setTitle(`Member Unbanned!`)
.addField(`Moderator`, `${message.author.tag} (${message.author.id}}`)
.addField(`Unbanned Member`, `${Member.user.tag} (${Member.user.id}`)
.addField(`Reason`, `${Reason || "No Reason Provided!"}`)
.setFooter(`Requested by ${message.author.username}`)
.setTimestamp();

return message.channel.send(embed);

//End
}
};
Loading

0 comments on commit ceb56ab

Please sign in to comment.