Skip to content

Expose the message type to on('message') #409

@jlsjonas

Description

@jlsjonas

Feature Request

I have:

  • searched for such a feature request ( enhancement ) and found none

Introduction

Especially useful for logging/tracking purposes, expose the message type to the message event, avoiding code duplication just to find out the message type

Example

bot.on('message', function onMessage(msg) {
  botan.track(msg, (msg.text)?msg.text.split(' ')[0]:msg.type);
}

(example using botanio, but would be applicable to pretty much any tracking library/system, the msg.text part is added as a more complete example, to track commands)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions