All Projects â†’ owencalvin â†’ discord.ts

owencalvin / discord.ts

Licence: other
🤖 Create your discord bot by using TypeScript and decorators!

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to discord.ts

Discord.ts
🤖 Create your discord bot by using TypeScript and decorators!
Stars: ✭ 172 (-45.4%)
Mutual labels:  command, decorators, discord-bot
hikari-intro
An introduction to hikari, complete with different examples for different command handlers.
Stars: ✭ 17 (-94.6%)
Mutual labels:  discord-bot, slash-commands
Discord-multipurpose-bot
A repository with JavaScript and Python versions of the same type of discord commands.
Stars: ✭ 27 (-91.43%)
Mutual labels:  discord-bot, slash-commands
slash-create
🗡ī¸ Creator and handler for Discord's slash commands
Stars: ✭ 244 (-22.54%)
Mutual labels:  discord-bot, slash-commands
Music-Slash-Bot
A music bot written in Discord.js and Distube using the slash command
Stars: ✭ 34 (-89.21%)
Mutual labels:  discord-bot, slash-commands
DiscordBot-Template
A boilerplate / template for discord.js bots with 100% coverage of Discord API, command handler, error handler based on https://discordjs.guide/
Stars: ✭ 129 (-59.05%)
Mutual labels:  discord-bot, slash-commands
slash-level
✨ The first and only slash-command based Discord level bot ✨
Stars: ✭ 31 (-90.16%)
Mutual labels:  discord-bot, slash-commands
botdarr
Slack/Discord/Telegram/Matrix bot for accessing radarr, sonarr, and lidarr
Stars: ✭ 76 (-75.87%)
Mutual labels:  discord-bot
LorittaHelper
💁 Helper bot for Loritta's Support Server!
Stars: ✭ 13 (-95.87%)
Mutual labels:  discord-bot
Guildbomb-Discord-Bot
đŸ’Ŗ Guildbomb is a simple discord-bot, which shows you how easy it can be to raid a discord-server within one minute, so everybody will be banned, all emojis will be deleted, all invites will be deleted, every role and every channel too..
Stars: ✭ 182 (-42.22%)
Mutual labels:  discord-bot
command help
ℹī¸ Extract help text from builtin commands and man pages
Stars: ✭ 54 (-82.86%)
Mutual labels:  command
linux-command
âžĨ Linux å‘Ŋäģ¤æŸĨč¯ĸåˇĨå…ˇčˇ¨åšŗå°æĄŒéĸį‰ˆ
Stars: ✭ 133 (-57.78%)
Mutual labels:  command
polaris.py
A multiplatform Python bot using plugins!
Stars: ✭ 19 (-93.97%)
Mutual labels:  discord-bot
reducer-class
Boilerplate free class-based reducer creator. Built with TypeScript. Works with Redux and NGRX. Has integration with immer.
Stars: ✭ 25 (-92.06%)
Mutual labels:  decorators
Chintu-Bot
ChintuBot is a multipurpose discord bot.
Stars: ✭ 17 (-94.6%)
Mutual labels:  discord-bot
discord-api-types
Up to date Discord API Typings, versioned by the API version
Stars: ✭ 270 (-14.29%)
Mutual labels:  discord-bot
Discord-Selfbot
Discord.js selfbot
Stars: ✭ 24 (-92.38%)
Mutual labels:  discord-bot
Kreusada-Cogs
Cogs for Red-DiscordBot
Stars: ✭ 26 (-91.75%)
Mutual labels:  discord-bot
Crunchy
A Crunchyroll Inspired Discord bot, Made with <3
Stars: ✭ 13 (-95.87%)
Mutual labels:  discord-bot
horace
discord.js bot powering the Knights of Academia server with commands like info, AFK, and more
Stars: ✭ 25 (-92.06%)
Mutual labels:  discord-bot




discord.ts (@typeit/discord)

Create your discord bot by using TypeScript and decorators!


⚠ī¸ DEPRECATION & Maintained project

This repo is no longer maintained due to my studies, but a fork of the project is active and maintained by @oceanroleplay and the community. Please use their version of the project available here: github.com/oceanroleplay/discord.ts.

Known as discordx on NPM

đŸŽģ Introduction

This module is an extension of discord.js, so the internal behavior (methods, properties, ...) is the same.

This library allows you to use TypeScript decorators on discord.js, it simplify your code and improve the readability !

📜 Documentation

https://owencalvin.github.io/discord.ts/

📟 @Slash - Discord commands

Discord has it's own command system now, you can simply declare commands and use Slash commands this way

import { Discord, Slash } from "@typeit/discord";
import { CommandInteraction } from "discord.js";

@Discord()
abstract class AppDiscord {
  @Slash("hello")
  private hello(
    @Option("text")
    text: string,
    interaction: CommandInteraction
  ) {
    // ...
  }
}

Decorators related to Slash commands

There is a whole system that allows you to implement complex Slash commands

  • @Choice
  • @Choices
  • @Option
  • @Permission
  • @Guild
  • @Group
  • @Description
  • @Guard

💡@On / @Once - Discord events

We can declare methods that will be executed whenever a Discord event is triggered.

Our methods must be decorated with the @On(event: string) or @Once(event: string) decorator.

That's simple, when the event is triggered, the method is called:

import { Discord, On, Once } from "@typeit/discord";

@Discord()
abstract class AppDiscord {
  @On("message")
  private onMessage() {
    // ...
  }

  @Once("messageDelete")
  private onMessageDelete() {
    // ...
  }
}

⚔ī¸ Guards

We implemented a guard system thats work pretty like the Koa middleware system

You can use functions that are executed before your event to determine if it's executed. For example, if you want to apply a prefix to the messages, you can simply use the @Guard decorator.

The order of execution of the guards is done according to their position in the list, so they will be executed in order (from top to bottom).

Guards can be set for @Slash, @On, @Once, @Discord and globaly.

import { Discord, On, Client, Guard } from "@typeit/discord";
import { NotBot } from "./NotBot";
import { Prefix } from "./Prefix";

@Discord()
abstract class AppDiscord {
  @On("message")
  @Guard(
    NotBot, // You can use multiple guard functions, they are excuted in the same order!
    Prefix("!")
  )
  async onMessage([message]: ArgsOf<"message">) {
    switch (message.content.toLowerCase()) {
      case "hello":
        message.reply("Hello!");
        break;
      default:
        message.reply("Command not found");
        break;
    }
  }
}

📡 Installation

Use npm or yarn to install @typeit/discord@slash with discord.js

Please refer to the documentation

☎ī¸ Need help?

Simply join the Discord server

You can also find help with the different projects that use discord.ts and in the examples folder

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].