{"id":15710157,"url":"https://github.com/yuko1101/discord.js-core","last_synced_at":"2025-05-07T14:46:47.874Z","repository":{"id":45981141,"uuid":"464021204","full_name":"yuko1101/discord.js-core","owner":"yuko1101","description":"A simple bot handler for discord.js","archived":false,"fork":false,"pushed_at":"2024-07-01T16:01:05.000Z","size":574,"stargazers_count":5,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-10T02:57:03.618Z","etag":null,"topics":["bot","discord","discord-api","discord-bot","discord-bot-framework","discord-js","discord-js-v13","discord-js-v14","discordapp","library","nodejs","wrapper"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/discord.js-core","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yuko1101.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-27T02:52:15.000Z","updated_at":"2024-05-18T06:56:45.000Z","dependencies_parsed_at":"2024-01-13T11:18:38.499Z","dependency_job_id":"dcd4c63e-74f2-476a-93f3-e072c92d873a","html_url":"https://github.com/yuko1101/discord.js-core","commit_stats":{"total_commits":161,"total_committers":2,"mean_commits":80.5,"dds":"0.018633540372670843","last_synced_commit":"d21d9caad40e2db45fdd1fcce4546e6b8d5f4d94"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuko1101%2Fdiscord.js-core","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuko1101%2Fdiscord.js-core/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuko1101%2Fdiscord.js-core/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuko1101%2Fdiscord.js-core/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yuko1101","download_url":"https://codeload.github.com/yuko1101/discord.js-core/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252898612,"owners_count":21821655,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot","discord","discord-api","discord-bot","discord-bot-framework","discord-js","discord-js-v13","discord-js-v14","discordapp","library","nodejs","wrapper"],"created_at":"2024-10-03T21:04:02.799Z","updated_at":"2025-05-07T14:46:47.827Z","avatar_url":"https://github.com/yuko1101.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# discord.js-core\nA simple bot handler for [discord.js/v14](https://github.com/discordjs/discord.js)\n\n### Features\n - Easy Application Commands (including easy AutoCompleters)\n - Easy Customizable MessagePages\n - Easy Actions (EmojiAction, ButtonAction, SelectMenuAction)\n - Easy to combine Actions and a message (called MessageCore)\n\n## Installation\nRun `npm install discord.js-core` in the terminal.  \n\n## Set-up\nCreate `index.js` file and edit it.\n\n```js\nconst { Core } = require(\"discord.js-core\");\n\nconst core = new Core({\n\n    /* discord.js client options */\n\n    // MessageContent requires to be enabled on the application developer portal (https://discord.com/developers/applications/)\n    intents: [\"Guilds\", \"GuildMessages\", \"GuildMessageReactions\", \"MessageContent\"],\n    allowedMentions: { repliedUser: false }, // Disable mention on reply (Recommended)\n\n\n    /* discord.js-core core options */\n\n    prefix: \"!\", // message command prefix\n    guildId: \"Your Guild ID\", // if not provided, your commands will be applied to global (to all guilds, DMs, and groups)\n    token: \"Your Token\",\n    // debug mode, which enables you to develop your bot more easily. (e.g. All commands have \"dev-\" at the head of their name in debug mode)\n    // when `devMode` is true, `guildId` or `devGuild` must be provided.\n    devMode: false,\n});\n\ncore.login();\n```\nRun the index.js with `node .` or `node index.js` in the terminal,\nand you will find the bot is online.\n\n## Commands\nYou can handle *SlashCommand*, *MessageCommand* and *ContextMenu* in a single code.\n\n### Import the Command class\n```js\nconst { Command } = require(\"discord.js-core\");\n// or in ESM, import { Command } from \"discord.js-core\";\n```\n\n### Code a command\nLet's code your own command.\n\nHere is an example of commands.\n\n```js\nconst command = new Command({\n    name: \"mention\",\n    description: \"Mentions a user\",\n    messageCommandAliases: [\"m\"], // aliases for MessageCommand\n    args: {\n        \"target\": {\n            type: ApplicationCommandOptionType.User,\n            description: \"The user to mention\",\n            required: true,\n            messageCommand: true, // if this option is also for MessageCommand, set this to true; otherwise, set this to false\n        },\n    },\n    supportsMessageCommand: true,\n    supports: [\"USER_CONTEXT_MENU\", \"SLASH_COMMAND\"], // Types of commands which this command supports\n    run: async (ic, args) =\u003e {\n        // Type of ic is InteractionCore, which can combine Message and Interaction.\n        // You can reply to Message or Interaction in the same method with InteractionCore.\n\n        // If the interaction is from UserContextMenu, target id is in ic.contextMenuUser (If from MessageContextMenu, in ic.contextMenuMessage)\n        const target = ic.contextMenuUser ?? args[\"target\"];\n        if (!target) return ic.reply({ content: \"Target user not found\" }); // Send reply message\n\n        const mention = `\u003c@${target.id}\u003e`;\n        await ic.reply({ content: mention }); // Send reply message\n    },\n});\n```\nThis command enables users to mention a specific user by using slash command, message command, or context menu.\n\n**And DO NOT forget to register your commands.**\n```js\ncore.addCommands(command);\n```\n---\n### Registering multiple commands from directory\nYou can also add commands from command directory.\n\nCreate \"commands\" folder, and a file for each command.\n\nThe contents of the file are as follows.\n\n###### commands/test_command.js\n```js\nconst { Command } = require(\"discord.js-core\");\nmodule.exports = new Command(...);\n\n// or in ESM\n// import { Command } from \"discord.js-core\";\n// export default new Command(...);\n```\n\n#### Register the commands in \"commands\" directory to core\n```js\ncore.addCommandsInDir(\"commands\");\n```\n\n### Apply to Discord (Adding Slash-Command and Context-Menu against Discord)\nApply registered commands with `core.applyCommands()`.\n```js\ncore.login(() =\u003e core.applyCommands()); // login, and apply commands on ready\n```\n\n\n## More examples available in example folder\nSee [example folder](example) for more examples!  \nAnd typescript example [here](example-ts)!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuko1101%2Fdiscord.js-core","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyuko1101%2Fdiscord.js-core","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuko1101%2Fdiscord.js-core/lists"}