├── README.md ├── commands └── info │ └── ping.js ├── config.json ├── events ├── AFKsystem.js ├── channelCreate.js ├── channelDelete.js ├── channelUpdate.js ├── interactionCreate.js ├── messageCreate.js ├── messageDelete.js ├── messageUpdate.js └── ready.js ├── handler └── index.js ├── index.js ├── models ├── afkModel.js ├── warnDB.js └── warnModel.js └── slashcommands └── info ├── afkremove.js ├── afkset.js ├── avatar.js ├── ban.js ├── info.js ├── invite.js ├── ping.js ├── set-channel.js ├── set-color.js ├── timeout.js └── warnings.js /README.md: -------------------------------------------------------------------------------- 1 | # SlashCommands -------------------------------------------------------------------------------- /commands/info/ping.js: -------------------------------------------------------------------------------- 1 | const { Client, CommandInteraction } = require("discord.js"); 2 | 3 | module.exports = { 4 | name: "ping", 5 | description: "returns websocket ping", 6 | type: 'CHAT_INPUT', 7 | /** 8 | * 9 | * @param {Client} client 10 | * @param {CommandInteraction} interaction 11 | * @param {String[]} args 12 | */ 13 | run: async (client, interaction, args) => { 14 | interaction.followUp({ content: `${client.ws.ping}ms!` }); 15 | }, 16 | }; -------------------------------------------------------------------------------- /config.json: -------------------------------------------------------------------------------- 1 | { 2 | "token": "", 3 | "prefix": "", 4 | "mongooseConnectionString": "" 5 | } 6 | -------------------------------------------------------------------------------- /events/AFKsystem.js: -------------------------------------------------------------------------------- 1 | const { Message, MessageEmbed } = require('discord.js') 2 | const db = require('../models/afkModel') 3 | const client = require('../index') 4 | const db1 = require('pro.db') 5 | const moment = require('moment') 6 | 7 | 8 | 9 | client.on('messageCreate', async message => { 10 | 11 | if (message.author.bot) return; 12 | let color = db1.get(`color_${message.guild.id}`) || "RANDOM"; 13 | if (message.mentions.members.size) { 14 | message.mentions.members.forEach((m)=> { 15 | db.findOne({GuildId: message.guild.id, UserId: m.id},async(err,data) => { 16 | if(err) return message.reply(err) 17 | if (data) { 18 | let embed = new MessageEmbed() 19 | .setColor(color) 20 | .addField(`${m.user.username} in afk `,``) 21 | .addField(`Status :`,`${data.Status}`) 22 | .setFooter(client.user.username, client.user.avatarURL({dynamic:true})) 23 | message.reply({embeds:[embed]}) 24 | } 25 | }) 26 | }) 27 | } 28 | 29 | 30 | }) -------------------------------------------------------------------------------- /events/channelCreate.js: -------------------------------------------------------------------------------- 1 | const { MessageEmbed, Discord, Collection } = require('discord.js'); 2 | const db = require('pro.db'); 3 | const client = require('../index.js'); 4 | 5 | 6 | client.on('channelCreate', async (channel) => { 7 | let color = db.get(`color_${channel.guild.id}`) || "RED"; 8 | let room = await db.get(`log_${channel.guild.id}`) 9 | if (room) { 10 | let embed = new MessageEmbed() 11 | .setAuthor(channel.guild.name, channel.guild.iconURL({dynamic:true})) 12 | .addField(`New Channel Has Been created `,`${channel}`,true) 13 | .setTimestamp() 14 | .setColor(color) 15 | .setFooter(channel.guild.name, channel.guild.iconURL({dynamic:true})) 16 | channel.guild.channels.cache.get(room).send({ embeds: [embed] }); 17 | } else { 18 | return; 19 | } 20 | 21 | }) -------------------------------------------------------------------------------- /events/channelDelete.js: -------------------------------------------------------------------------------- 1 | const { MessageEmbed, Discord, Collection } = require('discord.js'); 2 | const db = require('pro.db'); 3 | const client = require('../index.js'); 4 | 5 | 6 | client.on('channelDelete', async (channel) => { 7 | let color = db.get(`color_${channel.guild.id}`) || "RED"; 8 | let room = await db.get(`log_${channel.guild.id}`) 9 | if (room) { 10 | let embed = new MessageEmbed() 11 | .setAuthor(channel.guild.name, channel.guild.iconURL({dynamic:true})) 12 | .addField(`New Channel Has Been Deleted `,`${channel.name}`,true) 13 | .setTimestamp() 14 | .setColor(color) 15 | .setFooter(channel.guild.name, channel.guild.iconURL({dynamic:true})) 16 | channel.guild.channels.cache.get(room).send({ embeds: [embed] }); 17 | } else { 18 | return; 19 | } 20 | 21 | }) -------------------------------------------------------------------------------- /events/channelUpdate.js: -------------------------------------------------------------------------------- 1 | const { MessageEmbed, Discord, Collection } = require('discord.js'); 2 | const db = require('pro.db'); 3 | const client = require('../index.js'); 4 | 5 | 6 | client.on('channelUpdate', async (newchannel,oldchannel) => { 7 | let color = db.get(`color_${newchannel.guild.id}`) || "RED"; 8 | let room = await db.get(`log_${newchannel.guild.id}`) 9 | if (room) { 10 | if (oldchannel.name !== newchannel.name) { 11 | let embed = new MessageEmbed() 12 | .setAuthor('Edit Channel Name') 13 | .addField(`Old Channel Name `,`${oldchannel.name}`,true) 14 | .addField(`New channel Name :`, `${newchannel.name}`,true) 15 | .setTimestamp() 16 | .setColor(color) 17 | .setFooter(newchannel.guild.name, newchannel.guild.iconURL({dynamic:true})) 18 | newchannel.guild.channels.cache.get(room).send({ embeds: [embed] }); 19 | } 20 | } else { 21 | return; 22 | } 23 | 24 | }) -------------------------------------------------------------------------------- /events/interactionCreate.js: -------------------------------------------------------------------------------- 1 | const client = require("../index"); 2 | 3 | client.on("interactionCreate", async (interaction) => { 4 | // Slash Command Handling 5 | if (interaction.isCommand()) { 6 | await interaction.deferReply({ ephemeral: false }).catch(() => {}); 7 | 8 | const cmd = client.slashCommands.get(interaction.commandName); 9 | if (!cmd) 10 | return interaction.followUp({ content: "An error has occured " }); 11 | 12 | const args = []; 13 | 14 | for (let option of interaction.options.data) { 15 | if (option.type === "SUB_COMMAND") { 16 | if (option.name) args.push(option.name); 17 | option.options?.forEach((x) => { 18 | if (x.value) args.push(x.value); 19 | }); 20 | } else if (option.value) args.push(option.value); 21 | } 22 | interaction.member = interaction.guild.members.cache.get(interaction.user.id); 23 | 24 | if(!interaction.member.permissions.has(cmd.userPermission || [])) return interaction.followUp({ content: `You Dont Have Permission To Use This Command` }) 25 | 26 | cmd.run(client, interaction, args); 27 | } 28 | 29 | // Context Menu Handling 30 | if (interaction.isContextMenu()) { 31 | await interaction.deferReply({ ephemeral: false }); 32 | const command = client.slashCommands.get(interaction.commandName); 33 | if (command) command.run(client, interaction); 34 | } 35 | }); -------------------------------------------------------------------------------- /events/messageCreate.js: -------------------------------------------------------------------------------- 1 | const client = require("../index"); 2 | 3 | client.on("messageCreate", async (message) => { 4 | if ( 5 | message.author.bot || 6 | !message.guild || 7 | !message.content.toLowerCase().startsWith(client.config.prefix) 8 | ) 9 | return; 10 | 11 | const [cmd, ...args] = message.content 12 | .slice(client.config.prefix.length) 13 | .trim() 14 | .split(/ +/g); 15 | 16 | const command = client.commands.get(cmd.toLowerCase()) || client.commands.find(c => c.aliases?.includes(cmd.toLowerCase())); 17 | 18 | if (!command) return; 19 | await command.run(client, message, args); 20 | }); -------------------------------------------------------------------------------- /events/messageDelete.js: -------------------------------------------------------------------------------- 1 | const { MessageEmbed, Discord, Collection } = require('discord.js'); 2 | const db = require('pro.db'); 3 | const client = require('../index.js'); 4 | 5 | 6 | client.on('messageDelete', async (message) => { 7 | if (message.author.bot) return; 8 | if (message.channel.type === 'dm') return; 9 | 10 | let color = db.get(`color_${message.guild.id}`) || "RED"; 11 | let channel = await db.get(`log_${message.guild.id}`) 12 | if (channel) { 13 | const embed = new MessageEmbed() 14 | .setTitle('New Message Deleted') 15 | .setAuthor(message.author.username, message.author.avatarURL({dynamic: true})) 16 | .addField('** Message Content ** ', ` \`\`\`diff\n- ${message.content}\`\`\` ` , true) 17 | .addField(`By : `, `${message.author}` , true) 18 | .addField('In : ', `${message.channel}` , true) 19 | .setColor(color) 20 | .setFooter(client.user.username, client.user.avatarURL({dynamic: true})) 21 | message.guild.channels.cache.get(channel).send({ embeds: [embed] }); 22 | } else { 23 | return; 24 | } 25 | 26 | }); 27 | -------------------------------------------------------------------------------- /events/messageUpdate.js: -------------------------------------------------------------------------------- 1 | const { MessageEmbed, Discord, Collection } = require('discord.js'); 2 | const db = require('pro.db'); 3 | const client = require('../index.js'); 4 | 5 | 6 | client.on('messageUpdate', async (message) => { 7 | if (message.author.bot) return; 8 | if (message.channel.type === 'dm') return; 9 | 10 | let color = db.get(`color_${message.guild.id}`) || "RED"; 11 | let channel = await db.get(`log_${message.guild.id}`) 12 | if (channel) { 13 | const embed = new MessageEmbed() 14 | .setTitle('New Message Updated') 15 | .setAuthor(message.author.username, message.author.avatarURL({dynamic: true})) 16 | .addField('** Old Message ** ', `\`\`\`diff\n ${message.content}\`\`\`` ) 17 | .addField(' ** New Message ** ', `\`\`\`diff\n ${message.reactions.message.content}\`\`\`` ) 18 | .addField('By :', `${message.author}` , true) 19 | .addField('In :', `${message.channel}`, true) 20 | .setColor(color) 21 | .setFooter(client.user.username, client.user.avatarURL({dynamic: true})) 22 | message.guild.channels.cache.get(channel).send({ embeds: [embed] }); 23 | } else { 24 | return; 25 | } 26 | 27 | }); 28 | -------------------------------------------------------------------------------- /events/ready.js: -------------------------------------------------------------------------------- 1 | const client = require("../index"); 2 | 3 | client.on("ready", () => 4 | console.log(`${client.user.tag} is up and ready to go!`) 5 | ); -------------------------------------------------------------------------------- /handler/index.js: -------------------------------------------------------------------------------- 1 | const { glob } = require("glob"); 2 | const { promisify } = require("util"); 3 | const { Client } = require("discord.js"); 4 | const mongoose = require("mongoose"); 5 | 6 | const globPromise = promisify(glob); 7 | 8 | /** 9 | * @param {Client} client 10 | */ 11 | module.exports = async (client) => { 12 | // Commands 13 | const commandFiles = await globPromise(`${process.cwd()}/commands/**/*.js`); 14 | commandFiles.map((value) => { 15 | const file = require(value); 16 | const splitted = value.split("/"); 17 | const directory = splitted[splitted.length - 2];ض 18 | 19 | if (file.name) { 20 | const properties = { directory, ...file }; 21 | client.commands.set(file.name, properties); 22 | } 23 | }); 24 | 25 | // Events 26 | const eventFiles = await globPromise(`${process.cwd()}/events/*.js`); 27 | eventFiles.map((value) => require(value)); 28 | 29 | // Slash Commands 30 | const slashCommands = await globPromise( 31 | `${process.cwd()}/SlashCommands/*/*.js` 32 | ); 33 | 34 | const arrayOfSlashCommands = []; 35 | slashCommands.map((value) => { 36 | const file = require(value); 37 | if (!file?.name) return; 38 | client.slashCommands.set(file.name, file); 39 | 40 | if (["MESSAGE", "USER"].includes(file.type)) delete file.description; 41 | arrayOfSlashCommands.push(file); 42 | }); 43 | client.on("ready", async () => { 44 | // Register for a single guild 45 | await client.guilds.cache 46 | .get("890594806504488960") 47 | .commands.set(arrayOfSlashCommands); 48 | 49 | // Register for all the guilds the bot is in 50 | // await client.application.commands.set(arrayOfSlashCommands); 51 | }); 52 | 53 | // mongoose 54 | const { mongooseConnectionString } = require('../config.json') 55 | if (!mongooseConnectionString) return; 56 | 57 | mongoose.connect(mongooseConnectionString).then(() => console.log('Connected to mongodb')); 58 | }; 59 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const { Client, Collection } = require("discord.js"); 2 | 3 | const client = new Client({ 4 | intents: 32767, 5 | }); 6 | module.exports = client; 7 | 8 | // Global Variables 9 | client.commands = new Collection(); 10 | client.slashCommands = new Collection(); 11 | client.config = require("./config.json"); 12 | 13 | // Initializing the project 14 | require("./handler")(client); 15 | 16 | client.login(client.config.token); 17 | -------------------------------------------------------------------------------- /models/afkModel.js: -------------------------------------------------------------------------------- 1 | const { Schema, model } = require('mongoose') 2 | 3 | module.exports = new model('AFK', new Schema({ 4 | GuildId : String, 5 | UserId: String, 6 | Status: String, 7 | Time: Number, 8 | })) -------------------------------------------------------------------------------- /models/warnDB.js: -------------------------------------------------------------------------------- 1 | const { Schema, model } = require('mongoose'); 2 | 3 | module.exports = model( 4 | "warnings", 5 | new Schema({ 6 | GuildID: String, 7 | UserID: String, 8 | UserTag: String, 9 | Content: Array, 10 | }) 11 | ); -------------------------------------------------------------------------------- /models/warnModel.js: -------------------------------------------------------------------------------- 1 | 2 | const { Schema, model } = require('mongoose'); 3 | 4 | module.exports = model( 5 | "warningsDB", 6 | new Schema({ 7 | userId: String, 8 | guildId: String, 9 | moderatorId: String, 10 | reason: String, 11 | timestamp: Number, 12 | }) 13 | ); -------------------------------------------------------------------------------- /slashcommands/info/afkremove.js: -------------------------------------------------------------------------------- 1 | const { Client, CommandInteraction, MessageEmbed, GuildEmojiRoleManager } = require('discord.js') 2 | const db = require('../../models/afkModel') 3 | const db1 = require('pro.db') 4 | 5 | module.exports = { 6 | name: 'afkremove', 7 | description: 'afk system', 8 | /** 9 | * @param {Client} client 10 | * @param {CommandInteraction} interaction 11 | */ 12 | run: async(client, interaction) => { 13 | if (interaction.user.bot) return; 14 | let color = db1.get(`color_${interaction.guild.id}`) || "RANDOM"; 15 | try { 16 | 17 | await db.deleteOne({GuildId: interaction.guildId, UserId: interaction.user.id}) 18 | let embed = new MessageEmbed() 19 | .setAuthor(interaction.user.username, interaction.user.avatarURL({dynamic:true})).setColor(color).setDescription(`Your Afk Status has been removed`) 20 | await interaction.followUp({embeds: [embed]}) 21 | } catch(err) { 22 | console.log(err) 23 | } 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /slashcommands/info/afkset.js: -------------------------------------------------------------------------------- 1 | const { Client, CommandInteraction, MessageEmbed, GuildEmojiRoleManager } = require('discord.js') 2 | const db = require('../../models/afkModel') 3 | const db1 = require('pro.db') 4 | 5 | module.exports = { 6 | name: 'afkset', 7 | description: 'afk system', 8 | options: [ 9 | 10 | { 11 | name: 'status', 12 | description: 'set afk status', 13 | type: "STRING", 14 | required: true, 15 | 16 | } 17 | ], 18 | /** 19 | * @param {Client} client 20 | * @param {CommandInteraction} interaction 21 | */ 22 | run: async(client, interaction) => { 23 | if (interaction.user.bot) return; 24 | let color = db1.get(`color_${interaction.guild.id}`) || "RANDOM"; 25 | try { 26 | const afkstatus = interaction.options.getString('status') 27 | await db.findOneAndUpdate({GuildId: interaction.guildId, UserId: interaction.user.id},{Status:afkstatus, Time: parseInt(interaction.createdTimestamp / 1000)},{new:true,upsert:true}) 28 | let embed = new MessageEmbed() 29 | .setAuthor(interaction.user.username, interaction.user.avatarURL({dynamic:true})).setColor(color).setDescription(`Your Afk Status has been setting to ${afkstatus}`) 30 | await interaction.followUp({embeds: [embed]}) 31 | } catch(err) { 32 | console.log(err) 33 | } 34 | 35 | } 36 | } -------------------------------------------------------------------------------- /slashcommands/info/avatar.js: -------------------------------------------------------------------------------- 1 | const { MessageEmbed } = require('discord.js'); 2 | module.exports = { 3 | name: 'avatar', 4 | description: 'Get a member avatar', 5 | options: [ 6 | { 7 | name: 'user', 8 | description: 'the targeted user', 9 | type: 'USER' 10 | } 11 | ], 12 | run: async function(client, interaction, args) { 13 | let color = db1.get(`color_${interaction.guild.id}`) || "RANDOM"; 14 | let user = interaction.guild.members.cache.get(args[0]) || interaction.member; 15 | 16 | let embed = new MessageEmbed() 17 | .setColor(color) 18 | .setAuthor(interaction.user.tag, interaction.user.avatarURL({ dynamic: true })) 19 | .setImage(user.user.displayAvatarURL({ dynamic: true, size: 1024 })) 20 | .setTitle(`${user.user.username}`) 21 | .setURL(user.user.displayAvatarURL({ dynamic: true, size: 1024 })) 22 | 23 | await interaction.followUp({ embeds: [embed] }) 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /slashcommands/info/ban.js: -------------------------------------------------------------------------------- 1 | const { MessageEmbed } = require('discord.js') 2 | module.exports = { 3 | name: 'ban', 4 | description: 'Ban Anyone', 5 | userPermissions: "BAN_MEMBERS", 6 | options: [ 7 | { 8 | name: 'user', 9 | description: 'The User', 10 | type: 'USER', 11 | required: true 12 | }, 13 | { 14 | name: 'reason', 15 | description: 'reason', 16 | type: 'STRING' 17 | } 18 | ], 19 | 20 | run: async function(client, interaction, args) { 21 | 22 | let user = interaction.guild.members.cache.get(args[0]); 23 | 24 | if (!user) return interaction.followUp(`User?`) 25 | 26 | let reason = args[1]; 27 | 28 | if (!interaction.guild.me.permissions.has('BAN_MEMBERS')) return interaction.followUp(`I Dont Have Permission`) 29 | 30 | if (user.roles.highest.position >= interaction.guild.me.roles.highest.position 31 | && interaction.member.id !== interaction.guild.ownerId) return interaction.followUp(`I Cant Ban This User`) 32 | 33 | if (user.roles.highest.position >= interaction.user.roles.highest.position 34 | && interaction.user.id !== interaction.guild.ownerId) return interaction.followUp(`I Cant Ban This User`) 35 | 36 | if (!member.bannable) return interaction.followUp(`I Cant Ban This User`); 37 | 38 | member.ban({ days: 99, reason: reason }).then(() => { 39 | 40 | interaction.followUp({ content:`Done Banned ${user.user.username}`, ephemeral: true}) 41 | 42 | }) 43 | }, 44 | }; 45 | -------------------------------------------------------------------------------- /slashcommands/info/info.js: -------------------------------------------------------------------------------- 1 | const { MessageActionRow, MessageButton, MessageEmbed } = require('discord.js'); 2 | 3 | module.exports = { 4 | name: 'info', 5 | description: 'View all info', 6 | cooldown: 10, 7 | options: [ 8 | { 9 | name: 'user', 10 | description: 'the targeted user', 11 | type: 'USER' 12 | } 13 | ], 14 | run: async function(client, interaction) { 15 | let color = db1.get(`color_${interaction.guild.id}`) || "RANDOM"; 16 | let user = interaction.guild.members.cache.get(args[0]) || interaction.member; 17 | const embed = new MessageEmbed() 18 | .setColor(color) 19 | .setTitle('Info') 20 | .addField(`__**Info**__`, `Username: ${user.user.username}\nID: ${user.id}`) 21 | .addField(`__**Server Info**__`,`Server name: ${interaction.guild.name}\nTotal members: ${interaction.guild.memberCount}`) 22 | await interaction.followUp({embeds: [embed] , ephemeral: true}) 23 | }} 24 | -------------------------------------------------------------------------------- /slashcommands/info/invite.js: -------------------------------------------------------------------------------- 1 | const { MessageActionRow, MessageButton, MessageEmbed } = require('discord.js'); 2 | const owner = ''//owner id 3 | module.exports = { 4 | name: 'invite', 5 | description: 'invite bot', 6 | run: async function(client, interaction, args) { 7 | let color = db1.get(`color_${interaction.guild.id}`) || "RANDOM"; 8 | const row = new MessageActionRow() 9 | 10 | .addComponents( 11 | new MessageButton() 12 | .setEmoji('✔️') 13 | .setLabel('Click Here to Invite Bot') 14 | .setURL(`رابط البوت`) 15 | .setStyle('LINK'), 16 | ) 17 | 18 | const embed = new MessageEmbed() 19 | .setThumbnail(client.user.avatarURL()) 20 | .setDescription(` 21 | - Ping \`${client.ws.ping}\` 22 | - Servers \`${client.guilds.cache.size}\` 23 | - Creator : <@${owner}> 24 | - Users \`${client.users.cache.size}\` 25 | `) 26 | .setColor(color) 27 | 28 | await interaction.followUp({ embeds: [embed], components: [row] }) 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /slashcommands/info/ping.js: -------------------------------------------------------------------------------- 1 | const { Client, CommandInteraction } = require("discord.js"); 2 | 3 | module.exports = { 4 | name: "ping", 5 | description: "returns websocket ping", 6 | type: 'CHAT_INPUT', 7 | /** 8 | * 9 | * @param {Client} client 10 | * @param {CommandInteraction} interaction 11 | * @param {String[]} args 12 | */ 13 | run: async (client, interaction, args) => { 14 | interaction.followUp({ content: `${client.ws.ping}ms!` },true); 15 | }, 16 | }; -------------------------------------------------------------------------------- /slashcommands/info/set-channel.js: -------------------------------------------------------------------------------- 1 | const { Client, CommandInteraction, MessageEmbed, MessageActionRow, MessageSelectMenu, MessageButton} = require("discord.js"); 2 | const { readdirSync } = require("fs"); 3 | 4 | const db = require('pro.db'); 5 | 6 | module.exports = { 7 | name: "set-channel", 8 | description: "Set the channel where the bot will send the ghost pings information", 9 | type: 'CHAT_INPUT', 10 | userPermission: ['ADMINISTRATOR'], 11 | options: [ 12 | { 13 | name: 'channel', 14 | description: 'The channel where the bot will send the ghost pings information', 15 | type: 'CHANNEL', 16 | required: true 17 | } 18 | ], 19 | run: async (client, interaction) => { 20 | const channel = interaction.options.getChannel("channel"); 21 | 22 | 23 | 24 | 25 | db.set(`log_${interaction.guild.id}`, channel.id) 26 | 27 | let color = db.get(`color_${interaction.guild.id}`) || "RANDOM"; 28 | 29 | const embed = new MessageEmbed() 30 | .setAuthor(`${client.user.username}`, client.user.displayAvatarURL()) 31 | .setDescription(`${channel} has been setting a logs room`) 32 | .setColor(color) 33 | 34 | return interaction.followUp({ embeds: [embed] }) 35 | }, 36 | }; -------------------------------------------------------------------------------- /slashcommands/info/set-color.js: -------------------------------------------------------------------------------- 1 | const { Client, CommandInteraction, MessageEmbed, MessageActionRow, MessageSelectMenu, MessageButton} = require("discord.js"); 2 | const { readdirSync } = require("fs"); 3 | const config = require('../../config.json') 4 | const db = require('pro.db'); 5 | 6 | module.exports = { 7 | name: "set-color", 8 | description: "Set the color of the embeds", 9 | type: 'CHAT_INPUT', 10 | userPermission: ["ADMINISTRATOR"], 11 | options: [ 12 | { 13 | name: 'color', 14 | description: 'What color should the embeds have?', 15 | type: 'STRING', 16 | required: true, 17 | choices: [ 18 | { 19 | name: "Random", 20 | value: "RANDOM" 21 | }, 22 | { 23 | name: "Red", 24 | value: "RED" 25 | }, 26 | { 27 | name: "Aqua", 28 | value: "AQUA" 29 | }, 30 | { 31 | name: "Dark Aqua", 32 | value: "DARK_AQUA" 33 | }, 34 | { 35 | name: "Green", 36 | value: "GREEN" 37 | }, 38 | { 39 | name: "Dark Green", 40 | value: "DARK_GREEN" 41 | }, 42 | { 43 | name: "Blue", 44 | value: "BLUE" 45 | }, 46 | { 47 | name: "Dark Blue", 48 | value: "DARK_BLUE" 49 | }, 50 | { 51 | name: "Purple", 52 | value: "PURPLE" 53 | }, 54 | { 55 | name: "Dark Purple", 56 | value: "DARK_PURPLE" 57 | }, 58 | { 59 | name: "Luminous Vivid Pink", 60 | value: "LUMINOUS_VIVID_PINK" 61 | }, 62 | { 63 | name: "Dark Vivid Pink", 64 | value: "DARK_VIVID_PINK" 65 | }, 66 | { 67 | name: "Gold", 68 | value: "GOLD" 69 | }, 70 | { 71 | name: "Dark Gold", 72 | value: "DARK_GOLD" 73 | }, 74 | { 75 | name: "Orange", 76 | value: "ORANGE" 77 | }, 78 | { 79 | name: "Dark Orange", 80 | value: "DARK_ORANGE" 81 | }, 82 | { 83 | name: "Dark Red", 84 | value: "DARK_RED" 85 | }, 86 | { 87 | name: "Grey", 88 | value: "GREY" 89 | }, 90 | { 91 | name: "Dark Grey", 92 | value: "DARK_GREY" 93 | }, 94 | { 95 | name: "Darker Grey", 96 | value: "DARKER_GREY" 97 | }, 98 | { 99 | name: "Light Grey", 100 | value: "LIGHT_GREY" 101 | }, 102 | { 103 | name: "Navy", 104 | value: "NAVY" 105 | }, 106 | { 107 | name: "Dark Navy", 108 | value: "DARK_NAVY" 109 | }, 110 | { 111 | name: "Yellow", 112 | value: "YELLOW" 113 | }, 114 | { 115 | name: "White", 116 | value: "WHITE" 117 | } 118 | ] 119 | } 120 | ], 121 | run: async (client, interaction) => { 122 | const color = interaction.options.getString("color"); 123 | 124 | db.set(`color_${interaction.guild.id}`, color) 125 | 126 | const embed = new MessageEmbed() 127 | .setAuthor(`${client.user.username}`, client.user.displayAvatarURL()) 128 | .setDescription(`${color} has been setting the new embed color`) 129 | .setColor(color) 130 | 131 | interaction.followUp({ embeds: [embed] }) 132 | }, 133 | }; -------------------------------------------------------------------------------- /slashcommands/info/timeout.js: -------------------------------------------------------------------------------- 1 | const { Client, CommandInteraction } = require('discord.js') 2 | const ms = require("ms"); 3 | 4 | 5 | module.exports = { 6 | name: 'timeout', 7 | description: 'give timeout to user', 8 | options: [ 9 | { 10 | name: 'user', 11 | description: 'user you want to give timeout', 12 | type: 'USER', 13 | required: true 14 | }, 15 | { 16 | name: 'time', 17 | description: 'time of timeout', 18 | type: 'STRING', 19 | required: true 20 | }, 21 | { 22 | name: 'reason', 23 | description: 'timeout reason', 24 | type: 'STRING', 25 | required: true 26 | }, 27 | ], 28 | /** 29 | * @param {Client} client 30 | * @param {CommandInteraction} interaction 31 | */ 32 | run: async(client, interaction) => { 33 | const user = interaction.options.getUser('user') 34 | const time = interaction.options.getString('time') 35 | const reason = interaction.options.getString('reason') 36 | const member = interaction.guild.members.cache.get(user.id) 37 | const timems = ms(time); 38 | if (!timems) return interaction.followUp({ content: 'enter a valid time' }) 39 | member.timeout(timems, reason); 40 | interaction.followUp({ content: `${user} has been timeouted for ${time}! with reason : ${reason}` }) 41 | 42 | } 43 | } -------------------------------------------------------------------------------- /slashcommands/info/warnings.js: -------------------------------------------------------------------------------- 1 | const { Client, CommandInteraction, MessageEmbed, DiscordAPIError } = require('discord.js') 2 | const db = require('../../models/warnDB') 3 | const db1 = require('pro.db') 4 | 5 | module.exports = { 6 | name:'warnings', 7 | description: 'warnings system', 8 | options: [ 9 | { 10 | name: 'add', 11 | description: 'Add Warn', 12 | type: 'SUB_COMMAND', 13 | options: [ 14 | { 15 | name: 'user', 16 | description: 'user you want to warn', 17 | type: 'USER', 18 | required: true, 19 | }, 20 | { 21 | name: 'reason', 22 | description: 'warn reason', 23 | type: 'STRING', 24 | required: true, 25 | }, 26 | ], 27 | }, 28 | { 29 | name: 'list', 30 | description: 'warnings list', 31 | type: 'SUB_COMMAND', 32 | options: [ 33 | { 34 | name: 'user', 35 | description: 'user you want to view warns', 36 | type: 'USER', 37 | required: true, 38 | }, 39 | ], 40 | }, 41 | { 42 | name: 'remove', 43 | description: 'remove warn', 44 | type: 'SUB_COMMAND', 45 | options: [ 46 | { 47 | name: 'user', 48 | description: 'user you want to remove warn', 49 | type: 'USER', 50 | required: true, 51 | }, 52 | { 53 | name: 'id', 54 | description: 'warn id', 55 | type: "NUMBER", 56 | required: true, 57 | } 58 | ], 59 | }, 60 | { 61 | name: 'clear', 62 | description: 'clear warnings', 63 | type: 'SUB_COMMAND', 64 | options: [ 65 | { 66 | name: 'user', 67 | description: 'user you want to warn', 68 | type: 'USER', 69 | required: true, 70 | }, 71 | ], 72 | }, 73 | ], 74 | /** 75 | * @param {Client} client 76 | * @param {CommandInteraction} interaction 77 | */ 78 | run: async(client, interaction) => { 79 | const Sub = interaction.options.getSubcommand(["add","list","remove","clear"]) 80 | const Target = interaction.options.getUser('user') 81 | const reason = interaction.options.getString('reason') 82 | const WarnId = interaction.options.getNumber('id') + 1; 83 | const WarnDate = new Date(interaction.createdTimestamp).toLocaleDateString() 84 | let color = db1.get(`color_${interaction.guild.id}`) || "RANDOM"; 85 | if (Sub === "add") { 86 | db.findOne({ GuildId : interaction.guildId, UserId: Target.id, UserTag: Target.username }, async(err, data) => { 87 | if (err) throw err; 88 | if (!data) { 89 | data = new db({ 90 | GuildId: interaction.guildId, 91 | UserId: Target.id, 92 | UserTag: Target.username, 93 | Content: [ 94 | { 95 | AuthorId : interaction.user.id, 96 | AuthorTag : interaction.user.tag, 97 | Reason: reason, 98 | Date: WarnDate, 99 | } 100 | ], 101 | }) 102 | } else { 103 | const object = { 104 | AuthorId : interaction.user.id, 105 | AuthorTag : interaction.user.tag, 106 | Reason: reason, 107 | Date: WarnDate, 108 | } 109 | data.Content.push(object) 110 | }data.save() 111 | }) 112 | let embed = new MessageEmbed() 113 | .setColor(color) 114 | .setTitle(`Add Warn : ${Target.username}`) 115 | .addField('** Reason **', `${reason}`) 116 | .setFooter(`By : ${interaction.user.username}`, interaction.user.avatarURL({dynamic:true})) 117 | .setTimestamp() 118 | interaction.followUp({ embeds: [embed] }) 119 | } else if (Sub === "list"){ 120 | db.findOne({ GuildId : interaction.guildId, UserId: Target.id, UserTag: Target.username }, async (err, data) => { 121 | if(err) throw err; 122 | if (data) { 123 | console.log(data) 124 | interaction.followUp({ embeds: [new MessageEmbed() 125 | .setTitle(`Warn List : ${Target.username}`) 126 | .setColor(color) 127 | .setDescription(`${data.Content.map( 128 | (w,i) => `** Id ** : ${i + 1} \n ** By ** : ${w.AuthorTag} \n ** Date **: ${w.Date} \n ** Reason **: ${w.Reason ? w.Reason : "No Reason Provided"} \n` 129 | ).join(" ")}`) 130 | .setFooter(`By : ${interaction.user.username}`, interaction.user.avatarURL({dynamic:true})) 131 | .setTimestamp() 132 | ] }) 133 | } else { 134 | interaction.followUp({ embeds: [new MessageEmbed() 135 | .setTitle(`Warn List : ${Target.username}`) 136 | .setDescription(`${Target} Has No Warnings`) 137 | .setFooter(`By : ${interaction.user.username}`, interaction.user.avatarURL({dynamic:true})) 138 | .setTimestamp() 139 | ] }) 140 | } 141 | 142 | }) 143 | 144 | } else if (Sub === "remove"){ 145 | db.findOne({ GuildId : interaction.guildId, UserId: Target.id, UserTag: Target.username }, async (err, data) => { 146 | if (err) throw err; 147 | if (data) { 148 | data.Content.splice(WarnId, 1) 149 | interaction.followUp({ embeds: [ new MessageEmbed() 150 | .setColor(color) 151 | .setTitle(`Warn Remove : ${Target.username}`) 152 | .setDescription(`${Target} warn id : ${WarnId} has been removed`) 153 | .setFooter(`By : ${interaction.user.username}`, interaction.user.avatarURL({dynamic:true})) 154 | .setTimestamp() 155 | ] }) 156 | data.save() 157 | } else { 158 | interaction.followUp({ embeds: [new MessageEmbed() 159 | .setTitle(`Warn List : ${Target.username}`) 160 | .setDescription(`${Target} Has No Warnings`) 161 | .setFooter(`By : ${interaction.user.username}`, interaction.user.avatarURL({dynamic:true})) 162 | .setTimestamp() 163 | ] }) 164 | } 165 | }) 166 | } else if (Sub === "clear"){ 167 | db.findOne({ GuildId : interaction.guildId, UserId: Target.id, UserTag: Target.username },async(err,data) => { 168 | if (err) throw err; 169 | if (data) { 170 | await db.findOneAndDelete({ GuildId : interaction.guildId, UserId: Target.id, UserTag: Target.username }) 171 | interaction.followUp({ embeds : [new MessageEmbed() 172 | .setColor(color) 173 | .setTitle(`Clear warnings : ${Target.username}`) 174 | .setDescription(`done clear warnings for ${Target}, ${Target} has no warnings now`) 175 | .setFooter(`By : ${interaction.user.username}`, interaction.user.avatarURL({dynamic:true})) 176 | .setTimestamp() 177 | ]}) 178 | } else { 179 | interaction.followUp({ embeds: [new MessageEmbed() 180 | .setTitle(`Warn List : ${Target.username}`) 181 | .setDescription(`${Target} Has No Warnings`) 182 | .setFooter(`By : ${interaction.user.username}`, interaction.user.avatarURL({dynamic:true})) 183 | .setTimestamp() 184 | ] }) 185 | } 186 | 187 | }) 188 | } 189 | 190 | 191 | 192 | } 193 | } --------------------------------------------------------------------------------