├── src ├── models │ ├── BlacklistSystem.js │ ├── CaptchaSystem.js │ ├── ChatFilter.js │ ├── ModerationLogs.js │ ├── PremiumSystem.js │ ├── VoiceSystem.js │ ├── WarnSystem.js │ ├── ConfessionSettings.js │ ├── MuteSystem.js │ ├── LeaveSystem.js │ ├── SuggestSystem.js │ ├── ApplicationSystem.js │ ├── AFKSystem.js │ ├── WelcomeSystem.js │ ├── LevelSystem.js │ ├── TicketSystem.js │ ├── ConfessionSystem.js │ ├── Ticket.js │ ├── ReactionRoles.js │ ├── Levels.js │ ├── Features.js │ └── Giveaway.js ├── utils │ ├── utils.js │ ├── updatePresence.js │ ├── levelsystem.js │ └── warnpoints.js ├── types │ ├── events │ │ ├── client │ │ │ ├── guildCreate.js │ │ │ ├── ready.js │ │ │ └── guildDelete.js │ │ ├── moderation │ │ │ └── channelCreate.js │ │ ├── messages │ │ │ ├── afkSystem.js │ │ │ └── levels.js │ │ ├── automoderation │ │ │ └── chatFilter.js │ │ ├── voice │ │ │ └── voice.js │ │ ├── commands │ │ │ └── interactionCreate.js │ │ └── guild │ │ │ ├── guildMemberRemove.js │ │ │ └── guildMemberAdd.js │ ├── commands │ │ ├── developer │ │ │ ├── ping.js │ │ │ ├── reload.js │ │ │ ├── botupdate.js │ │ │ └── suggest.js │ │ ├── user │ │ │ ├── membercount.js │ │ │ ├── invite.js │ │ │ ├── avatar.js │ │ │ ├── avatar_cmd.js │ │ │ ├── dm.js │ │ │ ├── apply.js │ │ │ ├── userinfo.js │ │ │ ├── userinfo_cmd.js │ │ │ ├── serverinfo.js │ │ │ ├── afk.js │ │ │ └── help.js │ │ ├── moderation │ │ │ ├── warn.js │ │ │ ├── unmute.js │ │ │ ├── giverole.js │ │ │ ├── checkwarns.js │ │ │ ├── unban.js │ │ │ ├── kick.js │ │ │ ├── ban.js │ │ │ ├── timeout.js │ │ │ ├── clear.js │ │ │ ├── warn_cmd.js │ │ │ ├── slowmode.js │ │ │ ├── lock.js │ │ │ ├── chatfilter.js │ │ │ └── mute.js │ │ ├── fun │ │ │ ├── meme.js │ │ │ ├── 8ball.js │ │ │ ├── weather.js │ │ │ ├── anime.js │ │ │ ├── together.js │ │ │ └── translate.js │ │ ├── system │ │ │ ├── support.js │ │ │ ├── announce.js │ │ │ ├── confession.js │ │ │ └── giveaway.js │ │ ├── levelSystem │ │ │ └── rank.js │ │ ├── ticket │ │ │ ├── Ticket.js │ │ │ └── ticket_cmd.js │ │ ├── voice │ │ │ └── temp.js │ │ └── setup │ │ │ └── reactionRoles.js │ └── components │ │ ├── selectMenus │ │ └── reaction-roles.js │ │ ├── buttons │ │ ├── lock-ticket.js │ │ ├── unlock-ticket.js │ │ ├── Suggestion-Accept.js │ │ ├── Suggestion-Decline.js │ │ ├── close-ticket.js │ │ ├── open-ticket.js │ │ └── captcha.js │ │ └── modals │ │ └── applicationModal.js ├── handlers │ ├── EventHandler.js │ ├── CommandHandler.js │ └── ComponentHandler.js ├── bot.js └── Systems │ └── GiveawaySystem.js ├── config.json ├── LICENSE ├── package.json ├── .gitignore └── README.md /src/models/BlacklistSystem.js: -------------------------------------------------------------------------------- 1 | const { model, Schema } = require('mongoose'); 2 | 3 | module.exports = model('BlacklistSystem', new Schema({ 4 | GuildID: String, 5 | })) -------------------------------------------------------------------------------- /src/models/CaptchaSystem.js: -------------------------------------------------------------------------------- 1 | const { model, Schema } = require('mongoose') 2 | 3 | module.exports = model("Captcha", new Schema({ 4 | GuildID: String, 5 | Role: String 6 | })) -------------------------------------------------------------------------------- /src/models/ChatFilter.js: -------------------------------------------------------------------------------- 1 | const { model, Schema } = require('mongoose') 2 | 3 | module.exports = model('ChatFilter', new Schema({ 4 | GuildID: String, 5 | Wordlist: Array 6 | })) -------------------------------------------------------------------------------- /src/models/ModerationLogs.js: -------------------------------------------------------------------------------- 1 | const { model, Schema } = require('mongoose') 2 | 3 | module.exports = model("modlogs", new Schema({ 4 | GuildID: String, 5 | ChannelID: String 6 | })) -------------------------------------------------------------------------------- /src/models/PremiumSystem.js: -------------------------------------------------------------------------------- 1 | const { model, Schema } = require('mongoose') 2 | 3 | module.exports = model("Premium", new Schema({ 4 | GuildID: String, 5 | Premium: Boolean 6 | })) -------------------------------------------------------------------------------- /src/models/VoiceSystem.js: -------------------------------------------------------------------------------- 1 | const { model, Schema } = require('mongoose') 2 | 3 | module.exports = model("VoiceSystem", new Schema({ 4 | GuildID: String, 5 | ChannelID: String 6 | })) -------------------------------------------------------------------------------- /src/utils/utils.js: -------------------------------------------------------------------------------- 1 | function isValidHexColor(color) { 2 | var RegExp = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i; 3 | return RegExp.test(color) 4 | } 5 | 6 | module.exports = { isValidHexColor } -------------------------------------------------------------------------------- /src/models/WarnSystem.js: -------------------------------------------------------------------------------- 1 | const { model, Schema } = require('mongoose'); 2 | 3 | module.exports = model("Warns", new Schema({ 4 | GuildID: String, 5 | UserID: String, 6 | Warns: Number 7 | })) -------------------------------------------------------------------------------- /src/models/ConfessionSettings.js: -------------------------------------------------------------------------------- 1 | const { model, Schema } = require('mongoose') 2 | 3 | module.exports = model("ConfessionSettings", new Schema({ 4 | GuildID: String, 5 | ChannelID: String, 6 | })) -------------------------------------------------------------------------------- /src/models/MuteSystem.js: -------------------------------------------------------------------------------- 1 | const { model, Schema } = require('mongoose') 2 | 3 | module.exports = model("MuteSystem", new Schema({ 4 | GuildID: String, 5 | UserID: String, 6 | Data: Array 7 | })) -------------------------------------------------------------------------------- /src/models/LeaveSystem.js: -------------------------------------------------------------------------------- 1 | const { model, Schema } = require('mongoose') 2 | 3 | module.exports = model("Leave", new Schema({ 4 | GuildID: String, 5 | ChannelID: String, 6 | Message: String, 7 | })) -------------------------------------------------------------------------------- /src/models/SuggestSystem.js: -------------------------------------------------------------------------------- 1 | const { model, Schema } = require('mongoose') 2 | 3 | module.exports = model("Suggest", new Schema({ 4 | GuildID: String, 5 | MessageID: String, 6 | Details: Array 7 | })) -------------------------------------------------------------------------------- /src/models/ApplicationSystem.js: -------------------------------------------------------------------------------- 1 | const { model, Schema } = require('mongoose') 2 | 3 | module.exports = model('Application', new Schema({ 4 | GuildID: String, 5 | ChannelID: String, 6 | Open: Boolean 7 | })) -------------------------------------------------------------------------------- /src/models/AFKSystem.js: -------------------------------------------------------------------------------- 1 | const { model, Schema } = require('mongoose') 2 | 3 | module.exports = model("AFK", new Schema({ 4 | GuildID: String, 5 | UserID: String, 6 | Status: String, 7 | Time: String 8 | })) -------------------------------------------------------------------------------- /src/models/WelcomeSystem.js: -------------------------------------------------------------------------------- 1 | const { model, Schema } = require('mongoose') 2 | 3 | module.exports = model("Welcome", new Schema({ 4 | GuildID: String, 5 | RoleID: String, 6 | ChannelID: String, 7 | Message: String, 8 | })) -------------------------------------------------------------------------------- /src/models/LevelSystem.js: -------------------------------------------------------------------------------- 1 | const { model, Schema } = require('mongoose'); 2 | 3 | module.exports = model('LevelSystem', new Schema({ 4 | GuildID: String, 5 | ChannelID: String, 6 | Message: String, 7 | Embed: Boolean, 8 | })) -------------------------------------------------------------------------------- /src/models/TicketSystem.js: -------------------------------------------------------------------------------- 1 | const { model, Schema } = require('mongoose') 2 | 3 | module.exports = model('Ticketsystem', new Schema({ 4 | GuildID: String, 5 | CategoryID: String, 6 | ChannelID: String, 7 | RoleIDs: Array, 8 | })) -------------------------------------------------------------------------------- /src/models/ConfessionSystem.js: -------------------------------------------------------------------------------- 1 | const { model, Schema } = require('mongoose') 2 | 3 | module.exports = model("Confession", new Schema({ 4 | GuildID: String, 5 | MemberID: String, 6 | MessageID: String, 7 | ConfessionID: Number, 8 | ChannelID: String 9 | })) -------------------------------------------------------------------------------- /src/models/Ticket.js: -------------------------------------------------------------------------------- 1 | const { model, Schema } = require('mongoose') 2 | 3 | module.exports = model('Tickets', new Schema({ 4 | GuildID: String, 5 | MemberID: String, 6 | ChannelID: String, 7 | Locked: Boolean, 8 | TicketID: String, 9 | CreatedAt: Number, 10 | })) -------------------------------------------------------------------------------- /src/models/ReactionRoles.js: -------------------------------------------------------------------------------- 1 | const { model, Schema } = require('mongoose') 2 | 3 | /** 4 | * - roleID: String, 5 | * - roleDescription: String, 6 | * - roleEmoji: String 7 | */ 8 | 9 | module.exports = model('ReactionRoles', new Schema({ 10 | GuildID: String, 11 | MessageID: String, 12 | Roles: Array 13 | })) -------------------------------------------------------------------------------- /src/models/Levels.js: -------------------------------------------------------------------------------- 1 | const { model, Schema } = require('mongoose') 2 | 3 | module.exports = model("Levels", new Schema({ 4 | GuildID: String, 5 | UserID: String, 6 | xp: { 7 | type: Number, 8 | default: 0, 9 | }, 10 | level: { 11 | type: Number, 12 | default: 1, 13 | }, 14 | })) -------------------------------------------------------------------------------- /config.json: -------------------------------------------------------------------------------- 1 | { 2 | "token": "DISCORD TOKEN", 3 | "color": "#34a6ef", 4 | "developerGuild": "GUILD ID", 5 | "database": "MongoDB Url", 6 | "supportServer": "DISCORD Invite Link", 7 | "activityInterval": 10, 8 | "activities": [ 9 | "/invite | dsc.gg/eve-bot", 10 | "/help | {servercount} servers" 11 | ]} 12 | -------------------------------------------------------------------------------- /src/models/Features.js: -------------------------------------------------------------------------------- 1 | const { model, Schema } = require('mongoose') 2 | 3 | module.exports = model("Features", new Schema({ 4 | GuildID: { 5 | type: String 6 | }, 7 | Welcome: Boolean, 8 | Leave: Boolean, 9 | Logs: Boolean, 10 | CaptchaSystem: Boolean, 11 | ConfessionSystem: Boolean, 12 | AutoModSystem: Boolean, 13 | LevelSystem: Boolean, 14 | EconomySystem: Boolean, 15 | })) -------------------------------------------------------------------------------- /src/types/events/client/guildCreate.js: -------------------------------------------------------------------------------- 1 | const { Client, EmbedBuilder, Guild } = require('discord.js'); 2 | const { updateActivity } = require('../../../utils/updatePresence') 3 | 4 | module.exports = { 5 | name: "guildCreate", 6 | rest: false, 7 | once: false, 8 | /** 9 | * @param { Guild } guild 10 | * @param { Client } client 11 | */ 12 | async execute(guild, client) { 13 | console.log(`Joined Server ${guild.name}`) 14 | 15 | updateActivity(client, client.config.activityInterval) 16 | } 17 | } -------------------------------------------------------------------------------- /src/types/events/moderation/channelCreate.js: -------------------------------------------------------------------------------- 1 | const { Client, GuildChannel } = require('discord.js'); 2 | 3 | module.exports = { 4 | name: "channelCreate", 5 | rest: false, 6 | once: false, 7 | /** 8 | * @param { Client } client 9 | * @param { GuildChannel } channel 10 | */ 11 | async execute(channel, client) { 12 | let mutedRole = channel.guild.roles.cache.find(role => role.name === "muted"); 13 | 14 | if(!mutedRole) return; 15 | 16 | channel.permissionOverwrites.edit(mutedRole.id, { SendMessages: false, Connect: false }) 17 | 18 | 19 | } 20 | } -------------------------------------------------------------------------------- /src/types/commands/developer/ping.js: -------------------------------------------------------------------------------- 1 | const { Client, SlashCommandBuilder, ChatInputCommandInteraction, PermissionFlagsBits } = require('discord.js'); 2 | 3 | module.exports = { 4 | data: new SlashCommandBuilder() 5 | .setName('ping') 6 | .setDescription('Pong') 7 | .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), 8 | /** 9 | * 10 | * @param {ChatInputCommandInteraction} interaction 11 | * @param {Client} client 12 | */ 13 | async execute(interaction, client) { 14 | interaction.reply(`🏓 **PONG! Api Ping is:** \`${client.ws.ping}ms\``) 15 | }, 16 | category: 'developer', 17 | developer: true 18 | } -------------------------------------------------------------------------------- /src/utils/updatePresence.js: -------------------------------------------------------------------------------- 1 | const { Client, ActivityType } = require('discord.js') 2 | 3 | /** 4 | * @param {Client} client 5 | */ 6 | async function updateActivity(client, interval) { 7 | 8 | const activities = client.config.activities 9 | 10 | const servercount = client.guilds.cache.size; 11 | const usercount = [] 12 | 13 | await client.guilds.cache.forEach(guild => { 14 | guild.members.cache.forEach(member => { 15 | if(member.user.bot) return; 16 | usercount.push(member) 17 | }) 18 | }) 19 | 20 | setInterval(() => { 21 | const status = activities[Math.floor(Math.random() * activities.length)] 22 | client.user.setActivity(status.replace("{servercount}", servercount)) 23 | }, interval*1000) 24 | } 25 | 26 | module.exports = { updateActivity } -------------------------------------------------------------------------------- /src/types/commands/user/membercount.js: -------------------------------------------------------------------------------- 1 | const { Client, SlashCommandBuilder, ChatInputCommandInteraction, EmbedBuilder } = require('discord.js') 2 | 3 | module.exports = { 4 | data: new SlashCommandBuilder() 5 | .setName('membercount') 6 | .setDescription('Display the count of members on the server') 7 | .setDMPermission(false), 8 | /** 9 | * @param {ChatInputCommandInteraction} interaction 10 | * @param {Client} client 11 | */ 12 | async execute(interaction, client) { 13 | const { guild } = interaction; 14 | const membercount = guild.memberCount 15 | 16 | const Embed = new EmbedBuilder() 17 | .setTitle('👥 Membercount') 18 | .setDescription(`We have ${membercount} members!`) 19 | .setColor(client.color) 20 | .setTimestamp(Date.now()); 21 | 22 | interaction.reply({embeds: [Embed]}); 23 | } 24 | } -------------------------------------------------------------------------------- /src/types/commands/moderation/warn.js: -------------------------------------------------------------------------------- 1 | const { addInteractionPoints } = require('../../../utils/warnpoints') 2 | const { Client, ContextMenuCommandBuilder, UserContextMenuCommandInteraction, EmbedBuilder, ApplicationCommandType, PermissionFlagsBits, TextInputStyle } = require('discord.js'); 3 | 4 | module.exports = { 5 | data: new ContextMenuCommandBuilder() 6 | .setName('Warn') 7 | .setDMPermission(false) 8 | .setDefaultMemberPermissions(PermissionFlagsBits.ModerateMembers) 9 | .setType(ApplicationCommandType.User), 10 | /** 11 | * 12 | * @param {UserContextMenuCommandInteraction} interaction 13 | * @param {Client} client 14 | */ 15 | async execute(interaction, client) { 16 | const target = await interaction.guild.members.fetch(interaction.targetId); 17 | 18 | addInteractionPoints(1, interaction, 'No reason given', target, client); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/types/commands/user/invite.js: -------------------------------------------------------------------------------- 1 | const { Client, SlashCommandBuilder, ChatInputCommandInteraction, EmbedBuilder } = require('discord.js') 2 | 3 | module.exports = { 4 | data: new SlashCommandBuilder() 5 | .setName('invite') 6 | .setDescription('Invite me to your Discord Server😀'), 7 | /** 8 | * @param { ChatInputCommandInteraction } interaction 9 | * @param { Client } client 10 | */ 11 | async execute(interaction, client) { 12 | const link = `https://discord.com/api/oauth2/authorize?client_id=${client.user.id}&permissions=8&scope=bot%20applications.commands` 13 | 14 | const Response = new EmbedBuilder() 15 | .setColor(client.color) 16 | .setDescription(`[💌 Invite Me](${link})`) 17 | .setFooter({text: client.user.username, iconURL: client.user.avatarURL()}) 18 | .setTimestamp(Date.now()) 19 | 20 | interaction.reply({embeds: [Response]}) 21 | } 22 | } -------------------------------------------------------------------------------- /src/types/components/selectMenus/reaction-roles.js: -------------------------------------------------------------------------------- 1 | const { Client, SelectMenuInteraction } = require('discord.js') 2 | 3 | module.exports = { 4 | data: { 5 | name: 'reaction-roles' 6 | }, 7 | /** 8 | * @param {SelectMenuInteraction} interaction 9 | * @param {Client} client 10 | */ 11 | async execute(interaction, client) { 12 | const roleID = interaction.values[0]; 13 | const role = interaction.guild.roles.cache.get(roleID); 14 | 15 | const hasRole = interaction.member.roles.cache.has(roleID); 16 | 17 | if(hasRole) { 18 | interaction.member.roles.remove(roleID); 19 | interaction.reply({ content: `${role.name} has been removed from you`, ephemeral: true }) 20 | } else { 21 | interaction.member.roles.add(roleID); 22 | interaction.reply({ content: `${role.name} has been added to you`, ephemeral: true }) 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/types/events/client/ready.js: -------------------------------------------------------------------------------- 1 | const { Client } = require('discord.js'); 2 | const mongoose = require('mongoose'); 3 | const { updateActivity } = require('../../../utils/updatePresence') 4 | 5 | module.exports = { 6 | name: "ready", 7 | rest: false, 8 | once: false, 9 | /** 10 | * @param { Client } client 11 | */ 12 | async execute(client) { 13 | /* Connect to the database */ 14 | const database = client.config.database; 15 | if(!database) return console.log('Please add a Database!'); 16 | 17 | mongoose.connect(database).then(() => { 18 | console.log(`Connected successfully to the Database!`); 19 | }) 20 | 21 | console.log(`Logged in as ${client.user.tag}!`); 22 | client.guilds.cache.forEach(guild => { 23 | console.log(`${guild.id} | ${guild.name}`); 24 | }) 25 | 26 | updateActivity(client, client.config.activityInterval) 27 | } 28 | } -------------------------------------------------------------------------------- /src/types/commands/user/avatar.js: -------------------------------------------------------------------------------- 1 | const { Client, ContextMenuCommandBuilder, UserContextMenuCommandInteraction, EmbedBuilder, ApplicationCommandType } = require('discord.js') 2 | 3 | module.exports = { 4 | data: new ContextMenuCommandBuilder() 5 | .setName('Avatar') 6 | .setDMPermission(false) 7 | .setType(ApplicationCommandType.User), 8 | /** 9 | * 10 | * @param {UserContextMenuCommandInteraction} interaction 11 | * @param {Client} client 12 | */ 13 | async execute(interaction, client) { 14 | const target = await interaction.guild.members.fetch(interaction.targetId); 15 | 16 | const Response = new EmbedBuilder() 17 | .setColor(client.color) 18 | .setTimestamp(Date.now()) 19 | .setAuthor({name: "Open Avatar", iconURL: target.user.displayAvatarURL(), url: target.user.avatarURL()}) 20 | .setImage(target.user.displayAvatarURL({size: 512})) 21 | 22 | interaction.reply({embeds: [Response], ephemeral: true}) 23 | 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /src/types/commands/fun/meme.js: -------------------------------------------------------------------------------- 1 | const { Client, ChatInputCommandInteraction, SlashCommandBuilder, EmbedBuilder } = require('discord.js') 2 | const randomPuppy = require('random-puppy') 3 | 4 | module.exports = { 5 | data: new SlashCommandBuilder() 6 | .setName("meme") 7 | .setDescription("Sends an epic meme"), 8 | category: 'fun', 9 | /** 10 | * @param {ChatInputCommandInteraction} interaction 11 | * @param {Client} client 12 | */ 13 | async execute(interaction, client) { 14 | const subReddits = ["dankmeme", "meme", "me_irl"]; 15 | const random = subReddits[Math.floor(Math.random() * subReddits.length)]; 16 | 17 | const img = await randomPuppy(random); 18 | const embed = new EmbedBuilder() 19 | .setColor(client.color) 20 | .setDescription(`From [${random}](https://reddit.com/r/${random})`) 21 | .setTitle("🎭 Meme") 22 | .setImage(img) 23 | .setTimestamp(Date.now()) 24 | 25 | interaction.reply({embeds: [embed]}) 26 | } 27 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 max 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/types/commands/user/avatar_cmd.js: -------------------------------------------------------------------------------- 1 | const { Client, SlashCommandBuilder, ChatInputCommandInteraction, EmbedBuilder } = require('discord.js'); 2 | 3 | module.exports = { 4 | data: new SlashCommandBuilder() 5 | .setName("avatar") 6 | .setDescription("Get a users avatar!") 7 | .addUserOption( 8 | option => 9 | option.setName("user") 10 | .setDescription("The user you want to get information about.") 11 | .setRequired(true)) 12 | .setDMPermission(false), 13 | /** 14 | * @param {ChatInputCommandInteraction} interaction 15 | * @param {Client} client 16 | */ 17 | async execute(interaction, client) { 18 | const { options } = interaction; 19 | 20 | const user = options.getMember("user") 21 | 22 | const Response = new EmbedBuilder() 23 | .setColor(client.color) 24 | .setTimestamp(Date.now()) 25 | .setAuthor({name: "Open Avatar", iconURL: user.user.displayAvatarURL(), url: user.user.avatarURL()}) 26 | .setImage(user.user.displayAvatarURL({size: 512})) 27 | 28 | interaction.reply({embeds: [Response], ephemeral: true}); 29 | } 30 | } -------------------------------------------------------------------------------- /src/types/commands/system/support.js: -------------------------------------------------------------------------------- 1 | const { Client, SlashCommandBuilder, ChatInputCommandInteraction, EmbedBuilder, ButtonStyle, ButtonBuilder, ActionRowBuilder } = require('discord.js') 2 | 3 | module.exports = { 4 | data: new SlashCommandBuilder() 5 | .setName('support') 6 | .setDescription('Get Link to our support server!'), 7 | /** 8 | * @param {ChatInputCommandInteraction} interaction 9 | * @param {Client} client 10 | */ 11 | async execute(interaction, client) { 12 | const { options } = interaction; 13 | 14 | const button = new ButtonBuilder() 15 | .setLabel("Support Server") 16 | .setStyle(ButtonStyle.Link) 17 | .setURL(client.config.supportServer) 18 | 19 | const Response = new EmbedBuilder() 20 | .setTitle('⛑️ Support') 21 | .setColor(client.color) 22 | .setDescription('If you need support or the bot is not working just create a ticket in the support Server!') 23 | .setFooter({ text: `${client.user.username} © 2022`, iconURL: client.user.displayAvatarURL()}) 24 | 25 | interaction.reply({ embeds: [Response], components: [new ActionRowBuilder().addComponents(button)], ephemeral: true }) 26 | } 27 | } -------------------------------------------------------------------------------- /src/types/commands/fun/8ball.js: -------------------------------------------------------------------------------- 1 | const { Client, SlashCommandBuilder, ChatInputCommandInteraction, EmbedBuilder } = require('discord.js') 2 | 3 | module.exports = { 4 | data: new SlashCommandBuilder() 5 | .setName('8ball') 6 | .setDescription('Ake me anything') 7 | .addStringOption(option => option.setName('question').setDescription('Ask your question').setRequired(true)), 8 | /** 9 | * @param {ChatInputCommandInteraction} interaction 10 | * @param {Client} client 11 | */ 12 | async execute(interaction, client) { 13 | const { options, member } = interaction; 14 | 15 | const replies = ["Yes.", "No.", "I don't know.", "Ask again later"]; 16 | const result = Math.floor((Math.random() * replies.length)) 17 | 18 | const ballEmbed = new EmbedBuilder() 19 | .setTitle('🎱 Ball') 20 | .setColor(client.color) 21 | .setFooter({ text: `Asked by ${member.user.tag}!`, iconURL: member.user.displayAvatarURL() }) 22 | .addFields( 23 | { name: 'Question', value: options.getString('question') }, 24 | { name: 'Answer', value: replies[result] }, 25 | ) 26 | 27 | interaction.reply({ embeds: [ballEmbed]}); 28 | } 29 | } -------------------------------------------------------------------------------- /src/types/components/buttons/lock-ticket.js: -------------------------------------------------------------------------------- 1 | const { Client, EmbedBuilder, ButtonInteraction, PermissionFlagsBits } = require('discord.js') 2 | const ticketDB = require('../../../models/Ticket') 3 | 4 | module.exports = { 5 | data: { 6 | name: 'ticket-lock', 7 | }, 8 | /** 9 | * 10 | * @param {ButtonInteraction} interaction 11 | * @param {Client} client 12 | */ 13 | async execute(interaction, client) { 14 | const { member, guildId, channel, guild } = interaction; 15 | 16 | if(!member.permissions.has(PermissionFlagsBits.ModerateMembers)) return interaction.reply({ content: '❌ You do not have permissions to lock this ticket!', ephemeral: true }); 17 | 18 | await ticketDB.findOneAndUpdate( 19 | { GuildID: guildId, ChannelID: channel.id }, 20 | { Locked: true }, 21 | { new: true, upsert: true }) 22 | 23 | channel.permissionOverwrites.edit(guild.roles.everyone.id, { SendMessages: false }); 24 | 25 | return interaction.reply({ 26 | embeds: [ 27 | new EmbedBuilder() 28 | .setDescription('🔒 Locked this ticket!') 29 | .setColor(client.color) 30 | ] 31 | }) 32 | } 33 | } -------------------------------------------------------------------------------- /src/types/components/buttons/unlock-ticket.js: -------------------------------------------------------------------------------- 1 | const { Client, EmbedBuilder, ButtonInteraction, PermissionFlagsBits } = require('discord.js') 2 | const ticketDB = require('../../../models/Ticket') 3 | 4 | module.exports = { 5 | data: { 6 | name: 'ticket-unlock', 7 | }, 8 | /** 9 | * 10 | * @param {ButtonInteraction} interaction 11 | * @param {Client} client 12 | */ 13 | async execute(interaction, client) { 14 | const { member, guildId, channel, guild } = interaction; 15 | 16 | if(!member.permissions.has(PermissionFlagsBits.ModerateMembers)) return interaction.reply({ content: '❌ You do not have permissions to unlock this ticket!', ephemeral: true }); 17 | 18 | await ticketDB.findOneAndUpdate( 19 | { GuildID: guildId, ChannelID: channel.id }, 20 | { Locked: false }, 21 | { new: true, upsert: true }) 22 | 23 | channel.permissionOverwrites.edit(guild.roles.everyone.id, { SendMessages: true }); 24 | 25 | return interaction.reply({ 26 | embeds: [ 27 | new EmbedBuilder() 28 | .setDescription('🔓 Unocked this ticket!') 29 | .setColor(client.color) 30 | ] 31 | }) 32 | } 33 | } -------------------------------------------------------------------------------- /src/types/events/messages/afkSystem.js: -------------------------------------------------------------------------------- 1 | const { Message, EmbedBuilder, MessageType } = require('discord.js') 2 | const DB = require("../../../models/AFKSystem") 3 | 4 | module.exports = { 5 | name: "messageCreate", 6 | once: false, 7 | /** 8 | * @param {Message} message 9 | */ 10 | async execute(message, client) { 11 | if(message.author.bot) return; 12 | if(message.guild == null) return; 13 | 14 | await DB.deleteOne({GuildID: message.guild.id, UserID: message.author.id}); 15 | 16 | if(message.mentions.members) { 17 | const Response = new EmbedBuilder() 18 | .setColor(client.color) 19 | 20 | message.mentions.members.forEach(async (m) => { 21 | DB.findOne({GuildID: message.guild.id, UserID: m.id}, async(err, data) => { 22 | if(err) throw err; 23 | 24 | if(data){ 25 | Response.setDescription(`${m} went AFK \n **Status:** ${data.Status}`); 26 | return message.reply({embeds: [Response]}) 27 | } 28 | else { 29 | return; 30 | } 31 | }) 32 | }) 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /src/types/components/buttons/Suggestion-Accept.js: -------------------------------------------------------------------------------- 1 | const { ButtonInteraction, Client, AttachmentBuilder, EmbedBuilder } = require('discord.js') 2 | const DB = require('../../../models/SuggestSystem') 3 | 4 | module.exports = { 5 | data: { 6 | name: "suggest-accept" 7 | }, 8 | /** 9 | * 10 | * @param {ButtonInteraction} interaction 11 | * @param {Client} client 12 | */ 13 | async execute(interaction, client) { 14 | const { guildId, message, member } = interaction; 15 | 16 | if(!member.permissions.has('Administrator')) return interaction.reply({ content: '❌ You need to be an Administrator to perform this action.', ephemeral: true }); 17 | 18 | DB.findOne({GuildID: guildId, MessageID: message.id}, async(err, data) => { 19 | if(err) throw er; 20 | if(!data) return interaction.reply({ content: "No data was found in the database", ephemeral: true }); 21 | 22 | const Embed = message.embeds[0] 23 | if(!Embed) return; 24 | 25 | Embed.fields[1] = { name: "Status", value: "✅ Accepted", inline: true } 26 | Embed.color == 0x3dd95c; 27 | message.edit({ embeds: [Embed], components: []}); 28 | interaction.reply({content: "Suggestion ✅ Accepted", ephemeral: true}); 29 | }) 30 | } 31 | } -------------------------------------------------------------------------------- /src/types/components/buttons/Suggestion-Decline.js: -------------------------------------------------------------------------------- 1 | const { ButtonInteraction, Client, AttachmentBuilder, EmbedBuilder } = require('discord.js') 2 | const DB = require('../../../models/SuggestSystem') 3 | 4 | module.exports = { 5 | data: { 6 | name: "suggest-decline" 7 | }, 8 | /** 9 | * 10 | * @param {ButtonInteraction} interaction 11 | * @param {Client} client 12 | */ 13 | async execute(interaction, client) { 14 | const { guildId, message, member } = interaction; 15 | 16 | if(!member.permissions.has('Administrator')) return interaction.reply({ content: '❌ You need to be an Administrator to perform this action.', ephemeral: true }); 17 | 18 | DB.findOne({GuildID: guildId, MessageID: message.id}, async(err, data) => { 19 | if(err) throw er; 20 | if(!data) return interaction.reply({ content: "No data was found in the database", ephemeral: true }); 21 | 22 | const Embed = message.embeds[0] 23 | if(!Embed) return; 24 | 25 | Embed.fields[1] = { name: "Status", value: "❌ Declined", inline: true } 26 | Embed.color == 0xd93d3d; 27 | message.edit({ embeds: [Embed], components: []}); 28 | interaction.reply({content: "Suggestion ❌ Declined", ephemeral: true}); 29 | }) 30 | } 31 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "@discordjs/opus": "^0.9.0", 4 | "@discordjs/voice": "^0.11.0", 5 | "@distube/soundcloud": "^1.2.2", 6 | "@distube/spotify": "^1.4.2", 7 | "@iamtraction/google-translate": "^2.0.1", 8 | "ascii-table": "^0.0.9", 9 | "canvacord": "^5.4.8", 10 | "captcha-canvas": "^3.2.1", 11 | "discord-giveaways": "^6.0.1", 12 | "discord-modals": "^1.3.9", 13 | "discord-tictactoe": "^4.0.0", 14 | "discord-together": "^1.3.31", 15 | "discord.js": "^14.6.0", 16 | "distube": "^4.0.4", 17 | "dotenv": "^16.0.3", 18 | "ffmpeg-static": "^5.1.0", 19 | "glob": "^8.0.3", 20 | "got": "^12.5.3", 21 | "http-basic": "^8.1.3", 22 | "libsodium-wrappers": "^0.7.10", 23 | "mongodb": "^4.12.0", 24 | "mongoose": "^6.7.2", 25 | "ms": "^2.1.3", 26 | "nodemon": "^2.0.20", 27 | "promisify": "^0.0.3", 28 | "random-puppy": "^1.1.0", 29 | "request-promise-native": "^1.0.9", 30 | "sourcebin": "^5.0.0", 31 | "weather-js": "^2.0.0", 32 | "yt-search": "^2.10.3", 33 | "ytdl-core": "^4.11.0" 34 | }, 35 | "name": "eve", 36 | "version": "1.0.0", 37 | "main": "src/bot.js", 38 | "scripts": { 39 | "start": "node .", 40 | "dev": "nodemon ." 41 | }, 42 | "keywords": [], 43 | "author": "", 44 | "license": "ISC", 45 | "description": "" 46 | } 47 | -------------------------------------------------------------------------------- /src/handlers/EventHandler.js: -------------------------------------------------------------------------------- 1 | function loadEvents(client) { 2 | 3 | const ascii = require('ascii-table') 4 | const fs = require('fs') 5 | const table = new ascii().setHeading("Events", "Type", "Status"); 6 | 7 | const folders = fs.readdirSync("./src/types/events"); 8 | for( const folder of folders) { 9 | const files = fs.readdirSync(`./src/types/events/${folder}`).filter((file) => file.endsWith(".js")); 10 | 11 | for (const file of files) { 12 | const event = require(`../types/events/${folder}/${file}`) 13 | 14 | if (event.rest) { 15 | if (event.once) { 16 | client.rest.once(event.name, (...args) => event.execute(...args, client)); 17 | } else { 18 | client.rest.on(event.name, (...args) => event.execute(...args, client)); 19 | } 20 | } else { 21 | if (event.once) { 22 | client.once(event.name, (...args) => event.execute(...args, client)); 23 | } else { 24 | client.on(event.name, (...args) => event.execute(...args, client)); 25 | } 26 | } 27 | 28 | table.addRow(file, folder, "✅") 29 | continue; 30 | } 31 | } 32 | return console.log(table.toString()) 33 | } 34 | 35 | module.exports = { loadEvents }; -------------------------------------------------------------------------------- /src/types/events/automoderation/chatFilter.js: -------------------------------------------------------------------------------- 1 | const { Client, Message } = require('discord.js') 2 | 3 | const featuresDB = require('../../../models/Features') 4 | const chatfilterDB = require('../../../models/ChatFilter') 5 | const { addPoints } = require('../../../utils/warnpoints') 6 | 7 | module.exports = { 8 | name: 'messageCreate', 9 | rest: false, 10 | once: false, 11 | /** 12 | * @param { Message } message 13 | * @param { Client } client 14 | */ 15 | async execute(message, client) { 16 | if(message.author.bot) return; 17 | if(message.guild === null) return; 18 | 19 | featuresDB.findOne({GuildID: message.guild.id}, async (err, data) => { 20 | if(err) throw err; 21 | if(!data) return; 22 | 23 | if(data.AutoModSystem) { 24 | chatfilterDB.findOne({GuildID: message.guild.id}, async (err, chatData) => { 25 | if(!chatData || chatData.Wordlist) return; 26 | if(message.member.permissions.has('Administrator')) return; 27 | 28 | message.content.toLowerCase().split(" ").forEach(word => { 29 | if(chatData.Wordlist.includes(word)) { 30 | addPoints(1, message, 'Chatfilter', message.author, client); 31 | message.delete(); 32 | } 33 | }) 34 | }) 35 | } 36 | }) 37 | } 38 | } -------------------------------------------------------------------------------- /src/types/commands/user/dm.js: -------------------------------------------------------------------------------- 1 | const { Client, SlashCommandBuilder, ChatInputCommandInteraction, EmbedBuilder } = require('discord.js'); 2 | 3 | module.exports = { 4 | data: new SlashCommandBuilder() 5 | .setName("dm") 6 | .setDescription("Direct Message a Server Member!") 7 | .addUserOption( 8 | option => 9 | option.setName("user") 10 | .setDescription("The user you want to message.") 11 | .setRequired(true)) 12 | .addStringOption( 13 | option => 14 | option.setName("message") 15 | .setDescription("The message you want to send.") 16 | .setRequired(true)) 17 | .setDMPermission(false), 18 | /** 19 | * @param {ChatInputCommandInteraction} interaction 20 | * @param {Client} client 21 | */ 22 | async execute(interaction, client) { 23 | const { options, member } = interaction; 24 | 25 | const user = options.getMember("user") 26 | const message = options.getString("message") 27 | 28 | const Response = new EmbedBuilder() 29 | .setTitle("✉️ You've got a new Message") 30 | .setFooter({text: `From ${member.user.tag}`, iconURL: member.user.displayAvatarURL()}) 31 | .setDescription(`**Message:** \n${message}`) 32 | .setTimestamp(Date.now()) 33 | .setColor(client.color); 34 | 35 | user.send({embeds: [Response]}); 36 | interaction.reply({content: `✅ Successfully sent Message to ${user}!`, ephemeral: true}); 37 | } 38 | } -------------------------------------------------------------------------------- /src/types/commands/moderation/unmute.js: -------------------------------------------------------------------------------- 1 | const { Client, SlashCommandBuilder, ChatInputCommandInteraction, PermissionFlagsBits, EmbedBuilder } = require('discord.js') 2 | 3 | module.exports = { 4 | data: new SlashCommandBuilder() 5 | .setName("unmute") 6 | .setDescription("Unmute a muted Member") 7 | .addUserOption( 8 | option => 9 | option.setName("user") 10 | .setDescription("The user you want to unmute.") 11 | .setRequired(true)) 12 | .setDMPermission(false) 13 | .setDefaultMemberPermissions(PermissionFlagsBits.ManageRoles), 14 | /** 15 | * @param {ChatInputCommandInteraction} interaction 16 | * @param {Client} client 17 | */ 18 | async execute(interaction, client) { 19 | const { options, guild } = interaction; 20 | 21 | const mutedRole = guild.roles.cache.find(role => role.name === "muted"); 22 | const Target = options.getMember('user'); 23 | 24 | const Response = new EmbedBuilder() 25 | .setColor(client.color) 26 | .setAuthor({name: '🔈 Mute System', iconURL: guild.iconURL()}) 27 | .setTimestamp(Date.now()); 28 | 29 | if(mutedRole && Target.roles.cache.get(mutedRole.id)) { 30 | Target.roles.remove(mutedRole.id); 31 | Response.setDescription(`Successfully unmuted ${Target}.`); 32 | } else { 33 | Response.setDescription(`${Target} is currently not muted.`); 34 | } 35 | 36 | interaction.reply({embeds: [Response]}); 37 | } 38 | } -------------------------------------------------------------------------------- /src/types/events/messages/levels.js: -------------------------------------------------------------------------------- 1 | const { Client, Message, EmbedBuilder } = require('discord.js') 2 | 3 | const featuresDB = require('../../../models/Features') 4 | const levelSystem = require('../../../models/LevelSystem') 5 | const { addXP } = require('../../../utils/levelsystem') 6 | 7 | module.exports = { 8 | name: "messageCreate", 9 | once: false, 10 | rest: false, 11 | /** 12 | * 13 | * @param {Message} message 14 | * @param {Client} client 15 | */ 16 | async execute(message, client) { 17 | const { guild, member } = message; 18 | if(message.guild === null) return; 19 | if(message.author.bot) return; 20 | 21 | const randomXP = Math.floor(Math.random() * 9) + 1; 22 | 23 | const levelSystemCheck = await featuresDB.findOne({ GuildID: guild.id }); 24 | if(levelSystemCheck && levelSystemCheck.LevelSystem) { 25 | const levelSettings = await levelSystem.findOne({ GuildID: guild.id }); 26 | const { Message, Embed, ChannelID } = levelSettings; 27 | 28 | if(ChannelID) { 29 | const channel = guild.channels.cache.get(ChannelID); 30 | addXP(guild.id, member.id, randomXP, message, client, Embed, Message ? Message : `Congrats **{user}**! You are now __**Level {level}**__ 🥳`, channel); 31 | } else { 32 | addXP(guild.id, member.id, randomXP, message, client, Embed, Message ? Message : `Congrats **{user}**! You are now __**Level {level}**__ 🥳`, message.channel); 33 | } 34 | } 35 | 36 | } 37 | } -------------------------------------------------------------------------------- /src/bot.js: -------------------------------------------------------------------------------- 1 | /* Bot discord.js setup */ 2 | const { Client, Collection, GatewayIntentBits, Partials, EmbedBuilder } = require("discord.js"); 3 | const { User, Channel, GuildMember, GuildScheduledEvent, Message, Reaction, ThreadMember } = Partials 4 | const { Guilds, GuildMembers, GuildMessages, GuildVoiceStates, DirectMessages, GuildMessageReactions, GuildEmojisAndStickers, GuildWebhooks, GuildIntegrations, MessageContent } = GatewayIntentBits; 5 | const client = new Client({ shards: "auto", intents: [Guilds, GuildMembers, GuildMessages, GuildVoiceStates, DirectMessages, GuildMessageReactions, GuildEmojisAndStickers, GuildWebhooks, GuildIntegrations, MessageContent], partials: [User, Message, GuildMember, ThreadMember, GuildScheduledEvent, Reaction] }); 6 | 7 | /* Client Config */ 8 | client.config = require('../config.json') 9 | client.color = parseInt(client.config.color.replace("#", "0x")) 10 | 11 | /* Giveaway System */ 12 | require('./Systems/GiveawaySystem')(client); 13 | 14 | /* Client Collections */ 15 | client.voiceGenerator = new Collection(); 16 | client.commands = new Collection(); 17 | client.modals = new Collection(); 18 | client.buttons = new Collection(); 19 | client.selectMenus = new Collection(); 20 | 21 | /* Discord Handler */ 22 | const { loadEvents } = require('./handlers/EventHandler') 23 | const { loadCommands } = require('./handlers/CommandHandler'); 24 | const { loadComponents } = require('./handlers/ComponentHandler'); 25 | 26 | /* Client Login */ 27 | client.login(client.config.token) 28 | .then(() => { 29 | /* Start Handler */ 30 | loadEvents(client); 31 | loadCommands(client); 32 | loadComponents(client); 33 | }) -------------------------------------------------------------------------------- /src/types/components/buttons/close-ticket.js: -------------------------------------------------------------------------------- 1 | const { ButtonInteraction, Client, AttachmentBuilder, EmbedBuilder, ChannelType, ButtonBuilder, ButtonStyle, ActionRowBuilder, PermissionFlagsBits } = require('discord.js') 2 | const ticketDB = require('../../../models/Ticket') 3 | 4 | module.exports = { 5 | data: { 6 | name: "ticket-close" 7 | }, 8 | /** 9 | * 10 | * @param {ButtonInteraction} interaction 11 | * @param {Client} client 12 | */ 13 | async execute(interaction, client) { 14 | const { guildId, message, member, guild } = interaction; 15 | 16 | if(member.permissions.has(PermissionFlagsBits.ModerateMembers)) { 17 | return interaction.reply( 18 | { embeds: [ 19 | new EmbedBuilder() 20 | .setDescription('✅ Successfully closed this ticket!') 21 | .setColor(client.color) 22 | ]} 23 | ).then(async () => { 24 | setTimeout(async () => { 25 | interaction.channel.delete() 26 | await ticketDB.findOne({ GuildID: guildId, ChannelID: interaction.channel.id }).deleteMany(); 27 | }, 3*1000) 28 | }) 29 | } else { 30 | return interaction.reply( 31 | { embeds: [ 32 | new EmbedBuilder() 33 | .setTitle('✉️ Ticket System') 34 | .setDescription('❌ You do not have permission to close this ticket!') 35 | .setColor(client.color) 36 | .setTimestamp(Date.now()) 37 | ], 38 | ephemeral: true 39 | } 40 | ) 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /src/types/commands/moderation/giverole.js: -------------------------------------------------------------------------------- 1 | const { Client, SlashCommandBuilder, ChatInputCommandInteraction, PermissionsBitField, PermissionFlagsBits, EmbedBuilder } = require('discord.js') 2 | 3 | module.exports = { 4 | data: new SlashCommandBuilder() 5 | .setName('giverole') 6 | .setDescription('Give a member a new role.') 7 | .setDMPermission(false) 8 | .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) 9 | .addRoleOption( 10 | option => 11 | option.setName('role') 12 | .setDescription('Provide a role') 13 | .setRequired(true)) 14 | .addUserOption( 15 | option => 16 | option.setName('user') 17 | .setDescription('User you want to add the role') 18 | .setRequired(true)), 19 | /** 20 | * @param {ChatInputCommandInteraction} interaction 21 | * @param {Client} client 22 | */ 23 | async execute(interaction, client) { 24 | const { options, member } = interaction; 25 | 26 | const role = options.getRole('role'); 27 | const user = options.getMember('user'); 28 | 29 | const Response = new EmbedBuilder() 30 | .setTitle('🪄 Role') 31 | .setColor(client.color) 32 | .setTimestamp(Date.now()); 33 | 34 | if(member.roles.highest.position < role.position) { 35 | return interaction.reply({embeds: [Response.setColor('Red').setDescription('❌ You do not have permission to give this role!')]}); 36 | } 37 | 38 | try { 39 | user.roles.add(role) 40 | } catch (error) { 41 | return; 42 | } 43 | 44 | return interaction.reply({embeds: [Response.setDescription(`Added ${role} to ${user}'s roles!`)]}); 45 | 46 | } 47 | } -------------------------------------------------------------------------------- /src/types/commands/moderation/checkwarns.js: -------------------------------------------------------------------------------- 1 | const { Client, SlashCommandBuilder, PermissionFlagsBits, ChatInputCommandInteraction, EmbedBuilder } = require('discord.js'); 2 | const warnDB = require('../../../models/WarnSystem') 3 | 4 | module.exports = { 5 | data: new SlashCommandBuilder() 6 | .setName("checkwarns") 7 | .setDescription("Check the Warn Points from any user in the server!") 8 | .addUserOption( 9 | option => 10 | option.setName("user") 11 | .setDescription("The user you want to check.") 12 | .setRequired(true)) 13 | .setDMPermission(false) 14 | .setDefaultMemberPermissions(PermissionFlagsBits.ModerateMembers), 15 | /** 16 | * 17 | * @param {ChatInputCommandInteraction} interaction 18 | * @param {Client} client 19 | */ 20 | async execute(interaction, client) { 21 | const { options } = interaction; 22 | 23 | const Target = options.getMember("user"); 24 | 25 | const Response = new EmbedBuilder() 26 | .setColor(client.color) 27 | .setTimestamp(Date.now()) 28 | .setTitle(`${Target.displayName} infractions:`) 29 | 30 | let warns = warnDB.findOne({GuildID: interaction.guild.id, UserID: Target.id}, async(err, data) => { 31 | if(err) throw err; 32 | 33 | if(data) { 34 | let num = data.Warns; 35 | 36 | Response.setDescription(`${Target} has \`\`${num}\`\` warning ${num > 1 ? "points" : "point"}!`) 37 | return interaction.reply({embeds: [Response]}); 38 | } else { 39 | Response.setDescription(`${Target} has \`0\` warning points!`) 40 | return interaction.reply({embeds: [Response]}); 41 | } 42 | }); 43 | } 44 | } -------------------------------------------------------------------------------- /src/handlers/CommandHandler.js: -------------------------------------------------------------------------------- 1 | const { Client } = require('discord.js') 2 | 3 | /** 4 | * @param { Client } client 5 | */ 6 | function loadCommands(client) { 7 | const ascii = require('ascii-table') 8 | const fs = require('fs') 9 | const table = new ascii().setHeading("Commands", "Type", "Status") 10 | 11 | let commandsArray = []; 12 | let developerArray = []; 13 | 14 | const commandsFolder = fs.readdirSync("./src/types/commands"); 15 | /* Loop through all folders in './src/types/commands' and get the javascript files */ 16 | for(const folder of commandsFolder) { 17 | const commandFiles = fs.readdirSync(`./src/types/commands/${folder}/`) 18 | .filter((file) => file.endsWith('.js')); 19 | 20 | for(const file of commandFiles) { 21 | const commandFile = require(`../types/commands/${folder}/${file}`); 22 | 23 | client.commands.set(commandFile.data.name, commandFile); 24 | 25 | /* Add Command Data to the commandsArray */ 26 | if(commandFile.developer) developerArray.push(commandFile.data.toJSON()) 27 | else commandsArray.push(commandFile.data.toJSON()); 28 | 29 | table.addRow(file, folder, '✅'); 30 | continue; 31 | } 32 | } 33 | 34 | /* Set the commands in Discord */ 35 | client.application.commands.set(commandsArray); 36 | 37 | /* Add commands to the developer Guild */ 38 | if(client.config.developerGuild) { 39 | const developerGuild = client.guilds.cache.get(client.config.developerGuild) 40 | developerGuild.commands.set(developerArray); 41 | } else { 42 | console.log('No Developer Guild found') 43 | } 44 | 45 | return console.log(table.toString()); 46 | } 47 | 48 | module.exports = { loadCommands } -------------------------------------------------------------------------------- /src/types/components/modals/applicationModal.js: -------------------------------------------------------------------------------- 1 | const { EmbedBuilder, Client, ModalSubmitInteraction, InteractionCollector } = require('discord.js') 2 | 3 | const applicationsysDB = require('../../../models/ApplicationSystem') 4 | 5 | module.exports = { 6 | data: { 7 | name: 'apply-modal' 8 | }, 9 | /** 10 | * 11 | * @param {ModalSubmitInteraction} modal 12 | * @param {Client} client 13 | */ 14 | async execute(modal, client) { 15 | const { member } = modal; 16 | if (modal.customId !== "apply-modal") return; 17 | 18 | await modal.deferReply({ ephemeral: true }); 19 | 20 | const name = modal.fields.getTextInputValue('application-name') 21 | const type = modal.fields.getTextInputValue("application-type"); 22 | const application = modal.fields.getTextInputValue("application-all"); 23 | 24 | applicationsysDB.findOne({ GuildID: modal.guild.id }, async(err, data) => { 25 | if(err) throw err; 26 | if(!data) return modal.followUp({ content: '❌ You cannot apply for this server!', ephemeral: true }) 27 | 28 | const channel = modal.guild.channels.cache.get(data.ChannelID); 29 | 30 | const ApplyEmbed = new EmbedBuilder() 31 | .setAuthor({ name: `${member.user.username}'s Application`, iconURL: member.user.displayAvatarURL() }) 32 | .addFields([ 33 | { name: 'Name:', value: name }, 34 | { name: 'Type:', value: type }, 35 | { name: 'Application:', value: `\`\`\`${application}\`\`\`` }, 36 | ]).setColor(client.color) 37 | .setTimestamp(Date.now()) 38 | 39 | channel.send({ embeds: [ApplyEmbed] }) 40 | 41 | return modal.followUp({ content: '✅ Successfully applied!', ephemeral: true }) 42 | }) 43 | } 44 | } -------------------------------------------------------------------------------- /src/utils/levelsystem.js: -------------------------------------------------------------------------------- 1 | const { Client, Message, TextChannel, EmbedBuilder } = require('discord.js') 2 | 3 | const levelDB = require('../models/Levels') 4 | 5 | const calculateXP = (level) => level * level * 100 6 | 7 | /** 8 | * 9 | * @param {String} guildID 10 | * @param {String} userId 11 | * @param {Int} xpToAdd 12 | * @param {Message} message 13 | * @param {Client} client 14 | * @param {Boolean} embed 15 | * @param {String} levelUpMessage 16 | * @param {TextChannel} channel 17 | */ 18 | const addXP = async (guildID, userId, xpToAdd, message, client, embed, levelUpMessage, channel) => { 19 | const result = await levelDB.findOneAndUpdate( 20 | { GuildID: guildID, UserID: userId }, 21 | { $inc: { xp: xpToAdd } }, 22 | { new: true, upsert: true } 23 | ); 24 | 25 | let { xp, level } = result 26 | const needed = calculateXP(level) 27 | 28 | if(xp >= needed) { 29 | level++ 30 | xp -= needed 31 | 32 | if(embed) { 33 | const LevelEmbed = new EmbedBuilder() 34 | .setTitle("Level Up") 35 | .setDescription(levelUpMessage.replace("{level}", level.toString()).replace("{user}", message.member.user.username)) 36 | .setThumbnail(message.member.user.displayAvatarURL()) 37 | .setColor(client.color) 38 | .setTimestamp(Date.now()); 39 | 40 | channel.send({embeds: [LevelEmbed]}) 41 | } else { 42 | channel.send({content: levelUpMessage.replace("{level}", level.toString()).replace("{user}", message.member.user.username)}) 43 | } 44 | 45 | await levelDB.updateOne({ 46 | GuildID: guildID, 47 | UserID: userId, 48 | }, { 49 | level: level, 50 | xp: xp, 51 | }) 52 | } 53 | } 54 | 55 | module.exports = { addXP, calculateXP } -------------------------------------------------------------------------------- /src/types/events/voice/voice.js: -------------------------------------------------------------------------------- 1 | const { Client, VoiceState, ChannelType } = require("discord.js"); 2 | const DB = require("../../../models/VoiceSystem") 3 | 4 | module.exports = { 5 | name: "voiceStateUpdate", 6 | rest: false, 7 | once: false, 8 | /** 9 | * @param {Client} client 10 | * @param {VoiceState} oldState 11 | * @param {VoiceState} newState 12 | */ 13 | async execute(oldState, newState, client) { 14 | const { member, guild } = newState; 15 | const oldChannel = oldState.channel; 16 | const newChannel = newState.channel; 17 | DB.findOne({ GuildID: guild.id }, async (err, data) => { 18 | if(!data) return; 19 | 20 | if(oldChannel !== newChannel && newChannel && newChannel.id === data.ChannelID) { 21 | const voiceChannel = await guild.channels.create({ 22 | name: `🔰 │ ${member.user.tag}`, 23 | type: ChannelType.GuildVoice, 24 | parent: newChannel.parent, 25 | permissionOverwrites: [ 26 | { id: member.user.id, allow: ["Connect"]}, 27 | { id: guild.id, deny: ["Connect"]} 28 | ] 29 | }) 30 | 31 | client.voiceGenerator.set(member.id, voiceChannel.id); 32 | await newChannel.permissionOverwrites.edit(member, {Connect: false}); 33 | setTimeout(() => newChannel.permissionOverwrites.delete(member), 30*1000); 34 | 35 | return setTimeout(() => member.voice.setChannel(voiceChannel), 500); 36 | } 37 | 38 | const ownedChannel = client.voiceGenerator.get(member.id); 39 | 40 | if(ownedChannel && oldChannel.id == ownedChannel && (!newChannel || newChannel.id !== ownedChannel)) { 41 | client.voiceGenerator.set(member.id, null); 42 | oldChannel.delete().catch(() => {}); 43 | } 44 | }); 45 | } 46 | }; -------------------------------------------------------------------------------- /src/types/commands/user/apply.js: -------------------------------------------------------------------------------- 1 | const { Modal, TextInputComponent, showModal, TextInputStyles } = require('discord-modals') 2 | const { Client, SlashCommandBuilder, ChatInputCommandInteraction, TextInputStyle } = require('discord.js') 3 | 4 | module.exports = { 5 | data: new SlashCommandBuilder() 6 | .setName('apply') 7 | .setDescription('Apply for a server') 8 | .setDMPermission(false), 9 | /** 10 | * 11 | * @param {ChatInputCommandInteraction} interaction 12 | * @param {Client} client 13 | */ 14 | async execute(interaction, client) { 15 | const { member, guild } = interaction; 16 | 17 | const modal = new Modal() 18 | .setCustomId('apply-modal') 19 | .setTitle(`${member.user.username}'s Application`) 20 | .addComponents( 21 | new TextInputComponent() 22 | .setCustomId('application-name') 23 | .setLabel('Name') 24 | .setStyle(TextInputStyle.Short) 25 | .setMinLength(1) 26 | .setPlaceholder("What would you like to be called?") 27 | .setRequired(true), 28 | new TextInputComponent() 29 | .setCustomId('application-type') 30 | .setLabel('Type') 31 | .setStyle(TextInputStyle.Short) 32 | .setMinLength(1) 33 | .setPlaceholder("What are you applying for?") 34 | .setRequired(true), 35 | new TextInputComponent() 36 | .setCustomId('application-all') 37 | .setLabel('Application') 38 | .setStyle(TextInputStyle.Paragraph) 39 | .setMinLength(20) 40 | .setPlaceholder("Write your application here?") 41 | .setRequired(true) 42 | ) 43 | 44 | showModal(modal, { 45 | client: client, 46 | interaction: interaction 47 | }) 48 | 49 | } 50 | } -------------------------------------------------------------------------------- /src/handlers/ComponentHandler.js: -------------------------------------------------------------------------------- 1 | const { Client } = require('discord.js') 2 | 3 | /** 4 | * @param { Client } client 5 | */ 6 | function loadComponents(client) { 7 | const ascii = require('ascii-table'); 8 | const fs = require('fs') 9 | const table = new ascii().setHeading("Components", "Type", "Status") 10 | 11 | const componentFolder = fs.readdirSync(`./src/types/components`); 12 | for (const folder of componentFolder) { 13 | const componentFiles = fs.readdirSync(`./src/types/components/${folder}`).filter(file => file.endsWith('.js')); 14 | 15 | const { modals, buttons, selectMenus } = client; 16 | switch (folder) { 17 | case "buttons": { 18 | for (const file of componentFiles) { 19 | const button = require(`../types/components/${folder}/${file}`) 20 | buttons.set(button.data.name, button); 21 | table.addRow(file, "button", "✅"); 22 | } 23 | } 24 | break; 25 | 26 | case "modals": { 27 | for (const file of componentFiles) { 28 | const modal = require(`../types/components/${folder}/${file}`) 29 | modals.set(modal.data.name, modal) 30 | table.addRow(file, "modal", "✅"); 31 | } 32 | } 33 | break; 34 | 35 | case "selectMenus": { 36 | for (const file of componentFiles) { 37 | const selectMenu = require(`../types/components/${folder}/${file}`); 38 | selectMenus.set(selectMenu.data.name, selectMenu); 39 | table.addRow(file, "selectMenu", "✅") 40 | } 41 | } break; 42 | 43 | default: 44 | break; 45 | } 46 | continue; 47 | } 48 | 49 | return console.log(table.toString(), "\nLoaded Components!"); 50 | } 51 | 52 | module.exports = { loadComponents } -------------------------------------------------------------------------------- /src/types/commands/user/userinfo.js: -------------------------------------------------------------------------------- 1 | const { Client, ContextMenuCommandBuilder, UserContextMenuCommandInteraction, EmbedBuilder, ApplicationCommandType } = require('discord.js') 2 | 3 | module.exports = { 4 | data: new ContextMenuCommandBuilder() 5 | .setName('Userinfo') 6 | .setDMPermission(false) 7 | .setType(ApplicationCommandType.User), 8 | /** 9 | * 10 | * @param {UserContextMenuCommandInteraction} interaction 11 | * @param {Client} client 12 | */ 13 | async execute(interaction, client) { 14 | const { guild, member } = interaction; 15 | 16 | const target = await interaction.guild.members.fetch(interaction.targetId); 17 | 18 | const user = target.user 19 | const TargetMember = target 20 | const highestRole = guild.roles.cache.find(role => role.id === TargetMember.roles.highest.id); 21 | 22 | const Response = new EmbedBuilder() 23 | .setColor(highestRole.color || client.color) 24 | .setTimestamp(Date.now()) 25 | .setAuthor({name: `${user.username}'s Information`, iconURL: user.displayAvatarURL()}) 26 | .setThumbnail(user.displayAvatarURL()) 27 | .setDescription(` 28 | **__General Information__** 29 | **Name:** ${user.username} 30 | **ID:** ${user.id} 31 | **Nickname:** ${TargetMember.nickname ? TargetMember.nickname : 'None'} 32 | **Bot?:** ${user.bot ? '✅ Yes' : '❎ No' } 33 | **Account Created:** 34 | **Server Joined:** 35 | 36 | **__Role Information__**: 37 | **Highest Role:** ${highestRole} 38 | **Roles:** ${TargetMember.roles.cache.map(r => r).join(" ").replace("@everyone", " ") || "None"} 39 | 40 | `).setFooter({ text: `Requested by ${member.user.tag}`, iconURL: member.user.displayAvatarURL() }); 41 | 42 | interaction.reply({embeds: [Response], ephemeral: true}) 43 | 44 | } 45 | } 46 | 47 | -------------------------------------------------------------------------------- /src/types/commands/moderation/unban.js: -------------------------------------------------------------------------------- 1 | const { Client, SlashCommandBuilder, ChatInputCommandInteraction, EmbedBuilder, PermissionFlagsBits } = require('discord.js') 2 | 3 | module.exports = { 4 | data: new SlashCommandBuilder() 5 | .setName('unban') 6 | .setDescription('Unban an ID stated.') 7 | .addStringOption( 8 | option => 9 | option.setName('target') 10 | .setDescription('The user id you would like to unban.') 11 | .setRequired(true) 12 | ) 13 | .addStringOption( 14 | option => 15 | option.setName('reason') 16 | .setDescription('Provide a reason')) 17 | .setDMPermission(false) 18 | .setDefaultMemberPermissions(PermissionFlagsBits.BanMembers), 19 | /** 20 | * 21 | * @param {ChatInputCommandInteraction} interaction 22 | * @param {Client} client 23 | */ 24 | async execute(interaction, client) { 25 | const { options } = interaction; 26 | 27 | const userID = options.getString('target'); 28 | const reason = options.getString('reason') || "No reason given"; 29 | 30 | await interaction.guild.bans.fetch() 31 | .then(async bans => { 32 | if(bans.size == 0) return await interaction.reply({ content: '❎ There is nobody banned from this server!', ephemeral: true }); 33 | let bannedID = bans.find(ban => ban.user.id === userID); 34 | 35 | if(!bannedID) return await interaction.reply({ content: '❎ The ID stated is not banned from this server!', ephemeral: true }); 36 | 37 | await interaction.guild.bans.remove(userID, reason).catch(err => console.log(err)); 38 | await interaction.reply({ embeds: [ 39 | new EmbedBuilder() 40 | .setTitle('✅ Unbanned') 41 | .setDescription(`Unbanned <@${userID}> successfully!`) 42 | .setTimestamp(Date.now()) 43 | .setColor(client.color) 44 | ]}) 45 | .catch(err => console.log(err)); 46 | }) 47 | 48 | 49 | } 50 | } -------------------------------------------------------------------------------- /src/types/commands/user/userinfo_cmd.js: -------------------------------------------------------------------------------- 1 | const { Client, SlashCommandBuilder, ChatInputCommandInteraction, EmbedBuilder } = require('discord.js'); 2 | 3 | module.exports = { 4 | data: new SlashCommandBuilder() 5 | .setName("userinfo") 6 | .setDescription("Get Information about a user!") 7 | .addUserOption( 8 | option => 9 | option.setName("user") 10 | .setDescription("The user you want to get information about.") 11 | .setRequired(true)) 12 | .setDMPermission(false), 13 | /** 14 | * @param {ChatInputCommandInteraction} interaction 15 | * @param {Client} client 16 | */ 17 | async execute(interaction, client) { 18 | const { options, member, guild } = interaction; 19 | 20 | const user = options.getUser('user') 21 | const TargetMember = options.getMember('user') 22 | const highestRole = guild.roles.cache.find(role => role.id === TargetMember.roles.highest.id); 23 | 24 | const Response = new EmbedBuilder() 25 | .setColor(highestRole.color || client.color) 26 | .setTimestamp(Date.now()) 27 | .setAuthor({name: `${user.username}'s Information`, iconURL: user.displayAvatarURL()}) 28 | .setThumbnail(user.displayAvatarURL()) 29 | .setDescription(` 30 | **__General Information__** 31 | **Name:** ${user.username} 32 | **ID:** ${user.id} 33 | **Nickname:** ${TargetMember.nickname ? TargetMember.nickname : 'None'} 34 | **Bot?:** ${user.bot ? '✅ Yes' : '❎ No' } 35 | **Account Created:** 36 | **Server Joined:** 37 | 38 | **__Role Information__**: 39 | **Highest Role:** ${highestRole} 40 | **Roles:** ${TargetMember.roles.cache.map(r => r).join(" ").replace("@everyone", " ") || "None"} 41 | 42 | `).setFooter({ text: `Requested by ${member.user.tag}`, iconURL: member.user.displayAvatarURL() }); 43 | 44 | interaction.reply({embeds: [Response], ephemeral: true}); 45 | } 46 | } -------------------------------------------------------------------------------- /src/types/commands/developer/reload.js: -------------------------------------------------------------------------------- 1 | const { Client, SlashCommandBuilder, EmbedBuilder, ChatInputCommandInteraction, PermissionFlagsBits, } = require('discord.js') 2 | const { loadCommands } = require('../../../handlers/CommandHandler') 3 | const { loadEvents } = require('../../../handlers/EventHandler') 4 | const { loadComponents } = require('../../../handlers/ComponentHandler') 5 | 6 | module.exports = { 7 | data: new SlashCommandBuilder() 8 | .setName('reload') 9 | .setDescription('Reload my commands/components/events') 10 | .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) 11 | .setDMPermission(false) 12 | .addStringOption( 13 | option => 14 | option.setName('type') 15 | .setDescription('Choose a type') 16 | .addChoices( 17 | { name: 'Commands', value: 'commands' }, 18 | { name: 'Events', value: 'events' }, 19 | { name: 'Components', value: 'components' }, 20 | ).setRequired(true) 21 | ), 22 | category: 'developer', 23 | developer: true, 24 | /** 25 | * 26 | * @param {ChatInputCommandInteraction} interaction 27 | * @param {Client} client 28 | */ 29 | async execute(interaction, client) { 30 | const { options } = interaction; 31 | 32 | const Response = new EmbedBuilder() 33 | .setTitle('⌚ Reload') 34 | .setTimestamp(Date.now()) 35 | .setColor(client.color) 36 | 37 | switch(options.getString('type')) { 38 | 39 | case 'commands': { 40 | loadCommands(client); 41 | 42 | Response.setDescription('Reloaded the **Commands**') 43 | } break; 44 | 45 | case 'events': { 46 | loadEvents(client); 47 | 48 | Response.setDescription('Reloaded the **Events**') 49 | } break; 50 | 51 | case 'components': { 52 | loadComponents(client); 53 | 54 | Response.setDescription('Reloaded the **Components**') 55 | } break; 56 | 57 | } 58 | 59 | return interaction.reply({embeds: [Response]}); 60 | } 61 | } -------------------------------------------------------------------------------- /src/models/Giveaway.js: -------------------------------------------------------------------------------- 1 | const { model, Schema, mongoose } = require('mongoose'); 2 | 3 | const giveawaySchema = new Schema( 4 | { 5 | messageId: String, 6 | channelId: String, 7 | guildId: String, 8 | startAt: Number, 9 | endAt: Number, 10 | ended: Boolean, 11 | winnerCount: Number, 12 | prize: String, 13 | messages: { 14 | giveaway: String, 15 | giveawayEnded: String, 16 | title: String, 17 | inviteToParticipate: String, 18 | drawing: String, 19 | dropMessage: String, 20 | winMessage: mongoose.Mixed, 21 | embedFooter: mongoose.Mixed, 22 | noWinner: String, 23 | winners: String, 24 | endedAt: String, 25 | hostedBy: String 26 | }, 27 | thumbnail: String, 28 | image: String, 29 | hostedBy: String, 30 | winnerIds: { type: [String], default: undefined }, 31 | reaction: mongoose.Mixed, 32 | botsCanWin: Boolean, 33 | embedColor: mongoose.Mixed, 34 | embedColorEnd: mongoose.Mixed, 35 | exemptPermissions: { type: [], default: undefined }, 36 | exemptMembers: String, 37 | bonusEntries: String, 38 | extraData: mongoose.Mixed, 39 | lastChance: { 40 | enabled: Boolean, 41 | content: String, 42 | threshold: Number, 43 | embedColor: mongoose.Mixed 44 | }, 45 | pauseOptions: { 46 | isPaused: Boolean, 47 | content: String, 48 | unPauseAfter: Number, 49 | embedColor: mongoose.Mixed, 50 | durationAfterPause: Number, 51 | infiniteDurationText: String 52 | }, 53 | isDrop: Boolean, 54 | allowedMentions: { 55 | parse: { type: [String], default: undefined }, 56 | users: { type: [String], default: undefined }, 57 | roles: { type: [String], default: undefined } 58 | } 59 | }, 60 | { id: false } 61 | ); 62 | 63 | module.exports = model('giveaways', giveawaySchema); 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | 9 | # Diagnostic reports (https://nodejs.org/api/report.html) 10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | *.lcov 24 | 25 | # nyc test coverage 26 | .nyc_output 27 | 28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 29 | .grunt 30 | 31 | # Bower dependency directory (https://bower.io/) 32 | bower_components 33 | 34 | # node-waf configuration 35 | .lock-wscript 36 | 37 | # Compiled binary addons (https://nodejs.org/api/addons.html) 38 | build/Release 39 | 40 | # Dependency directories 41 | node_modules/ 42 | jspm_packages/ 43 | 44 | # TypeScript v1 declaration files 45 | typings/ 46 | 47 | # TypeScript cache 48 | *.tsbuildinfo 49 | 50 | # Optional npm cache directory 51 | .npm 52 | 53 | # Optional eslint cache 54 | .eslintcache 55 | 56 | # Microbundle cache 57 | .rpt2_cache/ 58 | .rts2_cache_cjs/ 59 | .rts2_cache_es/ 60 | .rts2_cache_umd/ 61 | 62 | # Optional REPL history 63 | .node_repl_history 64 | 65 | # Output of 'npm pack' 66 | *.tgz 67 | 68 | # Yarn Integrity file 69 | .yarn-integrity 70 | 71 | # dotenv environment variables file 72 | .env 73 | .env.test 74 | 75 | # parcel-bundler cache (https://parceljs.org/) 76 | .cache 77 | 78 | # Next.js build output 79 | .next 80 | 81 | # Nuxt.js build / generate output 82 | .nuxt 83 | dist 84 | 85 | # Gatsby files 86 | .cache/ 87 | # Comment in the public line in if your project uses Gatsby and *not* Next.js 88 | # https://nextjs.org/blog/next-9-1#public-directory-support 89 | # public 90 | 91 | # vuepress build output 92 | .vuepress/dist 93 | 94 | # Serverless directories 95 | .serverless/ 96 | 97 | # FuseBox cache 98 | .fusebox/ 99 | 100 | # DynamoDB Local files 101 | .dynamodb/ 102 | 103 | # TernJS port file 104 | .tern-port 105 | -------------------------------------------------------------------------------- /src/types/commands/fun/weather.js: -------------------------------------------------------------------------------- 1 | const weather = require('weather-js') 2 | const { Client, SlashCommandBuilder, EmbedBuilder, ChatInputCommandInteraction } = require('discord.js') 3 | 4 | module.exports = { 5 | data: new SlashCommandBuilder() 6 | .setName('weather') 7 | .setDescription('Get the current weather from any location') 8 | .addStringOption( 9 | option => 10 | option.setName('location') 11 | .setDescription("A Cityname or a Country") 12 | .setRequired(true)), 13 | category: 'fun', 14 | /** 15 | * 16 | * @param {ChatInputCommandInteraction} interaction 17 | * @param {Client} client 18 | */ 19 | async execute(interaction, client) { 20 | const { options } = interaction; 21 | 22 | const location = options.getString('location'); 23 | 24 | weather.find({ search: location, degreeType: 'C' }, (err, result) => { 25 | if(err) throw err; 26 | if(result === undefined || result.length === 0) return interaction.reply({ content: '**INVALID LOCATION**', ephemeral: true }); 27 | 28 | var current = result[0].current; 29 | var loc = result[0].location; 30 | 31 | const weatherinfo = new EmbedBuilder() 32 | .setColor(client.color) 33 | .setDescription(`**${current.skytext}**`) 34 | .setAuthor({name: `Weather forecast for ${current.observationpoint}`}) 35 | .setThumbnail(current.imageUrl) 36 | .addFields([ 37 | { name: 'Timezone', value: `UTC${loc.timezone}`, inline: true }, 38 | { name: 'Degree Type', value: 'Celsius', inline: true }, 39 | { name: 'Temperature', value: `${current.temperature}°C`, inline: true }, 40 | { name: 'Wind', value: `${current.winddisplay}`, inline: true }, 41 | { name: 'Feels like', value: `${current.feelslike}`, inline: true }, 42 | { name: 'Humidity', value: `${current.humidity}%`, inline: true } 43 | ]) 44 | .setTimestamp(Date.now()) 45 | 46 | return interaction.reply({ embeds: [weatherinfo]}); 47 | }) 48 | } 49 | } -------------------------------------------------------------------------------- /src/types/commands/moderation/kick.js: -------------------------------------------------------------------------------- 1 | const { EmbedBuilder, Client, SlashCommandBuilder, ChatInputCommandInteraction, PermissionFlagsBits } = require('discord.js'); 2 | 3 | module.exports = { 4 | data: new SlashCommandBuilder() 5 | .setName("kick") 6 | .setDescription("Kick a member from the server!") 7 | .addUserOption( 8 | option => 9 | option.setName("user") 10 | .setDescription("Select a User to kick.") 11 | .setRequired(true)) 12 | .addStringOption( 13 | option => 14 | option.setName("reason") 15 | .setDescription("Reason for the kick.") 16 | .setRequired(false)) 17 | .setDMPermission(false) 18 | .setDefaultMemberPermissions(PermissionFlagsBits.KickMembers), 19 | /** 20 | * 21 | * @param {ChatInputCommandInteraction} interaction 22 | * @param {Client} client 23 | */ 24 | async execute(interaction, client) { 25 | const { options, member } = interaction; 26 | 27 | const Target = options.getMember("user"); 28 | const Reason = options.getString("reason"); 29 | 30 | const Response = new EmbedBuilder() 31 | .setColor(client.color) 32 | .setTimestamp(Date.now()); 33 | 34 | /* Check if the user is kickable and if not send an error message! */ 35 | if(Target.kickable) { 36 | 37 | /* Check if a reason is given */ 38 | if(Reason) { 39 | await Target.kick(Reason); 40 | Response.setDescription(`${member} kicked User ${Target}! \n **Reason:** ${Reason}`); 41 | return interaction.reply({embeds: [Response]}); 42 | } else { 43 | await Target.kick(); 44 | Response.setDescription(`${member} kicked User ${Target}! \n **Reason:** No Reason given`); 45 | return interaction.reply({embeds: [Response]}); 46 | } 47 | 48 | } else { 49 | /* Send Error Message */ 50 | Response.setDescription(`❌ Could not kick User ${Target} because of missing Permissions!`) 51 | return interaction.reply({embeds: [Response]}); 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /src/types/commands/moderation/ban.js: -------------------------------------------------------------------------------- 1 | const { Client, SlashCommandBuilder, ChatInputCommandInteraction, PermissionFlagsBits, EmbedBuilder } = require('discord.js') 2 | 3 | module.exports = { 4 | data: new SlashCommandBuilder() 5 | .setName("ban") 6 | .setDescription("Ban a member from the server!") 7 | .addUserOption( 8 | option => 9 | option.setName("user") 10 | .setDescription("Select a user to ban") 11 | .setRequired(true)) 12 | .addStringOption( 13 | option => 14 | option.setName("reason") 15 | .setDescription("Reason for the ban") 16 | .setRequired(false)) 17 | .setDMPermission(false) 18 | .setDefaultMemberPermissions(PermissionFlagsBits.BanMembers), 19 | /** 20 | * @param { ChatInputCommandInteraction } interaction 21 | * @param { Client } client 22 | */ 23 | async execute(interaction, client) { 24 | const { options, member } = interaction; 25 | 26 | const Target = options.getMember("user"); 27 | const Reason = options.getString("reason"); 28 | 29 | const Response = new EmbedBuilder() 30 | .setColor(client.color) 31 | .setTimestamp(Date.now()); 32 | 33 | /* Check if the user is bannable and if not send an error message! */ 34 | if(Target.bannable) { 35 | 36 | /* Check if a reason is given */ 37 | if(Reason) { 38 | await interaction.guild.bans.create(Target, {reason: Reason}); 39 | Response.setDescription(`${member} banned User ${Target}! \n **Reason:** ${Reason}`); 40 | return interaction.reply({embeds: [Response]}); 41 | } else { 42 | await interaction.guild.bans.create(Target); 43 | Response.setDescription(`${member} banned User ${Target}! \n **Reason:** No Reason given`); 44 | return interaction.reply({embeds: [Response]}); 45 | } 46 | 47 | } else { 48 | /* Send Error Message */ 49 | Response.setDescription(`❌ Could not ban User ${Target} because of missing Permissions!`) 50 | return interaction.reply({embeds: [Response]}); 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /src/Systems/GiveawaySystem.js: -------------------------------------------------------------------------------- 1 | const { GiveawaysManager } = require('discord-giveaways'); 2 | const { color } = require('../../config.json') 3 | const giveawayModel = require('../models/Giveaway') 4 | 5 | module.exports = (client) => { 6 | const GiveawayManagerWithOwnDatabase = class extends GiveawaysManager { 7 | // This function is called when the manager needs to get all giveaways which are stored in the database. 8 | async getAllGiveaways() { 9 | // Get all giveaways from the database. We fetch all documents by passing an empty condition. 10 | return await giveawayModel.find().lean().exec(); 11 | } 12 | 13 | // This function is called when a giveaway needs to be saved in the database. 14 | async saveGiveaway(messageId, giveawayData) { 15 | // Add the new giveaway to the database 16 | await giveawayModel.create(giveawayData); 17 | // Don't forget to return something! 18 | return true; 19 | } 20 | 21 | // This function is called when a giveaway needs to be edited in the database. 22 | async editGiveaway(messageId, giveawayData) { 23 | // Find by messageId and update it 24 | await giveawayModel.updateOne({ messageId }, giveawayData).exec(); 25 | // Don't forget to return something! 26 | return true; 27 | } 28 | 29 | // This function is called when a giveaway needs to be deleted from the database. 30 | async deleteGiveaway(messageId) { 31 | // Find by messageId and delete it 32 | await giveawayModel.deleteOne({ messageId }).exec(); 33 | // Don't forget to return something! 34 | return true; 35 | } 36 | }; 37 | 38 | // Create a new instance of your new class 39 | const manager = new GiveawayManagerWithOwnDatabase(client, { 40 | default: { 41 | botsCanWin: false, 42 | embedColor: color, 43 | embedColorEnd: '#171717', 44 | reaction: '🎉' 45 | } 46 | }); 47 | // We now have a giveawaysManager property to access the manager everywhere! 48 | client.giveawaysManager = manager; 49 | } 50 | -------------------------------------------------------------------------------- /src/types/commands/moderation/timeout.js: -------------------------------------------------------------------------------- 1 | const { Client, SlashCommandBuilder, PermissionFlagsBits, EmbedBuilder, ChatInputCommandInteraction, Embed } = require('discord.js') 2 | 3 | module.exports = { 4 | data: new SlashCommandBuilder() 5 | .setName("timeout") 6 | .setDescription("Timeout a user from the server!") 7 | .addUserOption( 8 | option => 9 | option.setName("user") 10 | .setDescription("User to timeout.") 11 | .setRequired(true)) 12 | .addNumberOption( 13 | option => 14 | option.setName("duration") 15 | .setDescription("The duration of the timeout") 16 | .setRequired(true) 17 | .addChoices( 18 | { name: "60 seconds", value: 60*1000 }, 19 | { name: "5 minutes", value: 5*60*1000 }, 20 | { name: "10 minutes", value: 10*60*1000 }, 21 | { name: "30 minutes", value: 30*60*1000 }, 22 | { name: "1 hour", value: 60*60*1000 }, 23 | { name: "1 day", value: 24*60*60*1000 }, 24 | { name: "1 week", value: 7*24*60*60*1000 } 25 | )) 26 | .addStringOption( 27 | option => 28 | option.setName("reason") 29 | .setDescription("Reason for the timeout.") 30 | .setRequired(false)) 31 | .setDMPermission(false) 32 | .setDefaultMemberPermissions(PermissionFlagsBits.ModerateMembers), 33 | /** 34 | * 35 | * @param {ChatInputCommandInteraction} interaction 36 | * @param {Client} client 37 | */ 38 | async execute(interaction, client) { 39 | const { options } = interaction 40 | 41 | let Target = options.getMember("user") 42 | let duration = options.getNumber("duration") 43 | let reason = options.getString("reason") || "No reason given!" 44 | 45 | const Response = new EmbedBuilder() 46 | .setTimestamp(Date.now()) 47 | .setColor(client.color); 48 | 49 | try { 50 | await Target.timeout(duration, reason); 51 | Response.setDescription(`${Target} has been timed out!\n**Reason:** ${reason}`); 52 | return interaction.reply({embeds: [Response]}); 53 | } catch (error) { 54 | console.log(error) 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /src/types/commands/moderation/clear.js: -------------------------------------------------------------------------------- 1 | const { Client, SlashCommandBuilder, ChatInputCommandInteraction, EmbedBuilder, ChannelType, PermissionFlagsBits } = require('discord.js') 2 | const ms = require('ms') 3 | 4 | module.exports = { 5 | data: new SlashCommandBuilder() 6 | .setName("clear") 7 | .setDescription("Delete Messages in a channel") 8 | .addNumberOption( 9 | option => 10 | option.setName("amount") 11 | .setDescription("Amount of messages that is gonna be deleted") 12 | .setRequired(true) 13 | .setMaxValue(100)) 14 | .addChannelOption( 15 | option => 16 | option.setName("channel") 17 | .setDescription("Choose a channel.") 18 | .setRequired(false) 19 | .addChannelTypes(ChannelType.GuildText)) 20 | .setDMPermission(false) 21 | .setDefaultMemberPermissions(PermissionFlagsBits.ManageChannels), 22 | /** 23 | * 24 | * @param {ChatInputCommandInteraction} interaction 25 | * @param {Client} client 26 | */ 27 | async execute(interaction, client) { 28 | const { options, channel } = interaction; 29 | 30 | const Response = new EmbedBuilder() 31 | .setColor(client.color) 32 | .setTimestamp(Date.now()) 33 | .setTitle("📰 Messages") 34 | 35 | const target_channel = options.getChannel("channel"); 36 | const amount = options.getNumber("amount"); 37 | 38 | if(target_channel) { 39 | await target_channel.bulkDelete(amount, true).then(async messages => { 40 | Response.setDescription(`🧹 Deleted ${messages.size} from ${target_channel}.`) 41 | await interaction.reply({embeds: [Response]}).then(inter => { 42 | setTimeout(() => inter.interaction.deleteReply(), 10*1000); 43 | }) 44 | }) 45 | } else { 46 | await channel.bulkDelete(amount, true).then(async messages => { 47 | Response.setDescription(`🧹 Deleted ${messages.size} from ${channel}.`) 48 | await interaction.reply({embeds: [Response]}).then(inter => { 49 | setTimeout(() => inter.interaction.deleteReply(), 10*1000); 50 | }) 51 | }) 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /src/types/commands/user/serverinfo.js: -------------------------------------------------------------------------------- 1 | const { Client, SlashCommandBuilder, ChatInputCommandInteraction, EmbedBuilder, Embed, ChannelType } = require('discord.js'); 2 | 3 | module.exports = { 4 | data: new SlashCommandBuilder() 5 | .setName('serverinfo') 6 | .setDescription('Information about the server!') 7 | .setDMPermission(false), 8 | /** 9 | * @param {ChatInputCommandInteraction} interaction 10 | * @param {Client} client 11 | */ 12 | async execute(interaction, client) { 13 | const { guild } = interaction; 14 | 15 | const Embed = new EmbedBuilder() 16 | .setColor(client.color) 17 | .setAuthor({name: guild.name, iconURL: guild.iconURL()}) 18 | .setThumbnail(guild.iconURL()) 19 | .setTimestamp(Date.now()) 20 | .addFields([ 21 | { name: "💬 │ GENERAL", 22 | value: 23 | ` 24 | 🪧 Name: ${guild.name} 25 | 🕰️ Created: 26 | 👑 Owner: <@${guild.ownerId}> 27 | 28 | 📃 Description: ${guild.description || "None"} 29 | ` 30 | }, 31 | { 32 | name: "📱 │ CHANNELS ", 33 | value: 34 | ` 35 | 📝 Text: ${guild.channels.cache.filter((channel) => channel.type === ChannelType.GuildText).size} 36 | 🔊 Voice: ${guild.channels.cache.filter((channel) => channel.type === ChannelType.GuildVoice).size} 37 | 📜 Threads: ${guild.channels.cache.filter((channel) => channel.type === ChannelType.GuildPublicThread && ChannelType.GuildPrivateThread && ChannelType.GuildNewsThread).size} 38 | 📇 Categories: ${guild.channels.cache.filter((channel) => channel.type === ChannelType.GuildCategory).size} 39 | 40 | 🎁 Total: ${guild.channels.cache.size} 41 | ` 42 | }, 43 | { 44 | name: "😀 | EMOJIS & STICKERS", 45 | value: 46 | ` 47 | 🎞️ Animated: ${guild.emojis.cache.filter((emoji) => emoji.animated).size} 48 | 🖇️ Static: ${guild.emojis.cache.filter((emoji) => !emoji.animated).size} 49 | 💗 Stickers: ${guild.stickers.cache.size} 50 | 51 | 😮 Total: ${guild.emojis.cache.size + guild.stickers.cache.size} 52 | ` 53 | } 54 | ]) 55 | 56 | await interaction.reply({embeds: [Embed]}) 57 | } 58 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![](https://images.hdqwalls.com/wallpapers/wall-e-eve-minimal-4k-je.jpg) 2 | 3 | # EVE-Bot 4 | EVE is the only bot that you need in your discord server, it comes with many features such as a Giveaway System, Application System and much more 5 | - Released: 15.08.2022 6 | - [💌 Invite the bot](https://discord.com/api/oauth2/authorize?client_id=1009480009821474936&permissions=8&scope=bot%20applications.commands) 7 |

8 | 9 | Discord server 10 | 11 |

12 | 13 | ## Commands 14 | 15 | [Click here to see all command categories](./src/types/commands/) 16 | 17 | ## Installation 18 | 19 | 1. Start cloning the repository and installing the dependencies. 20 | ```bash 21 | git clone https://github.com/gokiimax/EVE-Bot.git 22 | cd EVE-Bot 23 | npm install 24 | ``` 25 | 2. Make sure you installed [ffmpeg](https://ffmpeg.org/) (for the music system) 26 | 3. Create a free [MongoDB Database](https://www.mongodb.com/) , [Tutorial Here](https://www.youtube.com/watch?v=Amlh956Xn0I) 27 | 4. Edit your config.json file to your preferences, Create a token on the [Discord Developer Portal](https://discord.com/developers/applications) 28 | ### Config: 29 | ```json 30 | { 31 | "token": "DISCORD TOKEN", 32 | "color": "#34a6ef", 33 | "developerGuild": "GUILD ID", 34 | "database": "MongoDB Url", 35 | "supportServer": "DISCORD Invite Link", 36 | "activityInterval": 10, 37 | "activities": [ 38 | "/invite | dsc.gg/eve-bot", 39 | "/help | {servercount} servers" 40 | ] 41 | } 42 | ``` 43 | 5. If you finished to configurate, you can start the bot 44 | ```bash 45 | npm run start 46 | ``` 47 | 48 | ## Author 49 | [gokimax](https://github.com/gokiimax) 50 | 51 | ## ☕️ Support & Socials 52 | My Bot is open source and free to use. If you found any of my repos useful and would like to support my projects, feel free to follow me. 53 | 54 | 55 | [![TikTok Link](https://img.shields.io/badge/TikTok-000000?style=for-the-badge&logo=tiktok&logoColor=white)](https://tiktok.com/@maxii.x6) 56 | [![Twitter Link](https://img.shields.io/badge/Twitter-1DA1F2?style=for-the-badge&logo=twitter&logoColor=white)](https://twitter.com/gokimax_x) 57 | [![Youtube Link](https://img.shields.io/badge/YOUTUBE-E4405F?style=for-the-badge&logo=youtube&logoColor=white)](https://youtube.com/@gokimax) 58 | -------------------------------------------------------------------------------- /src/types/events/commands/interactionCreate.js: -------------------------------------------------------------------------------- 1 | const { Client, CommandInteraction, InteractionType } = require("discord.js"); 2 | 3 | module.exports = { 4 | name: "interactionCreate", 5 | /** 6 | * @param {Client} client 7 | * @param {CommandInteraction} interaction 8 | */ 9 | async execute(interaction, client) { 10 | 11 | if(interaction.isChatInputCommand() || interaction.isUserContextMenuCommand()) { 12 | const { commands } = client; 13 | const { commandName } = interaction; 14 | const command = commands.get(commandName); 15 | if(!command) return; 16 | 17 | try { 18 | await command.execute(interaction, client); 19 | } catch (err) { 20 | console.error(err) 21 | interaction.reply({content: `Something went wrong while executing this command.`, ephemeral: true}) 22 | } 23 | 24 | } else if(interaction.isButton()) { 25 | const { buttons } = client; 26 | const button = buttons.get(interaction.customId); 27 | 28 | if(!button) return new Error("There is no code for this button!") 29 | 30 | try { 31 | await button.execute(interaction, client) 32 | } catch (error) { 33 | console.error(error) 34 | } 35 | 36 | 37 | } else if(interaction.type == InteractionType.ModalSubmit) { 38 | const { modals } = client; 39 | const modal = modals.get(interaction.customId) 40 | 41 | if(!modal) return new Error("There is no code for this modal!") 42 | 43 | try { 44 | await modal.execute(interaction, client) 45 | } catch (error) { 46 | console.error(error) 47 | } 48 | } else if(interaction.isContextMenuCommand()) { 49 | const { commands } = client; 50 | const { commandName } = interaction; 51 | const contextCommand = commands.get(commandName) 52 | if(!contextCommand) return; 53 | 54 | try { 55 | await contextCommand.execute(interaction, client); 56 | } catch (error) { 57 | console.error(error); 58 | } 59 | } else if(interaction.isSelectMenu()) { 60 | const { selectMenus } = client; 61 | const menu = selectMenus.get(interaction.customId); 62 | if(!menu) return new Error('There is no code for this select menu.') 63 | try { 64 | await menu.execute(interaction, client); 65 | } catch (error) { 66 | console.error(error); 67 | } 68 | } 69 | 70 | }, 71 | }; 72 | -------------------------------------------------------------------------------- /src/types/commands/user/afk.js: -------------------------------------------------------------------------------- 1 | const { CommandInteraction, Client, EmbedBuilder, SlashCommandBuilder } = require('discord.js') 2 | const DB = require("../../../models/AFKSystem") 3 | 4 | module.exports = { 5 | data: new SlashCommandBuilder() 6 | .setName("afk") 7 | .setDescription("Set yourself away from keyboard!") 8 | .addSubcommand( 9 | command => 10 | command.setName("set") 11 | .setDescription("Set your AFK status!") 12 | .addStringOption( 13 | option => 14 | option.setName("status") 15 | .setDescription("Set your status message!") 16 | .setRequired(true) 17 | ) 18 | ) 19 | .addSubcommand( 20 | command => 21 | command.setName("return") 22 | .setDescription("Return from being afk!")), 23 | 24 | /** 25 | * @param {Client} client 26 | * @param {CommandInteraction} interaction 27 | */ 28 | async execute(interaction, client) { 29 | const { guild, user, createdTimestamp, options } = interaction; 30 | 31 | const Response = new EmbedBuilder() 32 | .setTitle("💤 AFK System") 33 | .setAuthor({name: user.tag, iconURL: user.displayAvatarURL()}) 34 | 35 | const afkStatus = options.getString("status") 36 | 37 | try { 38 | 39 | switch (options.getSubcommand()) { 40 | case "set": { 41 | await DB.findOneAndUpdate( 42 | {GuildID: guild.id, UserID: user.id}, 43 | {Status: afkStatus, Time: parseInt(createdTimestamp / 1000)}, 44 | {new: true, upsert: true} 45 | ) 46 | 47 | Response.setColor(client.color).setDescription(`✅ Your AFK status has been updated to ${afkStatus}.`); 48 | 49 | return interaction.reply({embeds: [Response], ephemeral: true}) 50 | } 51 | break; 52 | 53 | case "return": { 54 | await DB.deleteOne({ GuildID: guild.id, UserID: user.id }); 55 | 56 | Response.setColor(client.color).setDescription(`❌ Your AFK status has been removed.`); 57 | 58 | return interaction.reply({embeds: [Response], ephemeral: true}) 59 | } 60 | break; 61 | } 62 | 63 | } catch (err) { 64 | return console.error(err) 65 | } 66 | } 67 | } -------------------------------------------------------------------------------- /src/types/events/guild/guildMemberRemove.js: -------------------------------------------------------------------------------- 1 | const { Client, GuildMember, EmbedBuilder } = require('discord.js'); 2 | 3 | const featuresDB = require('../../../models/Features') 4 | const leaveDB = require('../../../models/LeaveSystem') 5 | 6 | module.exports = { 7 | name: "guildMemberRemove", 8 | rest: false, 9 | once: false, 10 | /** 11 | * @param { Client } client 12 | * @param { GuildMember } member 13 | */ 14 | async execute(member, client) { 15 | 16 | const { guild } = member; 17 | 18 | /* Leave Greetings */ 19 | featuresDB.findOne({ GuildID: guild.id }, async (err, data) => { 20 | if(err) throw err; 21 | 22 | if(!data) return; 23 | 24 | if(data) { 25 | if(data.Leave) { 26 | const LeaveEmbed = new EmbedBuilder() 27 | .setColor(client.color) 28 | .setTitle("🔙 Leave") 29 | .setDescription(`**${member.user.tag}** just left the server! We hope they return back soon!`) 30 | .setThumbnail(member.user.displayAvatarURL()) 31 | .setFooter({text: `We now have ${member.guild.memberCount} members!`, iconURL: member.guild.iconURL()}) 32 | 33 | leaveDB.findOne({GuildID: guild.id}, async (err, data) => { 34 | if (err) throw err; 35 | 36 | if(data) { 37 | if(data.Message) { 38 | LeaveEmbed.setDescription(data.Message.replace("{user}", member.user.tag).replace("{server}", member.guild.name)) 39 | } else { 40 | LeaveEmbed.setDescription(`**${member.user.tag}** just left the server! We hope they return back soon!`) 41 | } 42 | 43 | if(data.ChannelID) { 44 | const channel = guild.channels.cache.find(channel => channel.id === data.ChannelID); 45 | await channel.send({ embeds: [LeaveEmbed] }) 46 | } 47 | } else { 48 | guild.systemChannel.send({embeds: [LeaveEmbed]}); 49 | } 50 | }) 51 | 52 | } else { 53 | return; 54 | } 55 | } 56 | }) 57 | 58 | } 59 | } -------------------------------------------------------------------------------- /src/types/commands/user/help.js: -------------------------------------------------------------------------------- 1 | const { Client, SlashCommandBuilder, ChatInputCommandInteraction, EmbedBuilder } = require('discord.js') 2 | 3 | module.exports = { 4 | data: new SlashCommandBuilder() 5 | .setName('help') 6 | .setDescription('Need help, use this command!') 7 | .addStringOption( 8 | option => 9 | option.setName('command') 10 | .setDescription('Get information about a command!') 11 | ), 12 | /** 13 | * 14 | * @param {ChatInputCommandInteraction} interaction 15 | * @param {Client} client 16 | */ 17 | async execute(interaction, client) { 18 | const { options, member } = interaction; 19 | 20 | const command = options.getString('command'); 21 | 22 | const helpEmbed = new EmbedBuilder() 23 | .setTitle('📬 Need help? Here are all of my commands') 24 | .setDescription('Use ``/help`` followed by a command name to get more additional information on a command. For example ``/help afk``') 25 | .setColor(client.color) 26 | .setFooter({ text: `Requested by ${member.user.tag}`, iconURL: member.user.displayAvatarURL() }) 27 | .setTimestamp(Date.now()) 28 | 29 | if(command) { 30 | if(client.commands.get(command)) { 31 | const commandInformation = client.commands.get(command) 32 | 33 | helpEmbed.setTitle(command).setDescription(commandInformation.data.description); 34 | return interaction.reply({ embeds: [helpEmbed], ephemeral: true }) 35 | } else { 36 | return interaction.reply({ content: `\`\`${command}\`\` is not a valid command!`, ephemeral: true }); 37 | } 38 | } else { 39 | helpEmbed.addFields([ 40 | { name: '👑 OWNER', value: '``announce``' }, 41 | { name: '⚙️ CONFIG', value: '``setup`` ``chatfilter`` ``reactionroles``' }, 42 | { name: '🎉 GIVEAWAY', value: '``giveaway``' }, 43 | { name: '📖 MODERATION', value: '``ban`` ``kick`` ``mute`` ``checkwarns`` ``warn`` ``unmute`` ``lock`` ``slowmode`` ``timeout`` ``unban`` ' }, 44 | { name: '🗣️ USER', value: '``afk`` ``avatar`` ``dm`` ``help`` ``invite`` ``membercount`` ``serverinfo`` ``userinfo`` ``temp`` ' }, 45 | { name: '🤡 FUN', value: '``together`` ``weather`` ``anime`` ``meme`` ``translate`` ``confession`` ' }, 46 | ]) 47 | 48 | return interaction.reply({ embeds: [helpEmbed] }) 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /src/types/commands/moderation/warn_cmd.js: -------------------------------------------------------------------------------- 1 | const { Client, SlashCommandBuilder, PermissionFlagsBits, ChatInputCommandInteraction, EmbedBuilder } = require('discord.js'); 2 | const warnDB = require('../../../models/WarnSystem') 3 | const { addInteractionPoints, removeInteractionPoints } = require('../../../utils/warnpoints') 4 | 5 | module.exports = { 6 | data: new SlashCommandBuilder() 7 | .setName("warn") 8 | .setDescription("Warn a user!") 9 | /* Add */ 10 | .addSubcommand( 11 | command => 12 | command.setName("add") 13 | .setDescription("Add warn points to specific user!") 14 | .addUserOption( 15 | option => 16 | option.setName("user") 17 | .setDescription("The user you want to add warn points!") 18 | .setRequired(true)) 19 | .addStringOption( 20 | option => 21 | option.setName("reason") 22 | .setDescription("The reason you want to add warn points!") 23 | .setRequired(false))) 24 | /* Remove */ 25 | .addSubcommand( 26 | command => 27 | command.setName("remove") 28 | .setDescription("Remove warn points from specific user!") 29 | .addUserOption( 30 | option => 31 | option.setName("user") 32 | .setDescription("The user you want to add warn points!") 33 | .setRequired(true)) 34 | .addNumberOption( 35 | option => 36 | option.setName("points") 37 | .setDescription("How many points you want to remove!") 38 | .setRequired(true)) 39 | ) 40 | .setDMPermission(false) 41 | .setDefaultMemberPermissions(PermissionFlagsBits.ModerateMembers), 42 | /** 43 | * 44 | * @param {ChatInputCommandInteraction} interaction 45 | * @param {Client} client 46 | */ 47 | async execute(interaction, client) { 48 | const { options } = interaction; 49 | 50 | const Target = options.getMember("user"); 51 | const Sub = options.getSubcommand(); 52 | 53 | const Response = new EmbedBuilder() 54 | .setColor(client.color) 55 | .setTimestamp(Date.now()) 56 | 57 | switch (Sub) { 58 | case "add": { 59 | const reason = options.getString("reason") || "No Reason given!" 60 | 61 | addInteractionPoints(1, interaction, reason, Target, client); 62 | } break; 63 | 64 | case "remove": { 65 | const points = options.getNumber("points"); 66 | removeInteractionPoints(points, interaction, Target, client); 67 | } break; 68 | } 69 | } 70 | } -------------------------------------------------------------------------------- /src/types/commands/fun/anime.js: -------------------------------------------------------------------------------- 1 | const { Client, ChatInputCommandInteraction, SlashCommandBuilder, EmbedBuilder, Embed } = require('discord.js') 2 | const { get } = require('request-promise-native') 3 | 4 | module.exports = { 5 | data: new SlashCommandBuilder() 6 | .setName("anime") 7 | .setDescription("Get information about an Anime") 8 | .addStringOption( 9 | option => 10 | option.setName('name') 11 | .setDescription('The name of the anime') 12 | .setRequired(true)), 13 | category: 'fun', 14 | /** 15 | * @param {ChatInputCommandInteraction} interaction 16 | * @param {Client} client 17 | */ 18 | async execute(interaction, client) { 19 | const { options } = interaction; 20 | const name = options.getString('name') 21 | 22 | let option = { 23 | url: `https://kitsu.io/api/edge/anime?filter[text]=${name}`, 24 | method: `GET`, 25 | headers: { 26 | 'Content-Type': 'application/vnd.api+json', 27 | 'Accept': 'application/vnd.api+json', 28 | }, 29 | json:true 30 | } 31 | 32 | interaction.reply("Fetching your Anime info, Please Wait...").then(msg => { 33 | get(option).then(mat => { 34 | const Embed = new EmbedBuilder() 35 | .setTitle(mat.data[0].attributes.titles.en_jp) 36 | .setURL(`https://kitsu.io/anime/${mat.data[0].id}`) 37 | .setDescription(mat.data[0].attributes.synopsis) 38 | .setColor(client.color) 39 | .addFields([ 40 | { name: 'Type', value: mat.data[0].attributes.subtype, inline: true }, 41 | { name: 'Average Rating', value: mat.data[0].attributes.averageRating, inline: true }, 42 | { name: 'Next Release', value: mat.data[0].attributes.nextRelease || 'N/A', inline: true }, 43 | { name: 'Published', value: `${mat.data[0].attributes.startDate} **TO** ${mat.data[0].attributes.endDate ? mat.data[0].attributes.endDate : 'N/A'}`, inline: true }, 44 | { name: 'Age Rating', value: `${mat.data[0].attributes.ageRatingGuide}`, inline: true }, 45 | { name: 'Episodes', value: `${mat.data[0].attributes.episodeCount}`, inline: true }, 46 | { name: 'Status', value: `${mat.data[0].attributes.status}`, inline: true }, 47 | ]) 48 | .setThumbnail(mat.data[0].attributes.posterImage.large) 49 | .setFooter({text: 'Data from kitsu.io', iconURL: client.user.displayAvatarURL()}) 50 | 51 | interaction.channel.send({embeds: [Embed]}) 52 | }) 53 | msg.interaction.deleteReply() 54 | }) 55 | } 56 | } -------------------------------------------------------------------------------- /src/types/commands/moderation/slowmode.js: -------------------------------------------------------------------------------- 1 | const { Client, ChatInputCommandInteraction, SlashCommandBuilder, EmbedBuilder, ChannelType, PermissionFlagsBits } = require('discord.js'); 2 | 3 | module.exports = { 4 | data: new SlashCommandBuilder() 5 | .setName("slowmode") 6 | .setDescription("Enable or disable slowmode in a Channel!") 7 | .addStringOption( 8 | option => 9 | option.setName("time") 10 | .setDescription("Slowmode time!") 11 | .addChoices( 12 | { name: "remove", value: "remove" }, 13 | { name: "10 seconds", value: "10" }, 14 | { name: "20 seconds", value: "20" }, 15 | { name: "30 seconds", value: "30" }, 16 | { name: "1 minute", value: "60" }, 17 | { name: "5 minutes", value: "300" } 18 | ).setRequired(true)) 19 | .addChannelOption( 20 | option => 21 | option.setName("channel") 22 | .setDescription("The Channel you want to enable/disable slowmode!") 23 | .addChannelTypes(ChannelType.GuildText)) 24 | .setDMPermission(false) 25 | .setDefaultMemberPermissions(PermissionFlagsBits.ManageChannels), 26 | /** 27 | * @param {ChatInputCommandInteraction} interaction 28 | * @param {Client} client 29 | */ 30 | async execute(interaction, client) { 31 | const { options, channel } = interaction; 32 | 33 | const options_channel = options.getChannel("channel"); 34 | const time = options.getString("time") 35 | 36 | const Response = new EmbedBuilder() 37 | .setTitle("🦥 Slowmode") 38 | .setColor(client.color) 39 | .setTimestamp(Date.now()); 40 | 41 | if(options_channel) { 42 | if(time == "remove") { 43 | options_channel.setRateLimitPerUser(0); 44 | 45 | Response.setDescription(`Removed Slowmode from ${options_channel}`); 46 | 47 | return interaction.reply({embeds: [Response]}); 48 | } else { 49 | options_channel.setRateLimitPerUser(parseInt(time)); 50 | 51 | Response.setDescription(`Added Slowmode to ${options_channel}\n**Time:** \`${time}s\` `); 52 | 53 | return interaction.reply({embeds: [Response]}); 54 | } 55 | } else { 56 | if(time == "remove") { 57 | channel.setRateLimitPerUser(0); 58 | 59 | Response.setDescription(`Removed Slowmode from ${channel}`); 60 | 61 | return interaction.reply({embeds: [Response]}); 62 | } else { 63 | channel.setRateLimitPerUser(parseInt(time)); 64 | 65 | Response.setDescription(`Added Slowmode to ${channel}\n**Time:** \`${time}s\` `); 66 | 67 | return interaction.reply({embeds: [Response]}); 68 | } 69 | } 70 | 71 | } 72 | } -------------------------------------------------------------------------------- /src/types/events/guild/guildMemberAdd.js: -------------------------------------------------------------------------------- 1 | const { Client, GuildMember, EmbedBuilder } = require('discord.js'); 2 | 3 | const featuresDB = require('../../../models/Features') 4 | const welcomeDB = require('../../../models/WelcomeSystem') 5 | 6 | module.exports = { 7 | name: "guildMemberAdd", 8 | rest: false, 9 | once: false, 10 | /** 11 | * @param { Client } client 12 | * @param { GuildMember } member 13 | */ 14 | async execute(member, client) { 15 | 16 | const { guild } = member; 17 | 18 | /* Welcome Greetings */ 19 | featuresDB.findOne({ GuildID: member.guild.id }, (err, feature_data) => { 20 | if(err) throw err; 21 | 22 | if(!feature_data) return; 23 | 24 | if(feature_data) { 25 | if(feature_data.Welcome) { 26 | const WelcomeEmbed = new EmbedBuilder() 27 | .setColor(client.color) 28 | .setTitle("👋 Welcome") 29 | .setDescription(`${member} joined the server! Welcome to **${member.guild.name}**!`) 30 | .setThumbnail(member.user.displayAvatarURL()) 31 | .setFooter({text: `We now have ${member.guild.memberCount} members!`, iconURL: member.guild.iconURL()}) 32 | 33 | welcomeDB.findOne({GuildID: member.guild.id}, async (err, data) => { 34 | if (err) throw err; 35 | 36 | if(data) { 37 | if(data.Message) { 38 | WelcomeEmbed.setDescription(data.Message.replace("{user}", member).replace("{server}", member.guild.name)) 39 | } else { 40 | WelcomeEmbed.setDescription(`${member} joined the server! Welcome to **${member.guild.name}**!`) 41 | } 42 | 43 | if(data.ChannelID) { 44 | const channel = guild.channels.cache.get(data.ChannelID); 45 | await channel.send({ embeds: [WelcomeEmbed] }) 46 | } else { 47 | await guild.systemChannel.send({embeds: [WelcomeEmbed]}); 48 | } 49 | 50 | if(data.RoleID) { 51 | if(!feature_data.CaptchaSystem) { 52 | const role = guild.roles.cache.find(role => role.id === data.RoleID); 53 | member.roles.add(role); 54 | } 55 | } 56 | } else { 57 | guild.systemChannel.send({embeds: [WelcomeEmbed]}); 58 | } 59 | }) 60 | 61 | } else { 62 | return; 63 | } 64 | } 65 | }) 66 | 67 | } 68 | } -------------------------------------------------------------------------------- /src/types/commands/system/announce.js: -------------------------------------------------------------------------------- 1 | const { Client, SlashCommandBuilder, ChatInputCommandInteraction, EmbedBuilder, ChannelType, PermissionFlagsBits } = require('discord.js'); 2 | 3 | module.exports = { 4 | data: new SlashCommandBuilder() 5 | .setName('announce') 6 | .setDescription('Send an announce Embed.') 7 | .addStringOption( 8 | option => 9 | option.setName('title') 10 | .setDescription('Title of your announcement') 11 | .setRequired(true) 12 | .setMinLength(1)) 13 | .addStringOption( 14 | option => 15 | option.setName('description') 16 | .setDescription('Description of your announcement') 17 | .setRequired(true) 18 | .setMinLength(1)) 19 | .addChannelOption( 20 | option => 21 | option.setName('channel') 22 | .setDescription('Channel you want to send the announcement!') 23 | .addChannelTypes(ChannelType.GuildText)) 24 | .addRoleOption( 25 | option => 26 | option.setName('notify_role') 27 | .setDescription('The notify role of your server.')) 28 | .setDMPermission(false) 29 | .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), 30 | /** 31 | * @param {ChatInputCommandInteraction} interaction 32 | * @param {Client} client 33 | */ 34 | async execute(interaction, client) { 35 | const { options, member } = interaction; 36 | 37 | const title = options.getString('title'); 38 | const description = options.getString('description'); 39 | const channel = options.getChannel('channel') 40 | const role = options.getRole('notify_role') 41 | 42 | const NewsEmbed = new EmbedBuilder() 43 | .setTitle(`📢 ${title}`) 44 | .setDescription(description) 45 | .setColor(client.color) 46 | .setTimestamp(Date.now()) 47 | .setFooter({ text: `Created by ${member.user.tag}`, iconURL: member.user.displayAvatarURL() }); 48 | 49 | const Response = new EmbedBuilder() 50 | .setDescription('✅ Successfully sent Announcement!') 51 | .setColor(client.color) 52 | .setTimestamp(Date.now()) 53 | 54 | if(channel) { 55 | if(role) { 56 | channel.send({embeds: [NewsEmbed], content: `<@&${role.id}>`}) 57 | interaction.reply({embeds: [Response], ephemeral: true}) 58 | } else { 59 | channel.send({embeds: [NewsEmbed]}) 60 | interaction.reply({embeds: [Response], ephemeral: true}) 61 | } 62 | } else { 63 | if(role) { 64 | interaction.channel.send({embeds: [NewsEmbed], content: `<@&${role.id}>`}) 65 | interaction.reply({embeds: [Response], ephemeral: true}) 66 | } else { 67 | interaction.channel.send({embeds: [NewsEmbed]}) 68 | interaction.reply({embeds: [Response], ephemeral: true}) 69 | } 70 | } 71 | } 72 | } -------------------------------------------------------------------------------- /src/types/commands/levelSystem/rank.js: -------------------------------------------------------------------------------- 1 | const { Client, SlashCommandBuilder, ChatInputCommandInteraction, EmbedBuilder, AttachmentBuilder } = require('discord.js') 2 | const { calculateXP } = require('../../../utils/levelsystem') 3 | const Canvacord = require('canvacord') 4 | const { color } = require('../../../../config.json') 5 | 6 | const featuresDB = require('../../../models/Features'); 7 | const levelsDB = require('../../../models/Levels'); 8 | 9 | module.exports = { 10 | data: new SlashCommandBuilder() 11 | .setName('rank') 12 | .setDescription('See your level or the level from other people! (The level System need to be enabled)') 13 | .addUserOption( 14 | option => 15 | option.setName('user') 16 | .setDescription('Member you want to see the level') 17 | ), 18 | category: 'level', 19 | /** 20 | * 21 | * @param {ChatInputCommandInteraction} interaction 22 | * @param {Client} client 23 | */ 24 | async execute(interaction, client) { 25 | const { options, guild, member } = interaction; 26 | let members = [] 27 | 28 | featuresDB.findOne({ GuildID: guild.id }, async (err, data) => { 29 | if(err) throw err; 30 | if(!data || !data.LevelSystem) return interaction.reply({content: `❌ The Level System is not Enabled in this server!`, ephemeral: true}) 31 | 32 | const rankcard = new Canvacord.Rank() 33 | const user = options.getUser('user') 34 | 35 | const levelResult = user ? await levelsDB.findOne({GuildID: guild.id, UserID: user.id}) : await levelsDB.findOne({GuildID: guild.id, UserID: member.id}); 36 | if(levelResult && levelResult.xp) { 37 | rankcard.setAvatar(user ? user.displayAvatarURL({ extension: 'png' }) : member.user.displayAvatarURL({ extension: 'png' })) 38 | .setCurrentXP(parseInt(`${levelResult.xp || "0"}`)) 39 | .setLevel(parseInt(`${levelResult.level || "1"}`)) 40 | .setProgressBar(color) 41 | .setRequiredXP(calculateXP(levelResult.level)) 42 | .setOverlay("#000000") 43 | .setDiscriminator(user ? user.discriminator : member.user.discriminator, '#303030') 44 | .setUsername(`${user ? user.username : member.user.username}`, color) 45 | .setBackground('IMAGE', 'https://cdn.discordapp.com/attachments/965674056080826368/1012314750677426197/eve-rank.png') 46 | .renderEmojis(true) 47 | .setLevelColor(color) 48 | .setProgressBarTrack('#1a1a1a') 49 | .setRank(0, 'N/A', false) 50 | } else { 51 | return interaction.reply({content: `${user ? user : member} does not have any XP 🙁`, ephemeral: true}) 52 | } 53 | 54 | const img = rankcard.build() 55 | const atta = new AttachmentBuilder(await img).setName("rank.png") 56 | interaction.reply({files: [atta]}); 57 | }) 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/types/commands/fun/together.js: -------------------------------------------------------------------------------- 1 | const { DiscordTogether } = require('discord-together') 2 | const { Client, SlashCommandBuilder, ChannelType, ChatInputCommandInteraction, EmbedBuilder } = require('discord.js') 3 | 4 | module.exports = { 5 | data: new SlashCommandBuilder() 6 | .setName("together") 7 | .setDescription("Watch youtube videos together!") 8 | .addChannelOption( 9 | option => 10 | option.setName("channel") 11 | .setDescription("Channel you want to acctivate this activity!") 12 | .addChannelTypes(ChannelType.GuildVoice) 13 | .setRequired(true)) 14 | .addStringOption( 15 | option => 16 | option.setName("activity") 17 | .setDescription("The activity you want to perform!") 18 | .setRequired(true) 19 | .addChoices( 20 | { name: "📺 Youtube", value: "youtube" }, 21 | { name: "☕ Word Snack", value: "wordsnack" }, 22 | { name: "📝 Sketch Heads", value: "sketchheads" }, 23 | ) 24 | ), 25 | category: 'fun', 26 | /** 27 | * 28 | * @param {ChatInputCommandInteraction} interaction 29 | * @param {Client} client 30 | */ 31 | async execute(interaction, client) { 32 | const discordTogether = new DiscordTogether(client); 33 | const { options } = interaction; 34 | const activity = options.getString("activity") 35 | const channel = options.getChannel("channel") 36 | 37 | const Response = new EmbedBuilder() 38 | .setFooter({text: client.user.tag, iconURL: client.user.displayAvatarURL()}) 39 | .setTimestamp(Date.now()) 40 | .setColor(client.color) 41 | 42 | switch(activity) { 43 | 44 | case "youtube": { 45 | Response.setTitle("📺 Youtube"); 46 | discordTogether.createTogetherCode( channel.id, 'youtube' ).then(x => { 47 | Response.setDescription(`[Click to watch youtube in ${channel}](${x.code})`) 48 | return interaction.reply({embeds: [Response]}) 49 | }) 50 | } 51 | break; 52 | 53 | case "wordsnack": { 54 | Response.setTitle("☕ Word Snack"); 55 | discordTogether.createTogetherCode( channel.id, 'wordsnack' ).then(x => { 56 | Response.setDescription(`[Click to play wordsnack in ${channel}](${x.code})`) 57 | return interaction.reply({embeds: [Response]}) 58 | }) 59 | } 60 | break; 61 | 62 | case "sketchheads": { 63 | Response.setTitle("✏️ Sketch Heads"); 64 | discordTogether.createTogetherCode( channel.id, 'sketchheads' ).then(x => { 65 | Response.setDescription(`[Click to play Sketch Heads in ${channel}](${x.code})`) 66 | return interaction.reply({embeds: [Response]}) 67 | }) 68 | } 69 | break; 70 | 71 | } 72 | 73 | } 74 | } -------------------------------------------------------------------------------- /src/types/commands/developer/botupdate.js: -------------------------------------------------------------------------------- 1 | const { Client, SlashCommandBuilder, ChatInputCommandInteraction, EmbedBuilder, PermissionFlagsBits, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js'); 2 | 3 | module.exports = { 4 | data: new SlashCommandBuilder() 5 | .setName('botupdate') 6 | .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) 7 | .setDescription('Create a new Update Message for your Bot!') 8 | .addStringOption( 9 | option => 10 | option.setName('update') 11 | .setDescription('Provide a Update Message') 12 | .setRequired(true)) 13 | .addStringOption( 14 | option => 15 | option.setName('preview') 16 | .setDescription('Add a picture link!') 17 | ), 18 | category: 'developer', 19 | developer: true, 20 | /** 21 | * 22 | * @param {ChatInputCommandInteraction} interaction 23 | * @param {Client} client 24 | */ 25 | async execute(interaction, client) { 26 | const { options } = interaction; 27 | 28 | const update = options.getString('update') 29 | const preview = options.getString('preview') 30 | 31 | const button = new ButtonBuilder() 32 | .setLabel("Support Server") 33 | .setStyle(ButtonStyle.Link) 34 | .setURL(client.config.supportServer) 35 | 36 | const UpdateEmbed = new EmbedBuilder() 37 | .setTitle('📢 Bot Update') 38 | .setFooter({text: `Creator ${interaction.member.user.tag}`, iconURL: interaction.member.user.displayAvatarURL()}) 39 | .setDescription(`**Changelog**: \n${update}`) 40 | .setTimestamp(Date.now()) 41 | .setColor(client.color) 42 | 43 | if(preview) { 44 | if(isValidHttpUrl(preview)) UpdateEmbed.setImage(preview) 45 | else return; 46 | } 47 | 48 | const guilds = client.guilds.cache 49 | guilds.forEach(guild => { 50 | const systemChannel = guild.systemChannel 51 | if(systemChannel) { 52 | systemChannel.send({embeds: [UpdateEmbed], components: [new ActionRowBuilder().addComponents(button)]}).catch() 53 | } else { 54 | interaction.reply({ 55 | embeds: [ 56 | new EmbedBuilder() 57 | .setDescription(`❌ ${guild.name} does not have an System Channel!`) 58 | .setColor(client.color) 59 | ] 60 | }) 61 | } 62 | }) 63 | 64 | interaction.reply({ 65 | embeds: [ 66 | new EmbedBuilder() 67 | .setDescription(`✅ Successfully sent Update to ${client.guilds.cache.size} server!`) 68 | .setColor(client.color) 69 | ] 70 | }) 71 | } 72 | } 73 | 74 | function isValidHttpUrl(string) { 75 | let url; 76 | 77 | try { 78 | url = new URL(string); 79 | } catch (_) { 80 | return false 81 | } 82 | 83 | return url.protocol === "https:" || url.protocol === "http:"; 84 | } -------------------------------------------------------------------------------- /src/types/events/client/guildDelete.js: -------------------------------------------------------------------------------- 1 | const { Client, EmbedBuilder, Guild } = require('discord.js'); 2 | const { updateActivity } = require('../../../utils/updatePresence') 3 | 4 | const featuresDB = require('../../../models/Features') 5 | const afkDB = require('../../../models/AFKSystem') 6 | const blacklist = require('../../../models/BlacklistSystem') 7 | const Catpcha = require('../../../models/CaptchaSystem') 8 | const chatFilter = require('../../../models/ChatFilter') 9 | const confesstion = require('../../../models/ConfessionSettings') 10 | const confessionsys = require('../../../models/ConfessionSystem') 11 | const giveaway = require('../../../models/Giveaway') 12 | const Leave = require('../../../models/LeaveSystem') 13 | const Levels = require('../../../models/Levels') 14 | const Levelsys = require('../../../models/LevelSystem') 15 | const ModerationLogs = require('../../../models/ModerationLogs') 16 | const mute = require('../../../models/MuteSystem') 17 | const rrDB = require('../../../models/ReactionRoles') 18 | const ssys = require('../../../models/SuggestSystem') 19 | const Ticket = require('../../../models/Ticket') 20 | const TicketSys = require('../../../models/TicketSystem') 21 | const VoiceSys = require('../../../models/VoiceSystem') 22 | const WarnSys = require('../../../models/WarnSystem') 23 | const welcome = require('../../../models/WelcomeSystem') 24 | 25 | module.exports = { 26 | name: "guildDelete", 27 | rest: false, 28 | once: false, 29 | /** 30 | * @param { Guild } guild 31 | * @param { Client } client 32 | */ 33 | async execute(guild, client) { 34 | console.log(`Left Server ${guild.name}`) 35 | 36 | await featuresDB.findOneAndDelete({ GuildID: guild.id }); 37 | await afkDB.findOneAndDelete({ GuildID: guild.id }); 38 | await blacklist.findOneAndDelete({ GuildID: guild.id }); 39 | await Catpcha.findOneAndDelete({ GuildID: guild.id }); 40 | await chatFilter.findOneAndDelete({ GuildID: guild.id }); 41 | await confesstion.findOneAndDelete({ GuildID: guild.id }); 42 | await confessionsys.findOneAndDelete({ GuildID: guild.id }); 43 | await giveaway.findOneAndDelete({ GuildID: guild.id }); 44 | await Leave.findOneAndDelete({ GuildID: guild.id }); 45 | await Levels.findOneAndDelete({ GuildID: guild.id }); 46 | await Levelsys.findOneAndDelete({ GuildID: guild.id }); 47 | await ModerationLogs.findOneAndDelete({ GuildID: guild.id }); 48 | await mute.findOneAndDelete({ GuildID: guild.id }); 49 | await rrDB.findOneAndDelete({ GuildID: guild.id }); 50 | await ssys.findOneAndDelete({ GuildID: guild.id }); 51 | await Ticket.findOneAndDelete({ GuildID: guild.id }); 52 | await TicketSys.findOneAndDelete({ GuildID: guild.id }); 53 | await VoiceSys.findOneAndDelete({ GuildID: guild.id }); 54 | await WarnSys.findOneAndDelete({ GuildID: guild.id }); 55 | await welcome.findOneAndDelete({ GuildID: guild.id }); 56 | 57 | updateActivity(client, client.config.activityInterval); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/types/commands/developer/suggest.js: -------------------------------------------------------------------------------- 1 | const { ButtonBuilder } = require('@discordjs/builders'); 2 | const { Client, SlashCommandBuilder, ChatInputCommandInteraction, EmbedBuilder, ActionRowBuilder, ButtonStyle } = require('discord.js') 3 | const suggestDB = require('../../../models/SuggestSystem') 4 | 5 | module.exports = { 6 | data: new SlashCommandBuilder() 7 | .setName('suggest') 8 | .setDescription('Suggest') 9 | .addStringOption( 10 | option => 11 | option.setName('type') 12 | .setDescription('Select an option.') 13 | .setRequired(true) 14 | .addChoices( 15 | { name: 'Command', value: 'command' }, 16 | { name: 'System', value: 'system' }, 17 | { name: 'Other', value: 'other' })) 18 | .addStringOption( 19 | option => 20 | option.setName('suggestion') 21 | .setDescription('Your suggestion') 22 | .setRequired(true)) 23 | .addStringOption( 24 | option => 25 | option.setName('description') 26 | .setDescription('Describe your suggestion.') 27 | .setMinLength(20) 28 | .setRequired(true)), 29 | developer: true, 30 | category: 'developer', 31 | /** 32 | * @param {ChatInputCommandInteraction} interaction 33 | * @param {Client} client 34 | */ 35 | async execute(interaction, client) { 36 | const { options, guildId, member, user } = interaction; 37 | 38 | const type = options.getString('type') 39 | const suggestion = options.getString('description') 40 | const title = options.getString('suggestion') 41 | 42 | const Embed = new EmbedBuilder() 43 | .setColor(client.color) 44 | .setTitle(`Suggestion: ${title}`) 45 | .setDescription(`\`${suggestion}\``) 46 | .setAuthor({ name: user.tag, iconURL: user.displayAvatarURL() }) 47 | .addFields([ 48 | { name: "Type", value: type, inline: true }, 49 | { name: "Status", value: "Pending...", inline: true } 50 | ]) 51 | .setTimestamp(Date.now()); 52 | 53 | const Buttons = new ActionRowBuilder(); 54 | Buttons.addComponents( 55 | new ButtonBuilder() 56 | .setCustomId('suggest-accept') 57 | .setLabel('✅ Accept') 58 | .setStyle(ButtonStyle.Success) 59 | ).addComponents( 60 | new ButtonBuilder() 61 | .setCustomId('suggest-decline') 62 | .setLabel('❌ Decline') 63 | .setStyle(ButtonStyle.Danger) 64 | ) 65 | 66 | try { 67 | 68 | await interaction.reply({ embeds: [Embed], components: [Buttons], fetchReply: true }).then(async (msg) => { 69 | await suggestDB.create({ GuildID: guildId, MessageID: msg.id , Details: [ 70 | { 71 | MemberID: member.id, 72 | Type: type, 73 | Suggestion: suggestion 74 | } 75 | ]}) 76 | }) 77 | 78 | 79 | 80 | } catch (error) { 81 | console.log(error); 82 | } 83 | } 84 | } -------------------------------------------------------------------------------- /src/types/commands/moderation/lock.js: -------------------------------------------------------------------------------- 1 | const { Client, SlashCommandBuilder, ChatInputCommandInteraction, PermissionFlagsBits, EmbedBuilder, ChannelType } = require('discord.js') 2 | 3 | module.exports = { 4 | data: new SlashCommandBuilder() 5 | .setName("lock") 6 | .setDescription("Lock or unlock a Channel of your choice") 7 | .addStringOption( 8 | option => 9 | option.setName("type") 10 | .setDescription('Lock or Unlock') 11 | .setRequired(true) 12 | .addChoices( 13 | { name: '🔒 Lock', value: 'lock' }, 14 | { name: '🔓 Unlock', value: 'unlock' }, 15 | ) 16 | ) 17 | .addChannelOption( 18 | option => 19 | option.setName("channel") 20 | .setDescription("The channel you want to lock!") 21 | .addChannelTypes(ChannelType.GuildVoice, ChannelType.GuildText) 22 | ) 23 | .setDMPermission(false) 24 | .setDefaultMemberPermissions(PermissionFlagsBits.ManageChannels), 25 | /** 26 | * @param {ChatInputCommandInteraction} interaction 27 | * @param {Client} client 28 | */ 29 | async execute(interaction, client) { 30 | const { options, guild } = interaction; 31 | 32 | const channel = options.getChannel("channel") 33 | const type = options.getString('type'); 34 | 35 | const Embed = new EmbedBuilder() 36 | .setColor(client.color) 37 | .setTitle('🔒 Lock') 38 | .setTimestamp(Date.now()); 39 | 40 | switch(type) { 41 | 42 | case "lock": { 43 | try { 44 | if(channel) { 45 | channel.permissionOverwrites.edit(guild.roles.everyone.id, { SendMessages: false, Connect: false }); 46 | Embed.setTitle('🔒 Lock').setDescription(`Successfully locked ${channel}`) 47 | } else { 48 | interaction.channel.permissionOverwrites.edit(guild.roles.everyone.id, { SendMessages: false, Connect: false }); 49 | Embed.setTitle('🔒 Lock').setDescription(`Successfully locked ${interaction.channel}`) 50 | } 51 | } catch (error) { 52 | console.log(error) 53 | } 54 | } break; 55 | 56 | case "unlock": { 57 | try { 58 | if(channel) { 59 | channel.permissionOverwrites.edit(guild.roles.everyone.id, { SendMessages: false, Connect: false }); 60 | Embed.setTitle('🔓 Unlock').setDescription(`Successfully unlocked ${channel}`) 61 | } else { 62 | interaction.channel.permissionOverwrites.edit(guild.roles.everyone.id, { SendMessages: false, Connect: false }); 63 | Embed.setTitle('🔓 Unlock').setDescription(`Successfully unlocked ${interaction.channel}`) 64 | } 65 | } catch (error) { 66 | console.log(error) 67 | } 68 | } break; 69 | } 70 | 71 | return interaction.reply({embeds: [Embed], ephemeral: true}) 72 | } 73 | } -------------------------------------------------------------------------------- /src/types/components/buttons/open-ticket.js: -------------------------------------------------------------------------------- 1 | const { ButtonInteraction, Client, AttachmentBuilder, EmbedBuilder, ChannelType, ButtonBuilder, ButtonStyle, ActionRowBuilder } = require('discord.js') 2 | 3 | const ticketSystemDB = require('../../../models/TicketSystem') 4 | const ticketDB = require('../../../models/Ticket') 5 | 6 | module.exports = { 7 | data: { 8 | name: "ticket-open" 9 | }, 10 | /** 11 | * 12 | * @param {ButtonInteraction} interaction 13 | * @param {Client} client 14 | */ 15 | async execute(interaction, client) { 16 | const { guildId, message, member, guild } = interaction; 17 | 18 | ticketSystemDB.findOne({GuildID: guildId}, async (err, systemData) => { 19 | if(err) throw err; 20 | if(!systemData) return; 21 | 22 | ticketDB.findOne({ GuildID: guild.id, MemberID: member.id }, (err, data) => { 23 | if(err) throw err; 24 | if(data) return interaction.reply({ content: `❌ You already have an open ticket <#${data.ChannelID}>`, ephemeral: true}); 25 | 26 | const random = Math.floor(Math.random() * 9999) + 1000; 27 | 28 | const category = guild.channels.cache.get(systemData.CategoryID); 29 | guild.channels.create({ 30 | name: `ticket-${random}`, 31 | parent: category, 32 | type: ChannelType.GuildText, 33 | permissionOverwrites: [] 34 | }).then(async (channel) => { 35 | channel.permissionOverwrites.edit(member.id, { ViewChannel: true }); 36 | channel.permissionOverwrites.edit(guild.roles.everyone.id, { ViewChannel: false }); 37 | 38 | const close_ticket = new ButtonBuilder() 39 | .setCustomId('ticket-close') 40 | .setLabel('🚪 Close') 41 | .setStyle(ButtonStyle.Danger) 42 | 43 | const lock_ticket = new ButtonBuilder() 44 | .setCustomId('ticket-lock') 45 | .setLabel('🔒 Lock') 46 | .setStyle(ButtonStyle.Secondary) 47 | 48 | const unlock_ticket = new ButtonBuilder() 49 | .setCustomId('ticket-unlock') 50 | .setLabel('🔓 Unlock') 51 | .setStyle(ButtonStyle.Secondary) 52 | 53 | const message = systemData.RoleIDs.map(r => `<@&${r}>`).join(" ") 54 | 55 | 56 | await channel.send({ 57 | content: `${systemData.RoleIDs ? message : ''}`, 58 | embeds: [ 59 | new EmbedBuilder() 60 | .setTitle('✉️ Ticket System') 61 | .setDescription('Please wait for a staff to answer your ticket!') 62 | .setColor(client.color) 63 | .setTimestamp(Date.now()) 64 | ], 65 | components: [ 66 | new ActionRowBuilder() 67 | .addComponents(close_ticket, lock_ticket, unlock_ticket) 68 | ] 69 | }) 70 | 71 | ticketDB.create( 72 | { 73 | GuildID: guild.id, 74 | ChannelID: channel.id, 75 | MemberID: member.id, 76 | Locked: false, 77 | TicketID: random, 78 | CreatedAt: channel.createdTimestamp 79 | }) 80 | 81 | return interaction.reply({ content: `Ticket created <#${channel.id}>`, ephemeral: true }) 82 | }) 83 | }) 84 | }) 85 | } 86 | } -------------------------------------------------------------------------------- /src/types/commands/fun/translate.js: -------------------------------------------------------------------------------- 1 | const { Client, SlashCommandBuilder, ChatInputCommandInteraction, EmbedBuilder } = require('discord.js') 2 | const translate = require("@iamtraction/google-translate") 3 | 4 | module.exports = { 5 | data: new SlashCommandBuilder() 6 | .setName('translate') 7 | .setDescription('Translate any text to a specific language!') 8 | .addStringOption( 9 | option => 10 | option.setName("text") 11 | .setDescription("The text you wanna translate!") 12 | .setRequired(true)) 13 | .addStringOption( 14 | option => 15 | option.setName("language") 16 | .setDescription("The language you wanna translate to!") 17 | .addChoices( 18 | { name: "English", value: "english"}, 19 | { name: "German", value: "german"}, 20 | { name: "French", value: "french"}, 21 | { name: "Russian", value: "russian"}, 22 | { name: "Portuguese", value: "portuguese"}, 23 | { name: "Turkish", value: "turkish"}, 24 | { name: "Japanese", value: "japanese"}, 25 | ).setRequired(true)), 26 | category: 'fun', 27 | /** 28 | * 29 | * @param {ChatInputCommandInteraction} interaction 30 | * @param {Client} client 31 | */ 32 | async execute(interaction, client) { 33 | 34 | const { options } = interaction 35 | const text = options.getString("text") 36 | const language = options.getString("language") 37 | 38 | switch (language) { 39 | case "english": { 40 | const translated = await translate(text, { to: 'en' }) 41 | send_translated(text, translated.text, interaction, client, "English") 42 | } 43 | break; 44 | 45 | case "german": { 46 | const translated = await translate(text, { to: 'de' }) 47 | send_translated(text, translated.text, interaction, client, "German") 48 | } 49 | break; 50 | 51 | case "french": { 52 | const translated = await translate(text, { to: 'fr' }) 53 | send_translated(text, translated.text, interaction, client, "French") 54 | } 55 | break; 56 | 57 | case "russian": { 58 | const translated = await translate(text, { to: 'ru' }) 59 | send_translated(text, translated.text, interaction, client, "Russian") 60 | } 61 | break; 62 | 63 | case "portuguese": { 64 | const translated = await translate(text, { to: 'pt' }); 65 | send_translated(text, translated.text, interaction, client, "Portuguese") 66 | } break; 67 | 68 | case "turkish": { 69 | const translated = await translate(text, { to: 'tr' }); 70 | send_translated(text, translated.text, interaction, client, "Turkish") 71 | } break; 72 | 73 | case "japanese": { 74 | const translated = await translate(text, { to: 'ja' }); 75 | send_translated(text, translated.text, interaction, client, "Japanese") 76 | } break; 77 | 78 | case "greek": { 79 | const translated = await translate(text, { to: 'el' }); 80 | send_translated(text, translated.text, interaction, client, "Greek") 81 | } break; 82 | } 83 | } 84 | } 85 | 86 | function send_translated(text, translated, interaction, client, language) { 87 | const Response = new EmbedBuilder() 88 | .setColor(client.color) 89 | .setTitle("🌍 Translator") 90 | .addFields( 91 | { name: "Language", value: language, inline: false }, 92 | { name: "Message:", value: text, inline: true}, 93 | { name: "Translated:", value: translated, inline: true} 94 | ).setFooter({text: `Requested by ${interaction.member.user.tag}`, iconURL: interaction.member.user.displayAvatarURL()}) 95 | 96 | interaction.channel.send({ embeds: [Response] }) 97 | interaction.reply({content: "Successfully translated message!", ephemeral: true}) 98 | } -------------------------------------------------------------------------------- /src/types/commands/ticket/Ticket.js: -------------------------------------------------------------------------------- 1 | const { Client, ContextMenuCommandBuilder, MessageContextMenuCommandInteraction, EmbedBuilder, ApplicationCommandType, ChannelType, ButtonBuilder, ButtonStyle, ActionRowBuilder } = require('discord.js') 2 | 3 | const ticketSystemDB = require('../../../models/TicketSystem') 4 | const ticketDB = require('../../../models/Ticket') 5 | 6 | module.exports = { 7 | data: new ContextMenuCommandBuilder() 8 | .setName('Start Ticket') 9 | .setDMPermission(false) 10 | .setType(ApplicationCommandType.Message), 11 | /** 12 | * 13 | * @param {MessageContextMenuCommandInteraction} interaction 14 | * @param {Client} client 15 | */ 16 | async execute(interaction, client) { 17 | 18 | const { targetMessage } = interaction; 19 | 20 | ticketSystemDB.findOne({GuildID: targetMessage.guildId }, async (err, systemData) => { 21 | 22 | const { guild, member } = interaction; 23 | 24 | if(err) throw err; 25 | if(!systemData) return; 26 | 27 | ticketDB.findOne({ GuildID: guild.id, MemberID: member.id }, (err, data) => { 28 | if(err) throw err; 29 | if(data) return interaction.reply({ content: `❌ You already have an open ticket <#${data.ChannelID}>`, ephemeral: true}); 30 | 31 | const random = Math.floor(Math.random() * 9999) + 1000; 32 | 33 | const category = guild.channels.cache.get(systemData.CategoryID); 34 | guild.channels.create({ 35 | name: `ticket-${random}`, 36 | parent: category, 37 | type: ChannelType.GuildText, 38 | permissionOverwrites: [] 39 | }).then(async (channel) => { 40 | channel.permissionOverwrites.edit(member.id, { ViewChannel: true }); 41 | channel.permissionOverwrites.edit(guild.roles.everyone.id, { ViewChannel: false }); 42 | 43 | const close_ticket = new ButtonBuilder() 44 | .setCustomId('ticket-close') 45 | .setLabel('🚪 Close') 46 | .setStyle(ButtonStyle.Danger) 47 | 48 | const lock_ticket = new ButtonBuilder() 49 | .setCustomId('ticket-lock') 50 | .setLabel('🔒 Lock') 51 | .setStyle(ButtonStyle.Secondary) 52 | 53 | const unlock_ticket = new ButtonBuilder() 54 | .setCustomId('ticket-unlock') 55 | .setLabel('🔓 Unlock') 56 | .setStyle(ButtonStyle.Secondary) 57 | 58 | 59 | await channel.send({ 60 | content: `${systemData.RoleID ? `<@&${systemData.RoleID}>` : ''}`, 61 | embeds: [ 62 | new EmbedBuilder() 63 | .setTitle('Ticket') 64 | .setDescription(`This ticket was opened from [this message](${interaction.targetMessage.url}).\n 65 | ${interaction.targetMessage.author} said in ${interaction.targetMessage.channel} 66 | \`\`\`${interaction.targetMessage.content}\`\`\` 67 | `).setColor(client.color) 68 | .setTimestamp(Date.now()) 69 | ], 70 | components: [ 71 | new ActionRowBuilder() 72 | .addComponents(close_ticket, lock_ticket, unlock_ticket) 73 | ] 74 | }) 75 | 76 | ticketDB.create( 77 | { 78 | GuildID: guild.id, 79 | ChannelID: channel.id, 80 | MemberID: member.id, 81 | Locked: false, 82 | TicketID: random, 83 | CreatedAt: channel.createdTimestamp 84 | }) 85 | 86 | return interaction.reply({ content: `Ticket created <#${channel.id}>`, ephemeral: true }) 87 | }) 88 | }) 89 | }) 90 | 91 | } 92 | } 93 | 94 | -------------------------------------------------------------------------------- /src/types/commands/voice/temp.js: -------------------------------------------------------------------------------- 1 | const { Client, EmbedBuilder, SlashCommandBuilder, CommandInteraction } = require('discord.js') 2 | 3 | module.exports = { 4 | data: new SlashCommandBuilder() 5 | .setName('temp') 6 | .setDescription('Control your own temporary channel.') 7 | .setDMPermission(false) 8 | .addSubcommand(subcommand => 9 | subcommand 10 | .setName("invite") 11 | .setDescription("Invite a friend to your channel.") 12 | .addUserOption(option => 13 | option.setName("member").setDescription("Select a member you wanna add.").setRequired(true)) 14 | ) 15 | .addSubcommand(subcommand => 16 | subcommand 17 | .setName("disallow") 18 | .setDescription("Remove someone's access to the channel.") 19 | .addUserOption(option => 20 | option.setName("member") 21 | .setDescription("Select a member you wanna remove the access.") 22 | .setRequired(true)) 23 | ) 24 | .addSubcommand(subcommand => 25 | subcommand 26 | .setName("name") 27 | .setDescription("Change the name of your channel") 28 | .addStringOption(option => 29 | option.setName("text") 30 | .setDescription("Provide the name.") 31 | .setRequired(true)) 32 | ) 33 | .addSubcommand(subcommand => 34 | subcommand 35 | .setName("public") 36 | .setDescription("Make your channel public to everyone.") 37 | .addStringOption(option => 38 | option.setName("turn") 39 | .setDescription("Turn on or off.") 40 | .setRequired(true) 41 | .addChoices( 42 | {name: "on", value: "on"}, 43 | {name: "off", value: "off"} 44 | ))), 45 | /** 46 | * @param {CommandInteraction} interaction 47 | * @param {Client} client 48 | */ 49 | async execute(interaction, client) { 50 | const { options, member, guild } = interaction; 51 | 52 | const subCommand = options.getSubcommand(); 53 | const voiceChannel = member.voice.channel; 54 | const Embed = new EmbedBuilder().setTitle("🔊 Voice System").setColor(client.color).setTimestamp(Date.now()); 55 | const ownedChannel = client.voiceGenerator.get(member.id); 56 | 57 | if(!voiceChannel) 58 | return interaction.reply({embeds: [Embed.setDescription("🔇 You are currently not in a voice channel.").setColor('Red')], ephemeral: true}); 59 | 60 | if(!ownedChannel || voiceChannel.id !== ownedChannel) 61 | return interaction.reply({embeds: [Embed.setDescription("❌ You do not own this channel!").setColor('Red')], ephemeral: true}) 62 | 63 | switch(subCommand) { 64 | case "name": { 65 | const newName = options.getString("text"); 66 | if(newName.length > 22 || newName.length < 1) 67 | return interaction.reply({embeds: [Embed.setDescription("❌ Name cannot exceed the 22 character limit").setColor('Red')], ephemeral: true}) 68 | 69 | voiceChannel.edit({name: newName}); 70 | interaction.reply({embeds: [Embed.setDescription(`📝 Channel name has been set to ${newName}!`)], ephemeral: true}) 71 | } 72 | break; 73 | 74 | case "invite": { 75 | const targetMember = options.getMember('member'); 76 | voiceChannel.permissionOverwrites.edit(targetMember, {Connect: true}); 77 | const sendEmbed = new EmbedBuilder().setTitle("🔊 Voice System").setColor(client.color).setDescription(`👋 <@${member.id}> has invited you to <#${voiceChannel.id}>`) 78 | 79 | targetMember.send({embeds: [sendEmbed]}).catch(() => {}) 80 | interaction.reply({embeds: [Embed.setDescription(`📨 ${targetMember} has been successfully invited!`)], ephemeral: true}) 81 | } 82 | break; 83 | 84 | case "disallow": { 85 | const targetMember = options.getMember('member'); 86 | voiceChannel.permissionOverwrites.edit(targetMember, {Connect: false}) 87 | 88 | if(targetMember.voice.channel && targetMember.voice.channel.id == voiceChannel.id) targetMember.voice.setChannel(null); 89 | interaction.reply({embeds: [Embed.setDescription(`💢 ${targetMember} has been removed from your channel!`)], ephemeral: true}) 90 | } 91 | break; 92 | 93 | case "public": { 94 | const turnChoice = options.getString("turn"); 95 | 96 | switch(turnChoice) { 97 | case "on": { 98 | voiceChannel.permissionOverwrites.edit(guild.id, {Connect: true}) 99 | interaction.reply({embeds: [Embed.setDescription("🔓 Your channel is now public.")], ephemeral: true}) 100 | } 101 | break; 102 | 103 | case "off": { 104 | voiceChannel.permissionOverwrites.edit(guild.id, {Connect: false}) 105 | interaction.reply({embeds: [Embed.setDescription("🔒 Your channel is now private.")], ephemeral: true}) 106 | } 107 | break; 108 | } 109 | } 110 | break; 111 | } 112 | } 113 | } -------------------------------------------------------------------------------- /src/types/components/buttons/captcha.js: -------------------------------------------------------------------------------- 1 | const { ButtonInteraction, Client, AttachmentBuilder, EmbedBuilder, MessagePayload, Embed } = require('discord.js') 2 | const DB = require('../../../models/CaptchaSystem') 3 | const featuresDB = require('../../../models/Features') 4 | const { Captcha } = require('captcha-canvas') 5 | const ms = require('ms') 6 | 7 | module.exports = { 8 | data: { 9 | name: "captcha-btn" 10 | }, 11 | /** 12 | * 13 | * @param {ButtonInteraction} interaction 14 | * @param {Client} client 15 | */ 16 | async execute(interaction, client) { 17 | const { member, guild } = interaction; 18 | 19 | const featuresCheck = await featuresDB.findOne({GuildID: guild.id}) 20 | if(featuresCheck) { 21 | const { CaptchaSystem } = featuresCheck; 22 | if(CaptchaSystem) { 23 | var date = Date.now() 24 | 25 | DB.findOne({ GuildID: guild.id }, async (err, data) => { 26 | if(!data) return console.log(`Captcha Disabled for ${guild.name}!`); 27 | 28 | const captcha = new Captcha(); 29 | captcha.async = true; 30 | captcha.addDecoy(); 31 | captcha.drawTrace(); 32 | captcha.drawCaptcha(); 33 | 34 | const captchaAttachment = new AttachmentBuilder(await captcha.png) 35 | .setName("captcha.png"); 36 | 37 | const captchaEmbed = new EmbedBuilder() 38 | .setColor(client.color) 39 | .setTitle("<:captcha:1017764058130284584> Hello! Are you human? Let's find out!") 40 | .setDescription("``Please type the captcha below to be able to access this server!``") 41 | .setImage('attachment://captcha.png') 42 | .setFooter({ text: `Verification Period: 2 minutes` }) 43 | 44 | try { 45 | const msg = await interaction.reply({files: [captchaAttachment], embeds: [captchaEmbed], ephemeral: true}) 46 | msg.interaction.channel.permissionOverwrites.edit(member.id, { SendMessages: true }); 47 | 48 | const filter_ = (message) => { 49 | if(message.author.id !== member.id) return; 50 | if(message.content.toUpperCase() === captcha.text) { 51 | return true; 52 | } else { 53 | return false; 54 | } 55 | } 56 | 57 | try { 58 | const response = await msg.interaction.channel.awaitMessages({ 59 | filter: filter_, 60 | max: 1, 61 | time: 2*60*1000, 62 | errors: ["time"]}); 63 | 64 | if(response) { 65 | DB.findOne({ GuildID: member.guild.id }, async (err, data) => { 66 | if(!data) return; 67 | if(!data.Role) return; 68 | 69 | const role = member.guild.roles.cache.get(data.Role) 70 | try { 71 | member.roles.add(role) 72 | } catch (error) {} 73 | 74 | const verifiedEmbed = new EmbedBuilder() 75 | .setTitle("You have been verified!") 76 | .setColor(0x4cb861) 77 | .setDescription(`<:success:1017762669559816222> You passed the verification successfully! You can now access \`\`${interaction.guild.name}\`\`!`) 78 | 79 | member.user.send({ embeds: [verifiedEmbed] }).then(() => { 80 | msg.interaction.channel.permissionOverwrites.delete(member.id); 81 | msg.interaction.channel.messages.cache.forEach((message) => { 82 | if(!message.author.bot) message.delete().catch(err => console.log("Nothing")); 83 | }) 84 | response.forEach(RMessage => { 85 | RMessage.delete(); 86 | }) 87 | }); 88 | }) 89 | } else { 90 | member.user.send("`❌ You didn't verify!`"); 91 | member.kick("Couldn't Verify") 92 | msg.interaction.channel.permissionOverwrites.edit(member.id, { SendMessages: false }); 93 | } 94 | 95 | } catch (error) { 96 | return console.log(error) 97 | } 98 | } catch (error) { 99 | return console.log(error) 100 | } 101 | }) 102 | } 103 | } 104 | } 105 | } -------------------------------------------------------------------------------- /src/types/commands/ticket/ticket_cmd.js: -------------------------------------------------------------------------------- 1 | const { Client, SlashCommandBuilder, EmbedBuilder, ChatInputCommandInteraction, PermissionFlagsBits } = require('discord.js') 2 | 3 | const ticketDB = require('../../../models/Ticket') 4 | const ticketSystem = require('../../../models/TicketSystem') 5 | 6 | module.exports = { 7 | data: new SlashCommandBuilder() 8 | .setName('ticket') 9 | .setDescription('Moderate a users ticket!') 10 | .addSubcommand( 11 | command => 12 | command.setName('info') 13 | .setDescription('Get information about a ticket!') 14 | .addStringOption(option => option.setName('ticket-id').setDescription('ID of the ticket! (#ticket-id) only the id').setRequired(true)) 15 | ) 16 | .addSubcommand( 17 | command => 18 | command.setName('roles') 19 | .setDescription('Add or remove roles from ticket notifications') 20 | .addStringOption(option => option.setName('type').setDescription('Add/Remove').addChoices({ name: 'add', value: 'add' }, { name: 'remove', value: 'remove' }).setRequired(true)) 21 | .addRoleOption(option => option.setName('role').setDescription('Role you want to Add/Remove').setRequired(true)) 22 | ) 23 | .addSubcommand( 24 | command => 25 | command.setName('add') 26 | .setDescription('Add a user to a ticket!') 27 | .addStringOption(option => option.setName('ticket-id').setDescription('ID of the ticket! (#ticket-id) only the id').setRequired(true)) 28 | .addUserOption(option => option.setName('user').setDescription('User you want to add!').setRequired(true))) 29 | .addSubcommand( 30 | command => 31 | command.setName('remove') 32 | .setDescription('Remove a user from a ticket!') 33 | .addStringOption(option => option.setName('ticket-id').setDescription('ID of the ticket! (#ticket-id) only the id').setRequired(true)) 34 | .addUserOption(option => option.setName('user').setDescription('User you want to remove!').setRequired(true))) 35 | .setDefaultMemberPermissions(PermissionFlagsBits.ModerateMembers) 36 | .setDMPermission(false), 37 | /** 38 | * @param {ChatInputCommandInteraction} interaction 39 | * @param {Client} client 40 | */ 41 | async execute(interaction, client) { 42 | const { options, guildId, guild, channel } = interaction; 43 | 44 | const Target = options.getUser('user') 45 | const Ticket = options.getString('ticket-id') 46 | const Subs = options.getSubcommand(); 47 | 48 | const Response = new EmbedBuilder() 49 | .setTitle('✉️ Ticket System') 50 | .setColor(client.color) 51 | .setTimestamp(Date.now()) 52 | 53 | switch(Subs) { 54 | case "info": { 55 | ticketDB.findOne({ GuildID: guildId, TicketID: Ticket }, (err, data) => { 56 | if(err) throw err; 57 | if(!data) return interaction.reply({ content: `❌ ${Ticket} is not a valid ticket ID!`, ephemeral: true }); 58 | 59 | const TicketEmbed = new EmbedBuilder() 60 | .setTitle('✉️ Ticket System') 61 | .setColor(client.color) 62 | .setDescription(`Get information about **ticket-${Ticket}**`) 63 | .addFields( 64 | { name: 'Created At', value: ``, inline: true }, 65 | { name: 'Created By', value: `<@${data.MemberID}>`, inline: true }, 66 | { name: 'Ticket ID', value: `${Ticket}`, inline: true }, 67 | { name: 'Locked?', value: `${data.Locked ? 'Yes' : 'No'}`, inline: true }, 68 | ) 69 | 70 | return interaction.reply({ embeds: [TicketEmbed], ephemeral: true }); 71 | }) 72 | } break; 73 | 74 | case "roles": { 75 | const role = options.getRole('role'); 76 | 77 | switch(options.getString('type')) { 78 | case "add": { 79 | ticketSystem.findOne({ GuildID: guildId }, (err, data) => { 80 | if(err) throw err; 81 | if(!data) return interaction.reply({ content: '❌ Setup the ticket System before | ``/setup ticket``', ephemeral: true}); 82 | data.RoleIDs.push(role.id); 83 | data.save(); 84 | 85 | return interaction.reply({ content: `Added <@&${role.id}> to ticket notifications!`, ephemeral: true }); 86 | }) 87 | } break; 88 | 89 | case "remove": { 90 | ticketSystem.findOne({ GuildID: guildId }, (err, data) => { 91 | if(err) throw err; 92 | if(!data) return interaction.reply({ content: '❌ Setup the ticket System before | ``/setup ticket``', ephemeral: true}); 93 | 94 | if(!data.RoleIDs.includes(role.id)) return; 95 | data.RoleIDs.remove(role.id); 96 | data.save(); 97 | 98 | return interaction.reply({ content: `Removed <@&${role.id}> from the ticket notifications!`, ephemeral: true }); 99 | }) 100 | } break; 101 | } 102 | } 103 | 104 | case "add": { 105 | ticketDB.findOne({ GuildID: guildId, TicketID: Ticket }, (err, data) => { 106 | if(err) throw err; 107 | if(!data) return interaction.reply({ content: `❌ ${Ticket} is not a valid ticket ID!`, ephemeral: true }); 108 | 109 | const channel = guild.channels.cache.get(data.ChannelID); 110 | channel.permissionOverwrites.edit(Target.id, { ViewChannel: true }); 111 | 112 | return interaction.reply({ embeds: [Response.setDescription(`✅ Added ${Target} to the ticket!`)], ephemeral: true }); 113 | }) 114 | } break; 115 | 116 | case "remove": { 117 | ticketDB.findOne({ GuildID: guildId, TicketID: Ticket }, (err, data) => { 118 | if(err) throw err; 119 | if(!data) return interaction.reply({ content: `❌ ${Ticket} is not a valid ticket ID!`, ephemeral: true }); 120 | 121 | const channel = guild.channels.cache.get(data.ChannelID); 122 | channel.permissionOverwrites.edit(Target.id, { ViewChannel: false }); 123 | 124 | return interaction.reply({ embeds: [Response.setDescription(`✅ Removed ${Target} from the ticket!`)], ephemeral: true }); 125 | }) 126 | } 127 | } 128 | 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /src/types/commands/moderation/chatfilter.js: -------------------------------------------------------------------------------- 1 | const { Client, SlashCommandBuilder, EmbedBuilder, ChatInputCommandInteraction, PermissionFlagsBits } = require('discord.js') 2 | const sourcebin = require('sourcebin') 3 | 4 | const chatfilterDB = require('../../../models/ChatFilter') 5 | const featuresDB = require('../../../models/Features') 6 | 7 | module.exports = { 8 | data: new SlashCommandBuilder() 9 | .setName('chatfilter') 10 | .setDescription('Add/Remove words from the chatfilter') 11 | .setDMPermission(false) 12 | .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) 13 | .addSubcommand( 14 | command => command.setName('list').setDescription('List all filtered Words!') 15 | ) 16 | .addSubcommand( 17 | command => 18 | command.setName('configure') 19 | .setDescription("Add/Remove words from your server's chatfilter!") 20 | .addStringOption( 21 | option => 22 | option.setName('option') 23 | .setDescription('Provide a Option') 24 | .addChoices( 25 | { name: 'add', value: 'add' }, 26 | { name: 'remove', value: 'remove' }, 27 | ).setRequired(true) 28 | ).addStringOption( 29 | option => 30 | option.setName('words') 31 | .setDescription('Provide the word, add multiple words by placing a comma in between (word1,word2)') 32 | .setRequired(true) 33 | ) 34 | ) 35 | .addSubcommand( 36 | command => 37 | command.setName('clear') 38 | .setDescription("Clear your server's chatfilter!") 39 | ), 40 | /** 41 | * @param {ChatInputCommandInteraction} interaction 42 | * @param {Client} client 43 | */ 44 | async execute(interaction, client) { 45 | const { options, guild } = interaction; 46 | 47 | const Response = new EmbedBuilder() 48 | .setTitle('💬 Chatfilter') 49 | .setTimestamp(Date.now()) 50 | .setColor(client.color) 51 | 52 | const Subs = options.getSubcommand(); 53 | 54 | featuresDB.findOne({ GuildID: guild.id }, async (err, sysdata) => { 55 | if(err) throw err; 56 | if(!sysdata || !sysdata.AutoModSystem) return interaction.reply({ content: '❌ Enable the AutoMod Feature first, just type ``/setup features``', ephemeral: true}) 57 | 58 | switch(Subs) { 59 | case "list": { 60 | const Data = await chatfilterDB.findOne({ GuildID: guild.id }) 61 | if(!Data) return interaction.reply({ embeds: [Response.setDescription('There is no blacklist')] }); 62 | 63 | await sourcebin.create([ 64 | { 65 | content: `${Data.Wordlist.map((w) => w).join("\n") || "none"}`, 66 | language: "text" 67 | } 68 | ], 69 | { 70 | title: `${guild.name} | Blacklist`, 71 | description: `${Data.Wordlist.length}` 72 | }).then((bin) => { 73 | return interaction.reply({ embeds: [Response.setDescription(`[Click Here to see all blacklisted Words](${bin.url})`)] }) 74 | }) 75 | 76 | /* map(r => r).join(" ") */ 77 | } break; 78 | 79 | case "configure": { 80 | const Words = options.getString('words').toLowerCase().split(","); 81 | const Choice = options.getString('option'); 82 | 83 | switch(Choice) { 84 | case "add": { 85 | 86 | chatfilterDB.findOne({ GuildID: guild.id }, async (err, data) => { 87 | if(err) throw err; 88 | if(!data) { 89 | await chatfilterDB.create({ 90 | GuildID: guild.id, 91 | Wordlist: Words 92 | }); 93 | 94 | return interaction.reply({ embeds: [Response.setDescription(`Added ${Words.length} ${Words.length <= 1 ? 'word' : 'words'} to the blacklist.`)], ephemeral: true }); 95 | } else { 96 | Words.forEach(word => { 97 | if(data.Wordlist.includes(word)) return; 98 | data.Wordlist.push(word); 99 | }) 100 | 101 | data.save() 102 | 103 | return interaction.reply({ embeds: [Response.setDescription(`Added ${Words.length} ${Words.length <= 1 ? 'word' : 'words'} to the blacklist.`)], ephemeral: true }); 104 | } 105 | }) 106 | 107 | } break; 108 | 109 | case "remove": { 110 | 111 | chatfilterDB.findOne({ GuildID: guild.id }, async (err, data) => { 112 | if(err) throw err; 113 | if(!data) { 114 | return interaction.reply({ content: `There is no data to remove!`, ephemeral: true }); 115 | } else { 116 | Words.forEach(word => { 117 | if(!data.Wordlist.includes(word)) return; 118 | data.Wordlist.remove(word); 119 | }) 120 | 121 | data.save() 122 | 123 | return interaction.reply({ embeds: [Response.setDescription(`Removed ${Words.length} ${Words.length <= 1 ? 'word' : 'words'} from the blacklist.`)], ephemeral: true }); 124 | } 125 | }) 126 | 127 | } break; 128 | } 129 | } break; 130 | 131 | case "clear": { 132 | 133 | chatfilterDB.findOne({ GuildID: guild.id }, async (err, data) => { 134 | if(err) throw err; 135 | if(!data) { 136 | return interaction.reply({ content: `There is no data to clear!`, ephemeral: true }); 137 | } else { 138 | let num = data.Wordlist.length 139 | await chatfilterDB.findOneAndDelete({ GuildID: guild.id }) 140 | 141 | data.save() 142 | 143 | return interaction.reply({ embeds: [Response.setDescription(`Cleared ${num} from the blacklist.`)], ephemeral: true }); 144 | } 145 | }) 146 | 147 | } break; 148 | } 149 | }) 150 | 151 | } 152 | } -------------------------------------------------------------------------------- /src/types/commands/system/confession.js: -------------------------------------------------------------------------------- 1 | const { Client, SlashCommandBuilder, EmbedBuilder, ChatInputCommandInteraction } = require('discord.js'); 2 | 3 | const db = require('../../../models/ConfessionSystem') 4 | const settingsDB = require('../../../models/ConfessionSettings') 5 | const featuresDB = require('../../../models/Features') 6 | 7 | module.exports = { 8 | data: new SlashCommandBuilder() 9 | .setName('confession') 10 | .setDescription('Create or edit a confession') 11 | .addSubcommand( 12 | command => 13 | command.setName('send') 14 | .setDescription('Create a new confession') 15 | .addUserOption( 16 | option => 17 | option.setName('to') 18 | .setDescription('Confess to a user') 19 | .setRequired(true)) 20 | .addStringOption( 21 | option => 22 | option.setName('confession') 23 | .setDescription('Describe your confession') 24 | .setRequired(true)) 25 | .addStringOption( 26 | option => 27 | option.setName('anonym') 28 | .setDescription('Send your confession anonym') 29 | .addChoices( 30 | { name: '✅ Yes', value: 'yes'}, 31 | { name: '❎ No', value: 'no'} 32 | ).setRequired(true))) 33 | .addSubcommand( 34 | command => 35 | command.setName('delete') 36 | .setDescription('Delete your confession') 37 | .addStringOption( 38 | option => 39 | option.setName('confession-id') 40 | .setDescription('Message ID of your confession') 41 | .setRequired(true)) 42 | ).addSubcommand( 43 | command => 44 | command.setName('edit') 45 | .setDescription('Edit your confession') 46 | .addStringOption( 47 | option => 48 | option.setName('confession-id') 49 | .setDescription('ID of your confession') 50 | .setRequired(true)) 51 | .addStringOption( 52 | option => 53 | option.setName('confession') 54 | .setDescription('Your new confession') 55 | .setRequired(true)) 56 | ) 57 | , 58 | /** 59 | * 60 | * @param {ChatInputCommandInteraction} interaction 61 | * @param {Client} client 62 | */ 63 | async execute(interaction, client) { 64 | 65 | const { options, member, guild } = interaction; 66 | 67 | const sub = options.getSubcommand(); 68 | const target = options.getMember('to') 69 | const confession = options.getString('confession') 70 | const message_id = options.getString('confession-id') 71 | const id = Math.floor(Math.random() * 99999999) + 10000000; 72 | 73 | featuresDB.findOne({ GuildID: guild.id }, async (err, data) => { 74 | if(err) throw err; 75 | if(!data) return interaction.reply({ content: `<@${guild.ownerId}> disabled the confession system!`, ephemeral: true }); 76 | 77 | if(data.ConfessionSystem) { 78 | switch(sub) { 79 | 80 | case "send": { 81 | 82 | const anonym = options.getString('anonym'); 83 | const Response = new EmbedBuilder() 84 | .setColor(client.color) 85 | .setTimestamp(Date.now()) 86 | .setTitle(`To ${target.user.tag}`) 87 | .setDescription(`From **${anonym == 'no' ? member.user.tag : 'Anonym' }**`) 88 | .addFields([ 89 | { name: 'Confession', value: `\`\`\`${confession}\`\`\`` } 90 | ]) 91 | .setFooter({ text: `🌸 Confession ID: ${id.toString()}` }) 92 | 93 | client.guilds.cache.forEach(guild_ => { 94 | settingsDB.findOne({GuildID: guild_.id}, async (err, data) => { 95 | if(err) throw err; 96 | 97 | if(!data) return; 98 | 99 | const channel = guild_.channels.cache.get(data.ChannelID) 100 | channel.send({ embeds: [Response] }).then(async msg => { 101 | await db.findOneAndUpdate({ GuildID: guild_.id }, 102 | { MessageID: msg.id, ConfessionID: id, MemberID: member.id, ChannelID: msg.channel.id } 103 | , { new: true, upsert: true }) 104 | }) 105 | }); 106 | }) 107 | 108 | interaction.reply({ content: '✅ Successfully sent confession!', ephemeral: true}) 109 | } break; 110 | 111 | case "edit": { 112 | 113 | client.guilds.cache.forEach(guild_ => { 114 | db.findOne({ GuildID: guild_.id, ConfessionID: message_id, MemberID: member.id}, (err, data) => { 115 | if(err) throw err; 116 | if(!data) return; 117 | 118 | const channel = guild_.channels.cache.get(data.ChannelID) 119 | channel.messages.fetch(data.MessageID).then(msg => { 120 | const Embed = msg.embeds[0] 121 | if(!Embed) return; 122 | 123 | Embed.fields[0] = { name: "Confession", value: `\`\`\`${confession}\`\`\`` } 124 | msg.edit({ embeds: [Embed] }); 125 | }); 126 | }) 127 | }) 128 | 129 | interaction.reply({ content: '✅ Edited Confession successfully!', ephemeral: true}) 130 | 131 | } break; 132 | 133 | case "delete": { 134 | 135 | client.guilds.cache.forEach(async guild_ => { 136 | db.findOne({ GuildID: guild_.id, ConfessionID: message_id, MemberID: member.id}, async (err, data) => { 137 | if(err) throw err; 138 | if(!data) return; 139 | 140 | const channel = guild_.channels.cache.get(data.ChannelID) 141 | await channel.messages.fetch(data.MessageID) 142 | .then(msg => msg.delete()) 143 | .finally(async () => { 144 | await db.findOneAndDelete({ GuildID: guild_.id, ConfessionID: message_id, MemberID: member.id}) 145 | }) 146 | 147 | }) 148 | }) 149 | 150 | interaction.reply({ content: '✅ Deleted Confession successfully!', ephemeral: true}) 151 | } break; 152 | 153 | } 154 | } else { 155 | return interaction.reply({ content: `<@${guild.ownerId}> disabled the confession system!`, ephemeral: true }); 156 | } 157 | }) 158 | } 159 | } -------------------------------------------------------------------------------- /src/utils/warnpoints.js: -------------------------------------------------------------------------------- 1 | const warnDB = require('../models/WarnSystem') 2 | const { ChatInputCommandInteraction, Client, EmbedBuilder, GuildMember, Message } = require('discord.js') 3 | 4 | /** 5 | * 6 | * @param {Int} points 7 | * @param {Message} message 8 | * @param {String} reason 9 | * @param {GuildMember} user 10 | * @param {Client} client 11 | */ 12 | async function addPoints(points, message, reason, user, client) { 13 | 14 | warnDB.findOne({GuildID: message.guildId, UserID: user.id}, async (err, data) => { 15 | if(err) throw err; 16 | 17 | if(data) { 18 | let num = data.Warns; 19 | 20 | await warnDB.findOneAndUpdate( 21 | {GuildID: message.guildId, UserID: user.id}, 22 | {Warns: num += points}, 23 | {new: true, upsert: true}); 24 | 25 | const UserEmbed = new EmbedBuilder() 26 | .setTitle("⚠ Warning") 27 | .setTimestamp(Date.now()) 28 | .setColor(client.color) 29 | .setDescription(`You've got a Warning Point in \`${message.guild.name}\` \n**Total:** ${num}\n**Reason:** ${reason}\n**Moderator:** Automoderation`) 30 | 31 | user.send({embeds: [UserEmbed]}) 32 | } else { 33 | let num = 0; 34 | 35 | await warnDB.findOneAndUpdate( 36 | {GuildID: message.guildId, UserID: user.id}, 37 | {Warns: num += points}, 38 | {new: true, upsert: true}); 39 | 40 | const UserEmbed = new EmbedBuilder() 41 | .setTitle("⚠ Warning") 42 | .setTimestamp(Date.now()) 43 | .setColor(client.color) 44 | .setDescription(`You've got a Warning Point in \`${message.guild.name}\` \n**Total:** ${num}\n**Reason:** ${reason}\n**Moderator:** Automoderation`) 45 | 46 | user.send({embeds: [UserEmbed]}) 47 | } 48 | }) 49 | } 50 | 51 | /** 52 | * 53 | * @param {Int} points 54 | * @param {ChatInputCommandInteraction} interaction 55 | * @param {String} reason 56 | * @param {GuildMember} user 57 | * @param {Client} client 58 | */ 59 | async function addInteractionPoints(points, interaction, reason, user, client) { 60 | const Response = new EmbedBuilder() 61 | .setColor(client.color) 62 | .setTimestamp(Date.now()) 63 | .setTitle(`${user.user.tag} has been successfully warned!`); 64 | 65 | warnDB.findOne({GuildID: interaction.guildID, UserID: user.id}, async (err, data) => { 66 | if(err) throw err; 67 | 68 | if(data) { 69 | let num = data.Warns ? data.Warns : 0; 70 | 71 | await warnDB.findOneAndUpdate( 72 | {GuildID: interaction.guildId, UserID: user.id}, 73 | {Warns: num += points}, 74 | {new: true, upsert: true}); 75 | 76 | Response.setDescription(`Added \`1\` Warn Point to ${user}! \n**Total:** ${num}\n**Reason**: ${reason}`); 77 | 78 | const UserEmbed = new EmbedBuilder() 79 | .setTitle("⚠ Warning") 80 | .setTimestamp(Date.now()) 81 | .setColor(client.color) 82 | .setDescription(`You've got a Warning Point in \`${interaction.guild.name}\` \n**Total:** ${num}\n**Reason:** ${reason}\n**Moderator:** ${interaction.member}`) 83 | 84 | user.send({embeds: [UserEmbed]}) 85 | 86 | return interaction.reply({embeds: [Response], ephemeral: true}) 87 | } else { 88 | let num = 0; 89 | 90 | await warnDB.findOneAndUpdate( 91 | {GuildID: interaction.guildId, UserID: user.id}, 92 | {Warns: num += points}, 93 | {new: true, upsert: true}); 94 | 95 | Response.setDescription(`Added \`1\` Warn Point to ${user}! \n**Total:** ${num}\n**Reason**: ${reason}`); 96 | 97 | const UserEmbed = new EmbedBuilder() 98 | .setTitle("⚠ Warning") 99 | .setTimestamp(Date.now()) 100 | .setColor(client.color) 101 | .setDescription(`You've got a Warning Point in \`${interaction.guild.name}\` \n**Total:** ${num}\n**Reason:** ${reason}\n**Moderator:** ${interaction.member}`) 102 | 103 | user.send({embeds: [UserEmbed]}) 104 | 105 | return interaction.reply({embeds: [Response], ephemeral: true}) 106 | } 107 | }) 108 | } 109 | 110 | /** 111 | * 112 | * @param {String} userID 113 | * @param {Int} points 114 | * @param {ChatInputCommandInteraction} interaction 115 | * @param {GuildMember} user 116 | * @param {Client} client 117 | */ 118 | async function removeInteractionPoints(points, interaction, user, client) { 119 | const Response = new EmbedBuilder() 120 | .setColor(client.color) 121 | .setTimestamp(Date.now()) 122 | .setTitle(`${user.user.tag}!`); 123 | 124 | warnDB.findOne({GuildID: interaction.guildId, UserID: user.id}, async(err, data) => { 125 | if(err) throw err; 126 | 127 | if(data) { 128 | let num = data.Warns; 129 | 130 | if(points < num) { 131 | await warnDB.findOneAndUpdate( 132 | {GuildID: interaction.guildId, UserID: user.id}, 133 | {Warns: num - points}, 134 | {new: true, upsert: true}); 135 | 136 | Response.setDescription(`Removed \`${points}\` Warning Point/s from ${user}! \n**Total:** ${num - points}`); 137 | return interaction.reply({ embeds: [Response] }) 138 | } else { 139 | await warnDB.findOneAndUpdate( 140 | {GuildID: interaction.guildId, UserID: user.id}, 141 | {Warns: 0}, 142 | {new: true, upsert: true}); 143 | 144 | Response.setDescription(`Removed \`all\` Warning Points from ${user}! \n**Total:** 0`); 145 | return interaction.reply({ embeds: [Response] }) 146 | } 147 | } else { 148 | return interaction.reply({ content: 'This user does not have any warning points!', ephemeral: true }) 149 | } 150 | }); 151 | } 152 | 153 | /** 154 | * 155 | * @param {String} userID 156 | * @param {Int} points 157 | * @param {Message} message 158 | * @param {GuildMember} user 159 | * @param {Client} client 160 | */ 161 | async function removePoints(points, message, user, client) { 162 | const Response = new EmbedBuilder() 163 | .setColor(client.color) 164 | .setTimestamp(Date.now()) 165 | .setTitle(`${user.user.tag}!`); 166 | 167 | warnDB.findOne({GuildID: message.guildId, UserID: user.id}, async(err, data) => { 168 | if(err) throw err; 169 | 170 | if(data) { 171 | let num = data.Warns; 172 | 173 | if(points < num) { 174 | await warnDB.findOneAndUpdate( 175 | {GuildID: message.guildId, UserID: user.id}, 176 | {Warns: num - points}, 177 | {new: true, upsert: true}); 178 | 179 | Response.setDescription(`Removed \`${points}\` Warning Point/s from ${user}! \n**Total:** ${num - points}`); 180 | return message.channel.send({ embeds: [Response] }) 181 | } else { 182 | await warnDB.findOneAndUpdate( 183 | {GuildID: message.guildId, UserID: user.id}, 184 | {Warns: 0}, 185 | {new: true, upsert: true}); 186 | 187 | Response.setDescription(`Removed \`all\` Warning Points from ${user}! \n**Total:** 0`); 188 | return message.channel.send({ embeds: [Response] }) 189 | } 190 | } 191 | }); 192 | } 193 | 194 | module.exports = { addPoints, removePoints, addInteractionPoints, removeInteractionPoints } -------------------------------------------------------------------------------- /src/types/commands/system/giveaway.js: -------------------------------------------------------------------------------- 1 | const { Client, ChatInputCommandInteraction, EmbedBuilder, SlashCommandBuilder, PermissionFlagsBits, ChannelType } = require('discord.js'); 2 | const ms = require('ms'); 3 | 4 | module.exports = { 5 | data: new SlashCommandBuilder() 6 | .setName("giveaway") 7 | .setDescription("A complete giveaway system") 8 | .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) 9 | .setDMPermission(false) 10 | .addSubcommand( 11 | command => 12 | command.setName('create') 13 | .setDescription('Create a giveaway') 14 | .addStringOption( 15 | option => 16 | option.setName('duration') 17 | .setDescription('Provide a duration for this giveaway (1m, 1h, 1d)') 18 | .setRequired(true)) 19 | .addIntegerOption( 20 | option => 21 | option.setName('winners') 22 | .setDescription('Select the amount of winners for this giveaway') 23 | .setRequired(true)) 24 | .addStringOption( 25 | option => 26 | option.setName('prize') 27 | .setDescription('Provide the name of the prize') 28 | .setRequired(true)) 29 | .addChannelOption( 30 | option => 31 | option.setName('channel') 32 | .setDescription('Select a channel to send the giveaway to.') 33 | .addChannelTypes(ChannelType.GuildText)) 34 | .addRoleOption( 35 | option => 36 | option.setName('giveaway-role') 37 | .setDescription('Notify your giveaway Role!'))) 38 | .addSubcommand( 39 | command => 40 | command.setName('actions') 41 | .setDescription('Options for giveaways.') 42 | .addStringOption( 43 | option => 44 | option.setName('option') 45 | .setDescription('Select an option.') 46 | .setRequired(true) 47 | .addChoices( 48 | { name: '⛔ End', value: 'end' }, 49 | { name: '⏸️ Pause', value: 'pause' }, 50 | { name: '▶️ Unpause', value: 'unpause' }, 51 | { name: '🎲 Reroll', value: 'reroll' }, 52 | { name: '🗑️ Delete', value: 'delete' }, 53 | )) 54 | .addStringOption( 55 | option => 56 | option.setName('message-id') 57 | .setDescription('Provide the message id of the giveaway!') 58 | .setRequired(true)) 59 | ), 60 | /** 61 | * @param {ChatInputCommandInteraction} interaction 62 | * @param {Client} client 63 | */ 64 | async execute(interaction, client) { 65 | const { options, guild } = interaction; 66 | 67 | const Sub = options.getSubcommand(); 68 | const errorEmbed = new EmbedBuilder() 69 | .setTitle('⛔ Error') 70 | .setColor('Red') 71 | 72 | const successEmbed = new EmbedBuilder() 73 | .setColor(client.color) 74 | .setTitle('🎉 Giveaway') 75 | 76 | switch(Sub) { 77 | 78 | case "create": { 79 | 80 | const gChannel = options.getChannel('channel') || interaction.channel; 81 | const duration = options.getString('duration'); 82 | const winnerCount = options.getInteger('winners'); 83 | const prize = options.getString('prize'); 84 | const giveawayRole = options.getRole('giveaway-role') 85 | 86 | client.giveawaysManager.start(gChannel, { 87 | duration: ms(duration), 88 | winnerCount, 89 | prize, 90 | hostedBy: interaction.member.user, 91 | messages : { 92 | giveaway: `${giveawayRole ? `<@&${giveawayRole.id}>\n` : "" }🎉 **GIVEAWAY STARTED** 🎉`, 93 | giveawayEnded: `${giveawayRole ? `<@&${giveawayRole.id}>\n` : "" }🔔 **GIVEAWAY ENDED** 🔔`, 94 | winMessage: 'Congratulations, {winners}! You won **{this.prize}**!' 95 | } 96 | }).then(async () => { 97 | successEmbed.setDescription("Giveaway was successfully started!") 98 | return interaction.reply({embeds: [successEmbed], ephemeral: true}) 99 | }).catch((err) => { 100 | errorEmbed.setDescription(err) 101 | return interaction.reply({embeds: [errorEmbed], ephemeral: true}) 102 | }) 103 | 104 | 105 | 106 | } break; 107 | 108 | case "actions": { 109 | const choice = options.getString('option'); 110 | const messageId = options.getString('message-id'); 111 | const giveaway = client.giveawaysManager.giveaways.find((g) => g.guildId === interaction.guildId && g.messageId === messageId); 112 | 113 | if(!giveaway) { 114 | errorEmbed.setDescription(`Unable to find giveaway with the message id: \`${messageId}\` in this guild`); 115 | return interaction.reply({embeds: [errorEmbed], ephemeral: true}) 116 | } 117 | 118 | switch(choice) { 119 | 120 | case "end": { 121 | client.giveawaysManager.end(messageId).then(() => { 122 | successEmbed.setDescription("Giveaway has been ended.") 123 | return interaction.reply({embeds: [successEmbed], ephemeral: true}); 124 | }).catch((err) => { 125 | errorEmbed.setDescription(err) 126 | return interaction.reply({embeds: [errorEmbed], ephemeral: true}); 127 | }) 128 | } break; 129 | 130 | case "pause": { 131 | client.giveawaysManager.pause(messageId).then(() => { 132 | successEmbed.setDescription("Giveaway has been paused.") 133 | return interaction.reply({embeds: [successEmbed], ephemeral: true}); 134 | }).catch((err) => { 135 | errorEmbed.setDescription(err) 136 | return interaction.reply({embeds: [errorEmbed], ephemeral: true}); 137 | }) 138 | } break; 139 | 140 | case "unpause": { 141 | client.giveawaysManager.unpause(messageId).then(() => { 142 | successEmbed.setDescription("Giveaway has been unpaused.") 143 | interaction.reply({embeds: [successEmbed], ephemeral: true}); 144 | }).catch((err) => { 145 | errorEmbed.setDescription(err) 146 | return interaction.reply({embeds: [errorEmbed], ephemeral: true}); 147 | }) 148 | } break; 149 | 150 | case "reroll": { 151 | client.giveawaysManager.reroll(messageId).then(() => { 152 | successEmbed.setDescription("Giveaway has been rerolled.") 153 | interaction.reply({embeds: [successEmbed], ephemeral: true}); 154 | }).catch((err) => { 155 | errorEmbed.setDescription(err) 156 | return interaction.reply({embeds: [errorEmbed], ephemeral: true}); 157 | }) 158 | } break; 159 | 160 | case "delete": { 161 | client.giveawaysManager.delete(messageId).then(() => { 162 | successEmbed.setDescription("Giveaway has been deleted.") 163 | interaction.reply({embeds: [successEmbed], ephemeral: true}); 164 | }).catch((err) => { 165 | errorEmbed.setDescription(err) 166 | return interaction.reply({embeds: [errorEmbed], ephemeral: true}); 167 | }) 168 | } break; 169 | } 170 | } break; 171 | } 172 | 173 | } 174 | } -------------------------------------------------------------------------------- /src/types/commands/moderation/mute.js: -------------------------------------------------------------------------------- 1 | const { Client, SlashCommandBuilder, EmbedBuilder, ChatInputCommandInteraction, PermissionFlagsBits, BitField, PermissionsBitField, ChannelType, Embed } = require('discord.js') 2 | const MuteDB = require('../../../models/MuteSystem'); 3 | const ms = require('ms') 4 | 5 | module.exports = { 6 | data: new SlashCommandBuilder() 7 | .setName("mute") 8 | .setDescription("Mute a specific member.") 9 | .addUserOption( 10 | option => 11 | option.setName("user") 12 | .setDescription("The User you want to mute!") 13 | .setRequired(true)) 14 | .addStringOption( 15 | option => 16 | option.setName("reason") 17 | .setDescription("Provide a reason") 18 | .setRequired(true)) 19 | .addStringOption( 20 | option => 21 | option.setName("duration") 22 | .setDescription("Select a duration") 23 | .setRequired(true) 24 | .addChoices( 25 | { name: "10 seconds", value: "10s" }, 26 | { name: "30 minutes", value: "30m" }, 27 | { name: "1 hour", value: "1h" }, 28 | { name: "3 hours", value: "3h" }, 29 | { name: "1 day", value: "1d" }, 30 | )) 31 | .setDMPermission(false) 32 | .setDefaultMemberPermissions(PermissionFlagsBits.ManageRoles), 33 | /** 34 | * 35 | * @param {ChatInputCommandInteraction} interaction 36 | * @param {Client} client 37 | */ 38 | async execute(interaction, client) { 39 | const { options, guild, member } = interaction; 40 | 41 | const Target = options.getMember("user"); 42 | const Reason = options.getString("reason"); 43 | const Duration = options.getString("duration"); 44 | 45 | let mutedRole = guild.roles.cache.find(role => role.name === "muted"); 46 | 47 | const Response = new EmbedBuilder() 48 | .setColor(client.color) 49 | .setAuthor({name: "🔈 Mute System", iconURL: guild.iconURL()}) 50 | .setTimestamp(Date.now()) 51 | 52 | if(!mutedRole) { 53 | guild.roles.create({ 54 | name: "muted", 55 | mentionable: false, 56 | reason: "This role is needed", 57 | permissions: [] 58 | }).then(async role => { 59 | const channels = await guild.channels.cache; 60 | channels.forEach(channel => { 61 | channel.permissionOverwrites.edit(role.id, { SendMessages: false, Connect: false }) 62 | }) 63 | 64 | const muteRole = role; 65 | 66 | if(Target.id == member.id) return interaction.reply({embeds: [Response.setDescription('🛑 You cannot mute yourself.')]}); 67 | if(Target.roles.highest.position > member.roles.highest.position) return interaction.reply({embeds: [Response.setDescription('🛑 You cannot mute someone with a superior role than you.')]}); 68 | 69 | MuteDB.findOne({ GuildID: guild.id, UserID: Target.id } , async (err, data) => { 70 | if(err) throw err; 71 | 72 | if(!data) { 73 | data = new MuteDB({ 74 | GuildID: guild.id, 75 | UserID: Target.id, 76 | Data: [ 77 | { 78 | ExecuterID: member.id, 79 | ExecuterTag: member.user.tag, 80 | TargetID: Target.id, 81 | TargetTag: Target.user.tag, 82 | Reason: Reason, 83 | Duration: Duration, 84 | Date: parseInt(interaction.createdTimestamp / 1000) 85 | } 86 | ] 87 | }) 88 | } else { 89 | const newMuteObject = { 90 | ExecuterID: member.id, 91 | ExecuterTag: member.user.tag, 92 | TargetID: Target.id, 93 | TargetTag: Target.user.tag, 94 | Reason: Reason, 95 | Duration: Duration, 96 | Date: parseInt(interaction.createdTimestamp / 1000) 97 | } 98 | 99 | data.Data.push(newMuteObject) 100 | } 101 | 102 | data.save(); 103 | }) 104 | 105 | Target.send({embeds: [new EmbedBuilder() 106 | .setColor(client.color) 107 | .setAuthor({name: "🔈 Mute System", iconURL: guild.iconURL()}) 108 | .setDescription(`You have been muted by ${member} in **${guild.name}**\n**Reason:** ${Reason}\n**Duration:** ${Duration}`) 109 | ]}).catch(() => { console.log(`Could not send the mute notice to ${Target.user.tag}.`)}) 110 | 111 | Response.setDescription(`Member: ${Target} | \`${Target.id}\` has been **muted**\nStaff: ${member} | \`${member.id}\`\nDuration: \`${Duration}\`\nReason: \`${Reason}\` `) 112 | interaction.reply({embeds: [Response]}); 113 | 114 | Target.roles.add(muteRole.id) 115 | setTimeout(async () => { 116 | if(!Target.roles.cache.has(muteRole.id)) return; 117 | await Target.roles.remove(muteRole.id); 118 | }, ms(Duration)) 119 | }) 120 | } else { 121 | if(Target.id == member.id) return interaction.reply({embeds: [Response.setDescription('🛑 You cannot mute yourself.')]}); 122 | if(Target.roles.highest.position > member.roles.highest.position) return interaction.reply({embeds: [Response.setDescription('🛑 You cannot mute someone with a superior role than you.')]}); 123 | 124 | MuteDB.findOne({ GuildID: guild.id, UserID: Target.id } , async (err, data) => { 125 | if(err) throw err; 126 | 127 | if(!data) { 128 | data = new MuteDB({ 129 | GuildID: guild.id, 130 | UserID: Target.id, 131 | Data: [ 132 | { 133 | ExecuterID: member.id, 134 | ExecuterTag: member.user.tag, 135 | TargetID: Target.id, 136 | TargetTag: Target.user.tag, 137 | Reason: Reason, 138 | Duration: Duration, 139 | Date: parseInt(interaction.createdTimestamp / 1000) 140 | } 141 | ] 142 | }) 143 | } else { 144 | const newMuteObject = { 145 | ExecuterID: member.id, 146 | ExecuterTag: member.user.tag, 147 | TargetID: Target.id, 148 | TargetTag: Target.user.tag, 149 | Reason: Reason, 150 | Duration: Duration, 151 | Date: parseInt(interaction.createdTimestamp / 1000) 152 | } 153 | 154 | data.Data.push(newMuteObject) 155 | } 156 | 157 | data.save(); 158 | }) 159 | 160 | Target.send({embeds: [new EmbedBuilder() 161 | .setColor(client.color) 162 | .setAuthor({name: "🔈 Mute System", iconURL: guild.iconURL()}) 163 | .setDescription(`You have been muted taped by ${member} in **${guild.name}**\n**Reason:** ${Reason}\n**Duration:** ${Duration}`) 164 | ]}).catch(() => { console.log(`Could not send the mute notice to ${Target.user.tag}.`)}) 165 | 166 | Response.setDescription(`Member: ${Target} | \`${Target.id}\` has been **muted**\nStaff: ${member} | \`${member.id}\`\nDuration: \`${Duration}\`\nReason: \`${Reason}\` `) 167 | interaction.reply({embeds: [Response]}); 168 | 169 | Target.roles.add(mutedRole.id) 170 | setTimeout(async () => { 171 | if(!Target.roles.cache.has(mutedRole.id)) return; 172 | await Target.roles.remove(mutedRole.id); 173 | }, ms(Duration)) 174 | } 175 | } 176 | } -------------------------------------------------------------------------------- /src/types/commands/setup/reactionRoles.js: -------------------------------------------------------------------------------- 1 | const { Client, SlashCommandBuilder, ChatInputCommandInteraction, SelectMenuBuilder, SelectMenuOptionBuilder, ActionRowBuilder, PermissionFlagsBits, EmbedBuilder, PermissionsBitField } = require('discord.js') 2 | const rolesDB = require('../../../models/ReactionRoles') 3 | const { isValidHexColor } = require('../../../utils/utils') 4 | 5 | module.exports = { 6 | data: new SlashCommandBuilder() 7 | .setName('reactionroles') 8 | .setDescription('Simple Reaction Roles') 9 | .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) 10 | .setDMPermission(false) 11 | .addSubcommand( 12 | command => 13 | command.setName('create') 14 | .setDescription('Create a reaction roles embed') 15 | .addStringOption(option => option.setName('title').setDescription('Embed Title').setRequired(true)) 16 | .addStringOption(option => option.setName('description').setDescription('Embed Description').setRequired(true)) 17 | .addStringOption(option => option.setName('image').setDescription('Embed Image')) 18 | .addStringOption(option => option.setName('color').setDescription('Embed Color')) 19 | ) 20 | .addSubcommand( 21 | command => 22 | command.setName('edit') 23 | .setDescription('Edit a reaction roles embed') 24 | .addStringOption(option => option.setName('message-id').setDescription('MessageID of the Embed').setRequired(true)) 25 | .addStringOption(option => option.setName('title').setDescription('New Title of the Embed').setRequired(true)) 26 | .addStringOption(option => option.setName('description').setDescription('New Description of the Embed').setRequired(true)) 27 | .addStringOption(option => option.setName('image').setDescription('Image of the Embed').setRequired(false)) 28 | .addStringOption(option => option.setName('color').setDescription('Embed Color')) 29 | ) 30 | .addSubcommand( 31 | command => 32 | command.setName('add') 33 | .setDescription('Add Custom roles') 34 | .addStringOption(option => option.setName('message-id').setDescription('MessageID of the Embed').setRequired(true)) 35 | .addRoleOption(option => option.setName('role').setDescription('Role you want to add').setRequired(true)) 36 | .addStringOption(option => option.setName('description').setDescription('Description of your role').setRequired(true)) 37 | .addStringOption(option => option.setName('emoji').setDescription('Emoji of your role').setRequired(true)) 38 | ) 39 | .addSubcommand( 40 | command => 41 | command.setName('remove') 42 | .setDescription('Remove Custom roles') 43 | .addStringOption(option => option.setName('message-id').setDescription('MessageID of the Embed').setRequired(true)) 44 | .addRoleOption(option => option.setName('role').setDescription('Role you want to add').setRequired(true)) 45 | ).addSubcommand( 46 | command => 47 | command.setName('delete') 48 | .setDescription('Delete custom roles') 49 | .addStringOption(option => option.setName('message-id').setDescription('MessageID of the Embed').setRequired(true)) 50 | ), 51 | /** 52 | * 53 | * @param {ChatInputCommandInteraction} interaction 54 | * @param {Client} client 55 | */ 56 | async execute(interaction, client) { 57 | 58 | const { options, guild, member, channel } = interaction; 59 | 60 | switch(options.getSubcommand()) { 61 | 62 | 63 | case "create": { 64 | 65 | const title = options.getString('title') 66 | const description = options.getString('description') 67 | const image = options.getString('image') 68 | const color = options.getString('color') 69 | 70 | const Response = new EmbedBuilder() 71 | .setTitle(title) 72 | .setDescription(description.replace('\n', ` 73 | 74 | `)) 75 | .setColor(0x2f3136) 76 | 77 | if(image) { 78 | if(!isValidHttpUrl(image)) return interaction.reply({ content: '❌ Image needs to be a valid url', ephemeral: true }); 79 | else Response.setImage(image) 80 | } 81 | 82 | if(color) { 83 | if(!isValidHexColor(color)) return interaction.reply({ content: '❌ Color needs to be a valid hex Color', ephemeral: true }); 84 | else Response.setColor(parseInt(color.replace("#", "0x"))) 85 | } 86 | 87 | interaction.channel.send({ embeds: [Response] }).then(async (msg) => { 88 | await rolesDB.create({ 89 | GuildID: guild.id, 90 | MessageID: msg.id, 91 | Roles: [] 92 | }) 93 | 94 | interaction.reply({ content: '✅ Created! Add Roles with ``/reactionroles add``', ephemeral: true }); 95 | }) 96 | 97 | } break; 98 | 99 | case "edit": { 100 | 101 | const message_ID = options.getString('message-id') 102 | const title = options.getString('title') 103 | const description = options.getString('description') 104 | const image = options.getString('image'); 105 | const color = options.getString('color') 106 | 107 | rolesDB.findOne({ GuildID: guild.id, MessageID: message_ID }, async(err, data) => { 108 | if(err) throw err; 109 | if(!data) return interaction.reply({ content: `❌ ${message_ID} is not a valid ReactionRoles Embed`, ephemeral: true}); 110 | 111 | const Response = new EmbedBuilder() 112 | .setTitle(title) 113 | .setDescription(description) 114 | .setColor(0x2f3136) 115 | 116 | channel.messages.fetch(message_ID).then(msg => { 117 | if(image) { 118 | if(!isValidHttpUrl(image)) return interaction.reply({ content: '❌ Image needs to be a valid url', ephemeral: true }); 119 | else Response.setImage(image); 120 | } 121 | 122 | if(color) { 123 | if(!isValidHexColor(color)) return interaction.reply({ content: '❌ Color needs to be a valid hex Color', ephemeral: true }); 124 | else Response.setColor(parseInt(color.replace("#", "0x"))) 125 | } 126 | 127 | msg.edit({ embeds: [Response] }); 128 | interaction.reply({ content: '✅ Edited Embed', ephemeral: true }) 129 | }) 130 | }) 131 | 132 | } break; 133 | 134 | case "add": { 135 | 136 | const role = options.getRole('role') 137 | const message_ID = options.getString('message-id') 138 | const description = options.getString('description') 139 | const emoji = options.getString('emoji') 140 | 141 | const clientMember = guild.members.cache.get(client.user.id); 142 | if(role.position >= clientMember.roles.highest.position) return interaction.reply({ content: `❌ I can't assign a role that is higher or equal me`, ephemeral: true}); 143 | 144 | rolesDB.findOne({ GuildID: guild.id, MessageID: message_ID }, async function(err, data) { 145 | if(err) throw err; 146 | 147 | if(data) { 148 | 149 | const newRole = { 150 | roleID: role.id, 151 | roleDescription: description, 152 | roleEmoji: emoji, 153 | } 154 | let roleData = data.Roles.find(x => x.roleID === role.id); 155 | if(roleData) { 156 | roleData = newRole; 157 | data.save() 158 | } else { 159 | data.Roles = [...data.Roles, newRole] 160 | await data.save() 161 | } 162 | 163 | const selectOptions = data.Roles.map(x => { 164 | const role = guild.roles.cache.get(x.roleID); 165 | 166 | return new SelectMenuOptionBuilder() 167 | .setLabel(role.name) 168 | .setValue(role.id) 169 | .setDescription(x.roleDescription) 170 | .setEmoji(x.roleEmoji) 171 | }) 172 | 173 | const menu = new ActionRowBuilder() 174 | .addComponents(new SelectMenuBuilder().setCustomId('reaction-roles').setMaxValues(1).addOptions(selectOptions).setPlaceholder('Choose a role')); 175 | 176 | channel.messages.fetch(message_ID).then(msg => { 177 | msg.edit({ components: [menu] }) 178 | interaction.reply({ content: '✅ Added Role', ephemeral: true }) 179 | }) 180 | 181 | } else { 182 | return interaction.reply({ content: `❌ ${message_ID} is not a valid ReactionRoles Embed`, ephemeral: true}); 183 | } 184 | }); 185 | 186 | } break; 187 | 188 | case "remove": { 189 | 190 | const role = options.getRole('role') 191 | const message_ID = options.getString('message-id') 192 | 193 | rolesDB.findOne({ GuildID: guild.id, MessageID: message_ID }, async function(err, data) { 194 | if(err) throw err; 195 | 196 | if(data) { 197 | let roleData = data.Roles.find(x => x.roleID === role.id); 198 | if(roleData) { 199 | const filteredRoles = data.Roles.filter(x => x.roleID !== role.id); 200 | data.Roles = filteredRoles 201 | 202 | await data.save(); 203 | } else { 204 | return interaction.reply({ content: `❌ ${role} is not in these ReactionRoles`, ephemeral: true}); 205 | } 206 | 207 | const selectOptions = data.Roles.map(x => { 208 | const role = guild.roles.cache.get(x.roleID); 209 | 210 | return new SelectMenuOptionBuilder() 211 | .setLabel(role.name) 212 | .setValue(role.id) 213 | .setDescription(x.roleDescription) 214 | .setEmoji(x.roleEmoji) 215 | }) 216 | 217 | const menu = new ActionRowBuilder() 218 | .addComponents(new SelectMenuBuilder().setCustomId('reaction-roles').setMaxValues(1).addOptions(selectOptions).setPlaceholder('Choose a role')); 219 | 220 | channel.messages.fetch(message_ID).then(msg => { 221 | msg.edit({ components: [menu] }) 222 | interaction.reply({ content: '✅ Removed Role', ephemeral: true }) 223 | }) 224 | 225 | } else { 226 | return interaction.reply({ content: `❌ ${message_ID} is not a valid ReactionRoles Embed`, ephemeral: true}); 227 | } 228 | }); 229 | 230 | } break; 231 | 232 | case "delete": { 233 | const message_ID = options.getString('message-id') 234 | await rolesDB.findOneAndDelete({ GuildID: guild.id, MessageID: message_ID}) 235 | channel.messages.fetch(message_ID).then(msg => { 236 | msg.delete(); 237 | }) 238 | return interaction.reply({ content: '✅ Deleted!', ephemeral: true }); 239 | } break; 240 | 241 | 242 | } 243 | 244 | } 245 | } 246 | 247 | function isValidHttpUrl(string) { 248 | let url; 249 | 250 | try { 251 | url = new URL(string); 252 | } catch (_) { 253 | return false 254 | } 255 | 256 | return url.protocol === "https:" || url.protocol === "http:"; 257 | } --------------------------------------------------------------------------------