├── .gitignore ├── LICENSE ├── Procfile ├── README.md ├── package.json └── src ├── commands ├── Fun │ ├── meme.js │ └── youtube.js ├── Info │ ├── help.js │ ├── ping.js │ └── socials.js ├── Lunarvim-Docs │ └── docs.js └── Moderation │ ├── ban.js │ └── purge.js ├── events ├── messageCreate.js ├── messageReactionAdd.js ├── raw.js └── ready.js ├── example.env ├── handlers ├── client.js ├── commands.js ├── events.js └── slash_commands.js ├── main.js └── slash_commands └── Fun └── say.js /.gitignore: -------------------------------------------------------------------------------- 1 | config.json 2 | node_modules/ 3 | .env 4 | .idea/ 5 | package-lock.json 6 | .DS_Store 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Binx 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 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | worker: npm run start 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Chris@Machine Discord-Bot 2 | A Discord Bot made for Chris' Discord server. 3 | 4 | ## How You Can Contribute 5 | - Fork this repository, and edit the code there. 6 | - Once you are finished with the necessary changes, open a Pull Request. 7 | - If you're facing any difficulties, feel free to contact us in our discord server. 8 | 9 | ### Discord Server: https://discord.gg/SpGzprxcRt 10 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chrisatmachine-discord-bot", 3 | "version": "1.0.0", 4 | "description": "A Discord Bot made for Chris' Discord server.", 5 | "main": "main.js", 6 | "engines": { 7 | "node": "16" 8 | }, 9 | "scripts": { 10 | "test": "echo \"Error: no test specified\" && exit 1", 11 | "start": "cd src && node main.js", 12 | "dev": "cd src && nodemon main.js" 13 | }, 14 | "repository": { 15 | "type": "git", 16 | "url": "git+https://github.com/Binx-Codes/chrisatmachine-discord-bot.git" 17 | }, 18 | "keywords": [], 19 | "author": "", 20 | "license": "ISC", 21 | "bugs": { 22 | "url": "https://github.com/Binx-Codes/chrisatmachine-discord-bot/issues" 23 | }, 24 | "homepage": "https://github.com/Binx-Codes/chrisatmachine-discord-bot#readme", 25 | "dependencies": { 26 | "discord.js": "^13.1.0", 27 | "dotenv": "^10.0.0", 28 | "got": "^11.8.2", 29 | "ytsr": "3.5.3" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/commands/Fun/meme.js: -------------------------------------------------------------------------------- 1 | const { Permissions, Client, Message, MessageEmbed } = require("discord.js"); 2 | const got = require("got"); 3 | module.exports = { 4 | name: "meme", 5 | description: "Get a fun meme!", 6 | perms: { 7 | client: [ 8 | Permissions.FLAGS.SEND_MESSAGES, 9 | Permissions.FLAGS.VIEW_CHANNEL, 10 | Permissions.FLAGS.EMBED_LINKS, 11 | ], 12 | user: [Permissions.FLAGS.SEND_MESSAGES], 13 | }, 14 | aliases: ["memes"], 15 | 16 | /** 17 | * 18 | * @param {Client} client 19 | * @param {Message} message 20 | * @param {STring[]} args 21 | */ 22 | execute: async (client, message, args) => { 23 | const embed = new MessageEmbed(); 24 | // @ts-ignore 25 | got("https://www.reddit.com/r/memes/random/.json") 26 | .then((response) => { 27 | const [list] = JSON.parse(response.body); 28 | const [post] = list.data.children; 29 | 30 | const permalink = post.data.permalink; 31 | const memeUrl = `https://reddit.com${permalink}`; 32 | const memeImage = post.data.url; 33 | const memeTitle = post.data.title; 34 | const memeUpvotes = post.data.ups; 35 | const memeNumComments = post.data.num_comments; 36 | 37 | embed.setTitle(`${memeTitle}`); 38 | embed.setURL(`${memeUrl}`); 39 | embed.setColor("RANDOM"); 40 | embed.setImage(memeImage); 41 | embed.setFooter(`👍 ${memeUpvotes} 💬 ${memeNumComments}`); 42 | 43 | message.channel.send({ embeds: [embed] }); 44 | }) 45 | .catch(console.error); 46 | }, 47 | }; 48 | -------------------------------------------------------------------------------- /src/commands/Fun/youtube.js: -------------------------------------------------------------------------------- 1 | const { Permissions, Client, Message, MessageEmbed } = require("discord.js"); 2 | const ytsr = require('ytsr'); 3 | 4 | module.exports = { 5 | name: "youtube", 6 | description: "Search for youtube videos.", 7 | perms: { 8 | client: [ 9 | Permissions.FLAGS.SEND_MESSAGES, 10 | Permissions.FLAGS.VIEW_CHANNEL, 11 | Permissions.FLAGS.EMBED_LINKS, 12 | ], 13 | user: [Permissions.FLAGS.SEND_MESSAGES], 14 | }, 15 | aliases: ["yt", "search", "ytsearch"], 16 | 17 | /** 18 | * 19 | * @param {Client} client 20 | * @param {Message} message 21 | * @param {String[]} args 22 | */ 23 | execute: async (client, message, args) => { 24 | const query = args.join(" "); 25 | 26 | const results = await ytsr(query, { limit: 1 }); 27 | const items = results['items'] 28 | if (items.length) { 29 | await message.channel.send(items[0]['url']) 30 | } else { 31 | await message.channel.send({ 32 | embeds: [ 33 | new MessageEmbed() 34 | .setDescription("Sorry couldnt find a video related to that query.") 35 | .setColor("RED") 36 | ] 37 | }) 38 | } 39 | }, 40 | }; 41 | -------------------------------------------------------------------------------- /src/commands/Info/help.js: -------------------------------------------------------------------------------- 1 | const { Permissions, Client, Message, MessageEmbed } = require("discord.js"); 2 | require("dotenv").config(); 3 | const { readdirSync } = require("fs"); 4 | const prefix = process.env.PREFIX; 5 | module.exports = { 6 | name: "help", 7 | description: "Ouput the bot's help window.", 8 | perms: { 9 | client: [ 10 | Permissions.FLAGS.SEND_MESSAGES, 11 | Permissions.FLAGS.VIEW_CHANNEL, 12 | Permissions.FLAGS.EMBED_LINKS, 13 | ], 14 | user: [Permissions.FLAGS.SEND_MESSAGES], 15 | }, 16 | aliases: ["h"], 17 | 18 | /** 19 | * 20 | * @param {Client} client 21 | * @param {Message} message 22 | * @param {STring[]} args 23 | */ 24 | execute: async (client, message, args) => { 25 | const cont = message.content.slice(prefix.length).trim().split(/ +/); 26 | // const commandName = args.shift().toLowerCase(); 27 | // const command = client.commands.get(commandName); 28 | 29 | const roleColor = "RED"; 30 | 31 | if (!args[0]) { 32 | let categories = []; 33 | 34 | readdirSync("./commands/").forEach((dir) => { 35 | const commands = readdirSync(`./commands/${dir}/`).filter((file) => 36 | file.endsWith(".js") 37 | ); 38 | 39 | const cmds = commands.map((command) => { 40 | let file = require(`../../commands/${dir}/${command}`); 41 | 42 | if (!file.name) return "No command name."; 43 | 44 | let name = file.name.replace(".js", ""); 45 | 46 | return `\`${name}\``; 47 | }); 48 | 49 | let data = new Object(); 50 | 51 | data = { 52 | name: dir.toUpperCase(), 53 | value: cmds.length === 0 ? "In progress." : cmds.join(" "), 54 | }; 55 | 56 | categories.push(data); 57 | }); 58 | 59 | const embed = new MessageEmbed() 60 | .setTitle("📬 Need help? Here are all of my commands:") 61 | .addFields(categories) 62 | .setDescription( 63 | `Use \`${prefix}help\` followed by a command name to get more additional information on a command. For example: \`${prefix}help ban\`.` 64 | ) 65 | .setFooter( 66 | `Requested by ${message.author.tag}`, 67 | message.author.displayAvatarURL({ dynamic: true }) 68 | ) 69 | .setTimestamp() 70 | .setColor(roleColor); 71 | return message.channel.send({ embeds: [embed] }); 72 | } else { 73 | const command = 74 | client.commands.get(args[0].toLowerCase()) || 75 | client.commands.find( 76 | (c) => c.aliases && c.aliases.includes(args[0].toLowerCase()) 77 | ); 78 | 79 | if (!command) { 80 | const embed = new MessageEmbed() 81 | .setTitle( 82 | `Invalid command! Use \`${prefix}help\` for all of my commands!` 83 | ) 84 | .setColor("FF0000"); 85 | return message.channel.send({ embeds: [embed] }); 86 | } 87 | 88 | const embed = new MessageEmbed() 89 | .setTitle("Command Details:") 90 | .addField("PREFIX:", `\`${prefix}\``) 91 | .addField( 92 | "COMMAND:", 93 | command.name ? `\`${command.name}\`` : "No name for this command." 94 | ) 95 | .addField( 96 | "ALIASES:", 97 | command.aliases 98 | ? `\`${command.aliases.join("` `")}\`` 99 | : "No aliases for this command." 100 | ) 101 | .addField( 102 | "USAGE:", 103 | command.usage 104 | ? `\`${prefix}${command.name} ${command.usage}\`` 105 | : `\`${prefix}${command.name}\`` 106 | ) 107 | .addField( 108 | "DESCRIPTION:", 109 | command.description 110 | ? command.description 111 | : "No description for this command." 112 | ) 113 | .setFooter( 114 | `Requested by ${message.author.tag}`, 115 | message.author.displayAvatarURL({ dynamic: true }) 116 | ) 117 | .setTimestamp() 118 | .setColor(roleColor); 119 | return message.channel.send({ embeds: [embed] }); 120 | } 121 | }, 122 | }; 123 | -------------------------------------------------------------------------------- /src/commands/Info/ping.js: -------------------------------------------------------------------------------- 1 | const { Permissions, Client, Message } = require("discord.js"); 2 | 3 | module.exports = { 4 | name: "ping", 5 | description: "To get the latency of the bot.", 6 | perms: { 7 | client: [ 8 | Permissions.FLAGS.SEND_MESSAGES, 9 | Permissions.FLAGS.VIEW_CHANNEL, 10 | Permissions.FLAGS.EMBED_LINKS, 11 | ], 12 | user: [Permissions.FLAGS.SEND_MESSAGES], 13 | }, 14 | aliases: [], 15 | 16 | /** 17 | * 18 | * @param {Client} client 19 | * @param {Message} message 20 | * @param {STring[]} args 21 | */ 22 | execute: async (client, message, args) => { 23 | message.reply({ 24 | content: `Pong!!`, 25 | }); 26 | const command = require(`../commands/${dir}/${file}`); 27 | 28 | message.channel.send(command.name); 29 | }, 30 | }; 31 | -------------------------------------------------------------------------------- /src/commands/Info/socials.js: -------------------------------------------------------------------------------- 1 | const { Permissions, Client, Message, MessageEmbed } = require("discord.js"); 2 | 3 | module.exports = { 4 | name: "socials", 5 | description: "Links to Chris' socials.", 6 | perms: { 7 | client: [ 8 | Permissions.FLAGS.SEND_MESSAGES, 9 | Permissions.FLAGS.VIEW_CHANNEL, 10 | Permissions.FLAGS.EMBED_LINKS, 11 | ], 12 | user: [Permissions.FLAGS.SEND_MESSAGES], 13 | }, 14 | aliases: ["social", "github", "chris", "twitter", "patreon", "linkedin"], 15 | 16 | /** 17 | * 18 | * @param {Client} client 19 | * @param {Message} message 20 | * @param {STring[]} args 21 | */ 22 | execute: async (client, message, args) => { 23 | const em = new MessageEmbed() 24 | .setThumbnail("https://github.com/christianchiarulli.png") 25 | .setColor("RED") 26 | // .addField("Github", "[https://github.com](https://github.com/ChristianChiarulli)", true) 27 | // .addField("Patreon", "[https://patreon.com](https://www.patreon.com/chrisatmachine)", true) 28 | // .addField("youtube", "[https://youtube.com](https://www.youtube.com/channel/UCS97tchJDq17Qms3cux8wcA)") 29 | // .addField("odysee", "[https://odysee.com](https://odysee.com/@chrisatmachine:f)", true) 30 | // .addField("twitter", "[https://twitter.com](https://twitter.com/chrisatmachine)") 31 | // .addField("linkedin", "[https://linkedIn](https://www.linkedin.com/in/christianchiarulli/)", true) 32 | .setDescription(` 33 | [ ​ ​​ ​Github](https://github.com/ChristianChiarulli) 34 | [​ ​​ ​ Patreon](https://www.patreon.com/chrisatmachine) 35 | [ ​ ​​ ​Youtube](https://www.youtube.com/channel/UCS97tchJDq17Qms3cux8wcA) 36 | [異 ​ ​​ ​Odysee](https://odysee.com/@chrisatmachine:f) 37 | [暑 ​ ​​ ​Twitter](https://twitter.com/chrisatmachine) 38 | [ ​ ​​ ​Linkedin](https://www.linkedin.com/in/christianchiarulli/) 39 | `) 40 | 41 | message.channel.send({ embeds: [em] }); 42 | }, 43 | }; 44 | -------------------------------------------------------------------------------- /src/commands/Lunarvim-Docs/docs.js: -------------------------------------------------------------------------------- 1 | const { Permissions, Client, Message, MessageEmbed } = require("discord.js"); 2 | 3 | // TODO: need to add categories: languages, extra-plugins 4 | const lunarDocs = { 5 | // Mostly installation 6 | "lunarvim-github": "https://github.com/LunarVim/LunarVim", 7 | "installing-uninstalling": "https://www.lunarvim.org/01-installing.html#uninstall", 8 | "install-stable": "https://www.lunarvim.org/01-installing.html#stable", 9 | "install-rolling": "https://www.lunarvim.org/01-installing.html#rolling", 10 | "troubleshooting-install-problems-installation-problems-troubleshoots": "https://www.lunarvim.org/01-installing.html#troubleshooting-installation-problems", 11 | "add-to-path-add-path-add-lvim-to-path": "https://www.lunarvim.org/02-after-install.html#add-lvim-to-path", 12 | 13 | // General Config 14 | "configuration": "https://www.lunarvim.org/configuration/", 15 | "quickstart-after-install-quick-start": "https://www.lunarvim.org/02-after-install.html", 16 | "general-settings-options": "https://www.lunarvim.org/configuration/01-settings.html", 17 | "general-keybinds-general-keybindings-keymappings": "https://www.lunarvim.org/configuration/02-keybindings.html#general-bindings", 18 | "which-key-whichkey": "https://www.lunarvim.org/configuration/02-keybindings.html#whichkey-bindings", 19 | "autocmds-autocommands": "https://www.lunarvim.org/configuration/05-autocommands.html", 20 | "color-schemes-colorschemes": "https://www.lunarvim.org/configuration/03-colorschemes.html", 21 | "statusline-lualine-galaxyline-feline": "https://www.lunarvim.org/configuration/06-statusline.html", 22 | "nerd-fonts": "https://www.lunarvim.org/configuration/04-nerd-fonts.html", 23 | "transparent-windows-blur-opacity": "https://www.lunarvim.org/configuration/03-colorschemes.html#transparent-windows", 24 | "leader-key-leaderkey-space-leader": "https://www.lunarvim.org/configuration/02-keybindings.html#leader-key", 25 | 26 | // Languagse stuffs 27 | "lsp-support-language-server-protocol-lspinstall-lsp-install-lsp": "https://www.lunarvim.org/languages/#lsp-support", 28 | "lsp-plugins-lsp-related-plugins": "https://www.lunarvim.org/plugins/02-default-plugins.html#language-server-protocol", 29 | "formatters-formatting": "https://www.lunarvim.org/languages/#formatting", 30 | "linting-linters": "https://www.lunarvim.org/languages/#linting", 31 | "langs-languages-php-svelte-react": "https://www.lunarvim.org/languages/", 32 | // Langs 33 | "c-lang-c-clangd-cpp-lang-cpp-c++-lang-c++": "https://www.lunarvim.org/languages/c_cpp.html", 34 | "c-sharp-c-hash-c-pound": "https://www.lunarvim.org/languages/csharp.html#c-csharp", 35 | "go-lang-go-golang": "https://www.lunarvim.org/languages/go.html", 36 | "java-lang-java": "https://www.lunarvim.org/languages/java.html", 37 | "javascript-lang-javascript-js-lang-js": "https://www.lunarvim.org/languages/javascript.html", 38 | "json-lang-json": "https://www.lunarvim.org/languages/json.html", 39 | "julia-lang-julia": "https://www.lunarvim.org/languages/julia.html", 40 | "lua-lang-lua": "https://www.lunarvim.org/languages/lua.html#lua", 41 | "ps-lang-ps-powershell-lang-powershell": "https://www.lunarvim.org/languages/powershell.html", 42 | "python-lang-python-py-lang-py-python3-lang-python3": "https://www.lunarvim.org/languages/python.html", 43 | "qml-lang-qml": "https://www.lunarvim.org/languages/qml.html#qml", 44 | "ruby-lang-ruby": "https://www.lunarvim.org/languages/ruby.html", 45 | "rust-lang-rust": "https://www.lunarvim.org/languages/rust.html", 46 | "scala-lang-scala": "https://www.lunarvim.org/languages/scala.html", 47 | "typescript-lang-typescript-ts-lang-ts": "https://www.lunarvim.org/languages/typescript.html", 48 | "vue-lang-vue": "https://www.lunarvim.org/languages/vue.html", 49 | 50 | // PLUGINS 51 | "core-plugins-nvim-tree-nvimtree-nvim_tree-dashboard-bufferline-terminal-toggleterm-compe-cmp": "https://www.lunarvim.org/plugins/#core-plugins", 52 | "install-plugins-pluginstall-installing-plugins-add-plugins": "https://www.lunarvim.org/plugins/01-installing.html#example", 53 | "remove-plugins-delete-plugins-plugin-delete-uninstall-plugin": "https://www.lunarvim.org/plugins/01-installing.html#removing-plugins", 54 | "packer.nvim-manage-plugins": "https://www.lunarvim.org/plugins/02-default-plugins.html#plugin-management", 55 | 56 | // Default Plugins 57 | "treesitter-lang-parser-tree-sitter": "https://www.lunarvim.org/plugins/02-default-plugins.html#language-parser", 58 | "treesitter-tree-sitter": "https://www.lunarvim.org/plugins/02-extra-plugins.html#treesitter", 59 | "commentary-kommentary-commenting-nvim-ts-commentstring": "https://www.lunarvim.org/plugins/02-default-plugins.html#comments", 60 | "nvim-tree-nvim_tree-file-explorer-nerdtree": "https://www.lunarvim.org/plugins/02-default-plugins.html#file-explorer", 61 | "nvim-telescope.nvim-fuzzy-search-fuzzy-finding": "https://www.lunarvim.org/plugins/03-extra-plugins.html#telescope-fzy-native-nvim", 62 | "nvim-cmp-compe-tabnine": "https://www.lunarvim.org/plugins/02-default-plugins.html#completion", 63 | "friendly-snippets-luasnips-ultisnips": "https://www.lunarvim.org/plugins/02-default-plugins.html#snippets", 64 | "gitsigns-git-signs-integration": "https://www.lunarvim.org/plugins/02-default-plugins.html#git", 65 | "terminal-toggleterm-floaterm": "https://www.lunarvim.org/plugins/02-default-plugins.html#terminal", 66 | "debugging-dapinstall-dap-install": "https://www.lunarvim.org/plugins/02-default-plugins.html#debugging", 67 | 68 | "vim-fugitive": "https://www.lunarvim.org/plugins/03-extra-plugins.html#vim-fugitive", 69 | "trouble-folke": "https://www.lunarvim.org/plugins/03-extra-plugins.html#trouble-nvim", 70 | "indent-blanklines-indent-guides": "https://www.lunarvim.org/plugins/03-extra-plugins.html#indent-blankline", 71 | "minimap-plugin-minimap": "https://www.lunarvim.org/plugins/03-extra-plugins.html#minimap", 72 | "ranger-plugin-ranger-rnvimr": "https://www.lunarvim.org/plugins/03-extra-plugins.html#rnvimr", 73 | "git-diffview.nvim": "https://www.lunarvim.org/plugins/03-extra-plugins.html#diffview", 74 | "octo-nvim-git": "https://www.lunarvim.org/plugins/03-extra-plugins.html#octo", 75 | "nvim-ts-rainbow-treesitter-rainbow": "https://www.lunarvim.org/plugins/03-extra-plugins.html#nvim-ts-rainbow", 76 | "nvim-treesitter-playground": "https://www.lunarvim.org/plugins/03-extra-plugins.html#playground", 77 | "autosave.nvim": "https://www.lunarvim.org/plugins/03-extra-plugins.html#autosave", 78 | "markdown-preview-markdownpreview.nvim": "https://www.lunarvim.org/plugins/03-extra-plugins.html#markdown-preview-nvim", 79 | "neoscroll.nvim": "https://www.lunarvim.org/plugins/03-extra-plugins.html#neoscroll", 80 | "nvim-ts-autotag-treesitter-autotag": "https://www.lunarvim.org/plugins/03-extra-plugins.html#nvim-ts-autotag", 81 | "todo-comments-folke": "https://www.lunarvim.org/plugins/03-extra-plugins.html#todo-comments-nvim", 82 | "folke-lsp-colors": "https://www.lunarvim.org/plugins/03-extra-plugins.html#lsp-colors", 83 | "persistence-folke": "https://www.lunarvim.org/plugins/03-extra-plugins.html#persistence", 84 | "bracey-liveserver-live-server": "https://www.lunarvim.org/plugins/03-extra-plugins.html#bracey", 85 | "plugin-hop.nvim": "https://www.lunarvim.org/plugins/03-extra-plugins.html#hop", 86 | "lightspeed.nvim": "https://www.lunarvim.org/plugins/03-extra-plugins.html#lightspeed", 87 | "numb.nvim": "https://www.lunarvim.org/plugins/03-extra-plugins.html#numb", 88 | "nvim-spectre.nvim": "https://www.lunarvim.org/plugins/03-extra-plugins.html#nvim-spectre", 89 | "git-blame.nvim": "https://www.lunarvim.org/plugins/03-extra-plugins.html#git-blame", 90 | "git-linker.nvim": "https://www.lunarvim.org/plugins/03-extra-plugins.html#gitlinker", 91 | "nvim-ts-playground.nvim": "https://www.lunarvim.org/plugins/03-extra-plugins.html#playground", 92 | "lush.nvim-colors": "https://www.lunarvim.org/plugins/03-extra-plugins.html#lush-nvim", 93 | "lsp-rooter.nvim": "https://www.lunarvim.org/plugins/03-extra-plugins.html#lsp-rooter", 94 | "lsp-signature.nvim": "https://www.lunarvim.org/plugins/03-extra-plugins.html#lsp-signature-nvim", 95 | "symbols-outline.nvim": "https://www.lunarvim.org/plugins/03-extra-plugins.html#symbols-outline-nvim", 96 | "nvim-lastplace.nvim-last-place": "https://www.lunarvim.org/plugins/03-extra-plugins.html#symbols-outline-nvim", 97 | "nvim-cursor-word-cursorword-cusor-word-highlight": "https://www.lunarvim.org/plugins/03-extra-plugins.html#vim-cursorword", 98 | "null-ls-nullls": "https://www.lunarvim.org/community/faq.html#what-is-null-ls-and-why-do-you-use-it", 99 | "go-to-preview.nvim-goto-preview": "https://www.lunarvim.org/plugins/03-extra-plugins.html#goto-preview", 100 | "vim-surround": "https://www.lunarvim.org/plugins/03-extra-plugins.html#vim-surround", 101 | 102 | "style-guide-styling": "https://www.lunarvim.org/dev/#style-guide", 103 | "lvim-development-lunarvim": "https://www.lunarvim.org/dev/#development-of-lunarvim", 104 | "lvinfo-lunarvim-info-lunarinfo": "https://www.lunarvim.org/languages/#at-a-glance", 105 | "faqs-frequently-asked-questions": "https://www.lunarvim.org/community/faq.html", 106 | }; 107 | 108 | /** 109 | * 110 | * @param {Client} client 111 | * @param {Message} message 112 | * @param {STring[]} args 113 | */ 114 | module.exports = { 115 | name: "docs", 116 | description: "Lunarvim docs!", 117 | perms: { 118 | client: [ 119 | Permissions.FLAGS.SEND_MESSAGES, 120 | Permissions.FLAGS.VIEW_CHANNEL, 121 | Permissions.FLAGS.EMBED_LINKS, 122 | ], 123 | user: [Permissions.FLAGS.SEND_MESSAGES], 124 | }, 125 | aliases: ["docs", "doc", "documentation", "rtfm"], 126 | 127 | /** 128 | * 129 | * @param {Client} client 130 | * @param {Message} message 131 | * @param {String[]} args 132 | */ 133 | execute: async (_, message, args) => { 134 | const search_query = args.join("-"); 135 | if (!args.length) return 136 | if (search_query.length <= 2) { 137 | const notEnough = new MessageEmbed() 138 | .setDescription("Argument length too small!") 139 | .setColor("RED"); 140 | message.channel.send({ embeds: [notEnough] }); 141 | 142 | return 143 | } 144 | 145 | let count = 0; 146 | Object.keys(lunarDocs).map((query) => { 147 | if (query.includes(search_query)) { 148 | count++; 149 | const em = new MessageEmbed() 150 | .setDescription(lunarDocs[query]) 151 | .setColor("RED"); 152 | 153 | message.channel.send({ embeds: [em] }); 154 | } 155 | }); 156 | if (count <= 0) { 157 | const failed = new MessageEmbed() 158 | .setDescription(`Couldn't get docs for ${search_query}`) 159 | .setColor("RED"); 160 | message.channel.send({ embeds: [failed] }) 161 | } 162 | }, 163 | }; 164 | -------------------------------------------------------------------------------- /src/commands/Moderation/ban.js: -------------------------------------------------------------------------------- 1 | const { Permissions, Client, Message, MessageEmbed } = require("discord.js"); 2 | 3 | module.exports = { 4 | name: "ban", 5 | description: "Ban a user [ MODERATOR ONLY ]", 6 | perms: { 7 | client: [ 8 | Permissions.FLAGS.SEND_MESSAGES, 9 | Permissions.FLAGS.VIEW_CHANNEL, 10 | Permissions.FLAGS.EMBED_LINKS, 11 | Permissions.FLAGS.BAN_MEMBERS, 12 | ], 13 | user: [Permissions.FLAGS.BAN_MEMBERS], 14 | }, 15 | aliases: [], 16 | 17 | /** 18 | * 19 | * @param {Client} client 20 | * @param {Message} message 21 | * @param {STring[]} args 22 | */ 23 | execute: async (client, message, args) => { 24 | let member = message.mentions.members.first(); 25 | if (!member) 26 | return message.reply("Please specify a member for me to kick them"); 27 | // @ts-ignore 28 | let reason = args.slice(1).join(" "); 29 | if (!reason) reason = "No Reason Given"; 30 | if (!member.bannable) { 31 | const errorEmbed = new MessageEmbed() 32 | .setDescription(`This member cannot be banned`) 33 | .setColor("RED"); 34 | return message.channel.send({ embeds: [errorEmbed] }); 35 | } 36 | try { 37 | const sembed2 = new MessageEmbed() 38 | .setColor("RED") 39 | .setDescription( 40 | `**You Have Been Banned From ${message.guild.name} for - ${ 41 | reason || "No Reason!" 42 | }**` 43 | ) 44 | .setFooter(message.guild.name, message.guild.iconURL()); 45 | member 46 | .send({ embeds: [sembed2] }) 47 | // @ts-ignore 48 | .then(() => member.ban()) 49 | .catch(() => null); 50 | } catch { 51 | // @ts-ignore 52 | member.ban(); 53 | } 54 | 55 | if (reason) { 56 | var sembed = new MessageEmbed() 57 | .setColor("GREEN") 58 | .setDescription( 59 | `**${member.user.username}** has been banned for ${reason}` 60 | ); 61 | message.channel.send({ embeds: [sembed] }); 62 | } else { 63 | var sembed2 = new MessageEmbed() 64 | .setColor("GREEN") 65 | .setDescription( 66 | `**${member.user.username}** has been banned for ${reason}` 67 | ); 68 | message.channel.send({ embeds: [sembed2] }); 69 | } 70 | }, 71 | }; 72 | -------------------------------------------------------------------------------- /src/commands/Moderation/purge.js: -------------------------------------------------------------------------------- 1 | const { Permissions, Client, Message, MessageEmbed } = require("discord.js"); 2 | 3 | module.exports = { 4 | name: "purge", 5 | description: "Delete specified number of messages", 6 | perms: { 7 | client: [ 8 | Permissions.FLAGS.SEND_MESSAGES, 9 | Permissions.FLAGS.VIEW_CHANNEL, 10 | Permissions.FLAGS.EMBED_LINKS, 11 | Permissions.FLAGS.MANAGE_MESSAGES, 12 | ], 13 | user: [Permissions.FLAGS.MANAGE_MESSAGES], 14 | }, 15 | aliases: [], 16 | 17 | /** 18 | * 19 | * @param {Client} client 20 | * @param {Message} message 21 | * @param {STring[]} args 22 | */ 23 | execute: async (client, message, args) => { 24 | const amount = parseInt(args.join(" ")); // Amount of messages which should be deleted 25 | if (!amount) 26 | return message.reply( 27 | "You haven't given an amount of messages which should be deleted!" 28 | ); // Checks if the `amount` parameter is given 29 | // @ts-ignore 30 | if (isNaN(amount)) 31 | return message.reply("The amount parameter isn`t a number!"); // Checks if the `amount` parameter is a number. If not, the command throws an error 32 | 33 | if (amount > 100) 34 | return message.reply("You can`t delete more than 100 messages at once!"); // Checks if the `amount` integer is bigger than 100 35 | if (amount < 1) 36 | return message.reply("You have to delete at least 1 message!"); // Checks if the `amount` integer is smaller than 1 37 | 38 | await message.channel.messages.fetch({ limit: amount }).then((messages) => { 39 | // Fetches the messages 40 | // @ts-ignore 41 | message.channel.bulkDelete( 42 | messages // Bulk deletes all messages that have been fetched and are not older than 14 days (due to the Discord API) 43 | ); 44 | }); 45 | 46 | const embed = new MessageEmbed() 47 | .setTitle(`Purged ${amount} messages`) 48 | .setColor("RED"); 49 | 50 | message.channel.send({ embeds: [embed] }); 51 | }, 52 | }; 53 | -------------------------------------------------------------------------------- /src/events/messageCreate.js: -------------------------------------------------------------------------------- 1 | require("dotenv").config(); 2 | const { Client, Message } = require("discord.js"); 3 | 4 | /** 5 | * 6 | * @param {Client} client 7 | * @param {Message} message 8 | */ 9 | 10 | module.exports = async (client, message) => { 11 | if (!message.guild || message.author.bot) return; 12 | const prefix = process.env.PREFIX; 13 | if (!message.content.startsWith(prefix)) return; 14 | 15 | const args = message.content.slice(prefix.length).trim().split(/ +/); 16 | const commandName = args.shift().toLowerCase(); 17 | const command = 18 | client.commands.get(commandName) || 19 | client.commands.find((x) => x.aliases && x.aliases.includes(commandName)); 20 | 21 | if (!command) return; 22 | 23 | if (!message.channel.permissionsFor(client.user).has(command.perms.client)) 24 | return message.channel 25 | .send({ 26 | content: `Missing Permission: ${command.perms.client 27 | .join(", ") 28 | .toLowerCase()}`, 29 | }) 30 | .catch(() => {}); 31 | 32 | if (!message.channel.permissionsFor(message.member).has(command.perms.user)) 33 | return message.channel 34 | .send({ 35 | content: `You don't have enough permission to execute this command.`, 36 | }) 37 | .catch(() => {}); 38 | 39 | try { 40 | command.execute(client, message, args, prefix); 41 | } catch (error) { 42 | console.error(error); 43 | await message.channel.send({ 44 | content: "An unexpected error occured!", 45 | }); 46 | } 47 | }; 48 | -------------------------------------------------------------------------------- /src/events/messageReactionAdd.js: -------------------------------------------------------------------------------- 1 | const { Client, MessageEmbed } = require("discord.js"); 2 | 3 | /** 4 | * 5 | * @param {Client} client 6 | * @param {NoIdea} payload 7 | */ 8 | 9 | module.exports = async (client, payload, user) => { 10 | const content = await payload.message.content 11 | const emoji = await payload.emoji.name 12 | const author = await payload.message.author 13 | 14 | if (content) { 15 | if ("🔖📑".includes(emoji)) { 16 | const em = new MessageEmbed() 17 | .setDescription(` 18 | **From: <@${author.id}> ** 19 | 20 | ${content} 21 | `) 22 | .setColor("RED") 23 | await user.send({embeds: [em]}) 24 | } 25 | } 26 | }; 27 | -------------------------------------------------------------------------------- /src/events/raw.js: -------------------------------------------------------------------------------- 1 | const { Client } = require("discord.js"); 2 | 3 | /** 4 | * 5 | * @param {Client} client 6 | * @param {Packet} packet 7 | */ 8 | 9 | module.exports = async (client, packet) => { 10 | if (!['MESSAGE_REACTION_ADD'].includes(packet.t)) return; 11 | const channel = client.channels.cache.get(packet.d.channel_id); 12 | if (channel.messages.cache.has(packet.d.message_id)) return; 13 | 14 | channel.messages.fetch(packet.d.message_id).then(message => { 15 | const emoji = packet.d.emoji.id ? `${packet.d.emoji.name}:${packet.d.emoji.id}` : packet.d.emoji.name; 16 | const reaction = message.reactions.cache.get(emoji); 17 | if (reaction) reaction.users.cache.set(packet.d.user_id, client.users.cache.get(packet.d.user_id)); 18 | 19 | if (packet.t === 'MESSAGE_REACTION_ADD') { 20 | client.emit('messageReactionAdd', reaction, client.users.cache.get(packet.d.user_id)); 21 | } 22 | }); 23 | }; 24 | -------------------------------------------------------------------------------- /src/events/ready.js: -------------------------------------------------------------------------------- 1 | const { Client } = require("discord.js"); 2 | 3 | /** 4 | * 5 | * @param {Client} client 6 | */ 7 | 8 | module.exports = async (client) => { 9 | client.user.setPresence({ 10 | status: "online", 11 | activities: [ 12 | { 13 | name: "the prefix . | .help", 14 | type: "PLAYING", 15 | }, 16 | ], 17 | }); 18 | console.log(`[ API ] Logged in as ${client.user.tag}`); 19 | }; 20 | -------------------------------------------------------------------------------- /src/example.env: -------------------------------------------------------------------------------- 1 | TOKEN = 2 | PREFIX = -------------------------------------------------------------------------------- /src/handlers/client.js: -------------------------------------------------------------------------------- 1 | const { Client, Collection } = require("discord.js"); 2 | 3 | /** 4 | * 5 | * @param {Client} client 6 | */ 7 | 8 | module.exports = async (client) => { 9 | client.commands = new Collection(); 10 | client.slashcommands = new Collection(); 11 | client.config = require("dotenv").config(); 12 | 13 | // if (!client.config.token || !client.config.prefix) 14 | // throw new Error("Please provide the required things in config.json"); 15 | }; 16 | -------------------------------------------------------------------------------- /src/handlers/commands.js: -------------------------------------------------------------------------------- 1 | const { readdirSync } = require("fs"); 2 | const { Client } = require("discord.js"); 3 | 4 | /** 5 | * 6 | * @param {Client} client 7 | */ 8 | 9 | module.exports = async (client) => { 10 | readdirSync("./commands/").forEach((dir) => { 11 | const commandFiles = readdirSync(`./commands/${dir}/`).filter((files) => 12 | files.endsWith(".js") 13 | ); 14 | 15 | for (const file of commandFiles) { 16 | const command = require(`../commands/${dir}/${file}`); 17 | // if (!command.name) throw new Error("Please provide a command name."); 18 | // if (!command.description) 19 | // if (!command.description) 20 | // throw new Error("Please provide a command description."); 21 | 22 | client.commands.set(command.name, command); 23 | console.log(`Command Loaded: ${command.name} (${dir})`); 24 | } 25 | }); 26 | 27 | client.on("ready", () => { 28 | console.log(`Total Commands Loaded: ${client.commands.size}`); 29 | }); 30 | }; 31 | -------------------------------------------------------------------------------- /src/handlers/events.js: -------------------------------------------------------------------------------- 1 | const { Client } = require("discord.js"); 2 | const { readdirSync } = require("fs"); 3 | 4 | /** 5 | * 6 | * @param {Client} client 7 | */ 8 | 9 | module.exports = async (client) => { 10 | const files = readdirSync("./events/").filter((files) => 11 | files.endsWith(".js") 12 | ); 13 | for (const file of files) { 14 | const events = require(`../events/${file}`); 15 | client.on(file.split(".")[0], events.bind(null, client)); 16 | console.log(`Event Loaded: ${file.split(".")[0]}`); 17 | } 18 | }; 19 | -------------------------------------------------------------------------------- /src/handlers/slash_commands.js: -------------------------------------------------------------------------------- 1 | const { Client } = require("discord.js"); 2 | const { readdirSync } = require("fs"); 3 | 4 | /** 5 | * 6 | * @param {Client} client 7 | */ 8 | 9 | module.exports = async (client) => { 10 | const array = []; 11 | readdirSync("./application_commands/").forEach((dir) => { 12 | const commands = readdirSync(`./application_commands/${dir}/`).filter( 13 | (files) => files.endsWith(".js") 14 | ); 15 | for (const file of commands) { 16 | const command = require(`../application_commands/${dir}/${file}`); 17 | if (!command.name) throw new Error("Please provide a slash command name"); 18 | if (!command.description) 19 | throw new Error("Please provide a slash command description"); 20 | 21 | client.slashcommands.set(command.name, command); 22 | array.push(command); 23 | console.log(`Application (/) Command Loaded: ${command.name} (${dir})`); 24 | } 25 | }); 26 | 27 | client.on("ready", async () => { 28 | await client.application.commands 29 | .set(array) 30 | .then(async () => { 31 | console.log( 32 | `Total Application (/) Commands: ${client.slashcommands.size}` 33 | ); 34 | }) 35 | .catch(() => {}); 36 | }); 37 | }; 38 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | const { Client } = require("discord.js"); 2 | require("dotenv").config(); 3 | const client = new Client({ 4 | intents: [ 5 | "GUILDS", 6 | "GUILD_BANS", 7 | "GUILD_INVITES", 8 | "GUILD_MEMBERS", 9 | "GUILD_MESSAGES", 10 | "GUILD_MESSAGE_REACTIONS" 11 | ], 12 | allowedMentions: { 13 | parse: ["everyone", "roles", "users"], 14 | repliedUser: true, 15 | }, 16 | partials: ["CHANNEL", "GUILD_MEMBER", "MESSAGE", "REACTION", "USER"], 17 | }); 18 | 19 | //Handlers 20 | require("./handlers/client")(client); 21 | require("./handlers/events")(client); 22 | require("./handlers/commands")(client); 23 | // require("./handlers/slash_commands")(client); 24 | 25 | client.login(process.env.TOKEN); 26 | -------------------------------------------------------------------------------- /src/slash_commands/Fun/say.js: -------------------------------------------------------------------------------- 1 | const { CommandInteraction, Client } = require("discord.js"); 2 | 3 | module.exports = { 4 | name: "say", 5 | description: "To say or repeat something you say.", 6 | options: [ 7 | { 8 | name: "message", 9 | required: true, 10 | type: "STRING", 11 | description: "The message content.", 12 | }, 13 | { 14 | name: "channel", 15 | required: false, 16 | type: "CHANNEL", 17 | description: "The message channel.", 18 | }, 19 | ], 20 | 21 | /** 22 | * 23 | * @param {Client} client 24 | * @param {CommandInteraction} interaction 25 | */ 26 | 27 | execute: async (client, interaction) => { 28 | const msg = interaction.options.data[0].value; 29 | if (interaction.options.data[1]) { 30 | await interaction 31 | .deferReply({ 32 | ephemeral: true, 33 | }) 34 | .catch(() => {}); 35 | const channel = interaction.guild.channels.cache.get( 36 | interaction.options.data[1].channel.id 37 | ); 38 | if (!channel) 39 | return interaction.followUp({ 40 | content: `Unable to find the given channel.`, 41 | }); 42 | 43 | if (channel.type !== "GUILD_TEXT") 44 | return interaction.followUp({ 45 | content: `Please provide a text channel.`, 46 | }); 47 | 48 | await channel 49 | .send({ 50 | content: `${msg}`, 51 | }) 52 | .then(async () => { 53 | await interaction.editReply({ 54 | content: `The message has been send to ${channel}`, 55 | }); 56 | }); 57 | } else { 58 | await interaction.deferReply().catch(() => {}); 59 | await interaction.editReply({ 60 | content: `${msg}`, 61 | }); 62 | } 63 | }, 64 | }; 65 | --------------------------------------------------------------------------------