owengombas / discord.ts

🤖 Create your discord bot by using TypeScript and decorators!

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@Command breaks @On('message')

sk-1982 opened this issue · comments

Version 4.0.6
Adding a message event listener works as expected:

@Discord('<')
export abstract class AppDiscord {
  @On("message")
  private async onMessage(
    [message]: ArgsOf<"message">,
    client: Client
  ) {
    console.log(message.content);
  }
}

But when a Command is defined, all message event listeners break

@Discord('<')
export abstract class AppDiscord {
  @On("message")
  private async onMessage(
    [message]: ArgsOf<"message">,
    client: Client
  ) {
    console.log(message.content);
  }
  
  @Command('command')
  private async command(message: CommandMessage, client: Client) {
      console.log('command');
  }
}

Expected: message.content and 'command' logged when <command typed in chat and message.content logged for other messages
Actual: onMessage is never called and message.content is never logged

The command doesn't need to be defined in the same class; @Command annotations anywhere immediately break all other @On('message') annotations in the project.

Thank's for reporting the issue, I'm working on it, It will be fixed very soon ! (You can join the Discord server to follow the process)

Fixed (v4.0.7) ! You can run npm upgrade
Thank's for you contribution