owengombas / discord.ts

🤖 Create your discord bot by using TypeScript and decorators!
https://owencalvin.github.io/discord.ts/
325 stars 40 forks source link

Fix: regex in command tag or in rules without defined command args gave empty args array. #40

Closed Adondriel closed 3 years ago

Adondriel commented 3 years ago
  @Command(/^\?conf set ([\w.]+) (string|number|boolean) (.+)$/)
  async onSet(message: CommandMessage) {
      console.log(`args: ${JSON.stringify(message.args)}`) // {}
  }
  @Command()
  @Rules(/^\?conf set ([\w.]+) (string|number|boolean) (.+)$/)
  async onSet(message: CommandMessage) {
      console.log(`args: ${JSON.stringify(message.args)}`) // {}
  }

will now return the regex group(s) instead of an empty array.