{"id":14983512,"url":"https://github.com/spimy/kita","last_synced_at":"2026-03-17T00:35:04.559Z","repository":{"id":77562808,"uuid":"605192721","full_name":"Spimy/kita","owner":"Spimy","description":"A Discord.JS wrapper to speed up development process by getting the basics readily done. A revision of the monorepo 'yor' renamed to Kita.","archived":false,"fork":false,"pushed_at":"2023-04-11T02:57:46.000Z","size":52,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-18T04:16:37.459Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Spimy.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":"2023-02-22T16:36:42.000Z","updated_at":"2023-03-15T23:05:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"e4c979b7-5d1e-4147-be58-8a0ba555fba3","html_url":"https://github.com/Spimy/kita","commit_stats":{"total_commits":52,"total_committers":2,"mean_commits":26.0,"dds":"0.038461538461538436","last_synced_commit":"000ae9cb1c1cf016a4e0151c029f472f0df78b13"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Spimy%2Fkita","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Spimy%2Fkita/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Spimy%2Fkita/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Spimy%2Fkita/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Spimy","download_url":"https://codeload.github.com/Spimy/kita/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243012662,"owners_count":20221606,"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":[],"created_at":"2024-09-24T14:07:18.968Z","updated_at":"2025-12-25T00:06:51.221Z","avatar_url":"https://github.com/Spimy.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kita\n\nA Discord.JS wrapper to speed up development process by getting the basics readily done. A revision of the monorepo 'yor' renamed to Kita.\n\nKita was made with TypeScript in mind and is best used while coding in TypeScript for developer experience.\n\n**Further recommendation:**\n\n- Install [ts-node](https://www.npmjs.com/package/ts-node)\n- Install [nodemon](https://www.npmjs.com/package/nodemon)\n- Set up a `dev` script to run `npx nodemon src/index.ts`.\n\n## Getting Started\n\nTo create a Kita client to connect to a Discord application as a bot, simply import it, fill in the necessary constructor parameters and use the `login` method:\n\n```ts\nimport { KitaClient } from 'kita';\n\nconst client = new KitaClient({\n  root: __dirname,\n  defaults: {\n    events: {\n      interactionCreate: { enabled: true },\n      messageCreate: { enabled: true },\n      ready: {\n        enabled: true,\n        slashCommands: { register: true, guildId: 'guild_id' }\n      }\n    },\n    helpCommand: {\n      enabled: true\n    }\n  },\n  intents: ['Guilds', 'GuildMessages', 'MessageContent', 'GuildMembers']\n});\n\nclient.login('bot_token');\n```\n\nYou do not need to export the client instance as the it is automatically exposed to all commands and events you create.\n\n### KitaClient constructor properties\n\nKitaClient comes with a custom constructor parameter that extends the default `ClientOptions` constructor parameter. This means that any options that work in the default client from [Discord.JS](https://discord.js.org/#/docs/discord.js/main/typedef/ClientOptions) will also work on KitaClient.\n\n#### Root\n\nThe root property is **required** and must **always** be set to `__dirname`. This is used as a way to scan your project structure.\n\n#### Prefix\n\nThe prefix property is **optional** and it overwrites the default prefix `\u003e` for classic message commands to whichever you set this property to. You can always access the value of the prefix through the client instance: `client.prefix`.\n\n#### Defaults\n\nThe defaults property allows you to enable or disable pre-made commands or events (disabled by default).\n\nIf you enable defaults and you have your own commands or events with the same name, the defaults will be ignored.\n\n**events.interactionCreate:**\nThis will enable the default `interactionCreate` event and handle command execution only. Useful if you only need this event to handle command execution. If you need more control over this event to handle other types of interaction, leave this disabled.\n\n**events.messageCreate:**\nThis will enable the default `messageCreate` event and handle command execution only. Useful if you only need this event to handle command execution. If you need more control over this event to handle messages, leave this disabled.\n\n**events.ready:**\nThis will enable the default `ready` event. Useful if you only need this event to notify that the bot is ready and to register a slash commands. If you need more control over this event, leave this disabled.\n\n**events.ready.slashCommands.guildId:**\nOptional. If provided, slash commands will be registered for this guild only. If not provided, slash commands will be registered globally.\n\n**helpCommand:**\nThis will enable the default `help` command. Useful if you do not want to code your own help command. This is a classic message command and **NOT** a slash command. This will automatically sort commands by category. Slash commands will not be listed in the list of commands.\n\n\u003cdetails\u003e\n  \u003csummary\u003eHelp Message Preview\u003c/summary\u003e\n  \u003cimg src=\"https://static.spimy.dev/screenshots/Discord_UX5z103m60.png\" alt=\"help-embeds\" /\u003e\n\u003c/details\u003e\n\n## Project Structure\n\nYour project structure is important in order to be scanned to load commands and events you create.\n\nHere's an example of your project structure should look like:\n\n```\nmy-bot/\n├── node_modules/\n├── src/\n│   ├── commands/\n│   ├── events/\n│   └── index.ts\n├── .env\n├── .gitignore\n├── .prettierrc\n├── package.json\n├── tsconfig.json\n└── yarn.lock\n```\n\n### Commands folder\n\nThis is where all your commands you create reside in. Any sub-folders created inside will be considered a category for your command. This means that in the command info, the category will be automatically set to the sub-folder's name if it was not set when creating the command. Category is used by the default `help` command.\n\nIn the following example, `ban.ts` will be categorised as a `moderation` command:\n\n```\nsrc/\n├── commands/\n│   └── moderation/\n│       └── ban.ts\n├── events/\n└── index.ts\n```\n\nIf your bot contains both classic message commands and slash commands simultaneously, it is recommended to create a `slash` folder where you store your slash commands.\n\n### Events folder\n\nThis is where all your events you create reside in. You may categorise your events into sub-folders and they will still be scanned.\n\n## Creating Commands\n\nAll command classes should be exported as `default`. After execution of a command, always return a boolean where `true` signifies the command was executed successfully and `false` signifies that something went wrong while executing the command.\n\nIf a command execution returns `false`, the default `messageCreate` event will send a detailed help embed for that command.\n\nYou may return `true` if you handled the error within the command execution itself.\n\nThe `KitaClient` instance can be accessed by adding it to the constructor of the command. See the example in the next section.\n\n### Classic message commands\n\nTo create a classic message command, your command class must extend the `Command` class:\n\n```ts\nimport { Command, Message, KitaClient, EmbedBuilder } from 'kita';\n\nexport default class extends Command {\n  constructor(private client: KitaClient) {\n    super({\n      name: 'test',\n      description: 'A test command that replies with \"Hello World\" in an embed.',\n      aliases: ['t'],\n      usage: [\n        {\n          argument: 'custom',\n          required: false,\n          description: 'Reply with the argument instead.'\n        }\n      ]\n    });\n  }\n\n  async execute(message: Message, args: string[]): Promise\u003cboolean\u003e {\n    if (!this.client.user) return true;\n\n    const avatar = this.client.user.displayAvatarURL({ size: 1024 });\n    const embed = new EmbedBuilder()\n      .setColor('Random')\n      .setAuthor({ name: 'Test Command', iconURL: avatar })\n      .setDescription(args.join(' ') || 'Hello World')\n      .setTimestamp();\n\n    message.reply({ embeds: [embed] });\n    return true;\n  }\n}\n```\n\n### Slash commands\n\nTo create aslash command, your command class must extend the `SlashCommand` class:\n\n```ts\nimport { CommandInteraction, SlashCommand, SlashCommandBuilder } from 'kita';\n\nexport default class extends SlashCommand {\n  constructor() {\n    super({\n      ...new SlashCommandBuilder()\n        .setName('test')\n        .setDescription('Very simple test slash command replying with \"Hello World\"')\n        .setDMPermission(false)\n        .toJSON(),\n      custom: { data: 'some custom data' }\n    });\n  }\n\n  async execute(interaction: CommandInteraction): Promise\u003cboolean\u003e {\n    interaction.reply('Hello World');\n    return true;\n  }\n}\n```\n\nIn addition, you can see that the constructor can take a property called `custom`. This is useful for any additional data that your slash command may require. For example, you can set a guild id custom data so that this command can only be registered for that guild. You will need to write your own custom register commands function instead of using the one provided.\n\n## Creating Events\n\nAll command classes should be exported as `default` and should extend the `Listener` class:\n\n```ts\nimport { Listener } from 'kita';\n\nexport default class extends Listener {\n  constructor() {\n    super('ready');\n  }\n\n  async execute(): Promise\u003cany\u003e {}\n}\n```\n\nThe `KitaClient` instance can be accessed by adding it to the constructor of the event. See the example in the next section.\n\n### Register slash commands manually\n\nIf you do not wish to use the default `ready` event, slash commands will not be registered. Instead, in your custom `ready` event, import the `registerCommand` function in order to register them manually:\n\n```ts\nimport { KitaClient, Listener, registerCommands } from 'kita';\n\nexport default class extends Listener {\n  constructor(private client: KitaClient) {\n    super('ready');\n  }\n\n  async execute(): Promise\u003cany\u003e {\n    if (this.client.user) {\n      console.log(`${this.client.user.username} is now ready!`);\n    }\n    return registerCommands(this.client, 'guildId');\n  }\n}\n```\n\nThe `registerCommands` function takes an optional `guildId` parameter:\n\n```ts\nexport declare const registerCommands: (\n  client: KitaClient,\n  guildId?: string\n) =\u003e Promise\u003cvoid\u003e;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspimy%2Fkita","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspimy%2Fkita","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspimy%2Fkita/lists"}