Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wit.message() needs a better way to pass params #189

Open
Xotl opened this issue May 27, 2019 · 0 comments
Open

Wit.message() needs a better way to pass params #189

Xotl opened this issue May 27, 2019 · 0 comments

Comments

@Xotl
Copy link

Xotl commented May 27, 2019

The problem

Currently the Wit.message() lacks support for msg_id (issue #169) & thread_id (see docs for /message).

But adding those fields will mean passing more arguments to Wit.message() and if you only need to pass just some arguments, let's say we only need message & junk you will end with something like this:

const {Wit, log} = require('node-wit');

const client = new Wit({
  accessToken: MY_TOKEN,
  logger: new log.Logger(log.DEBUG) // optional
});

client.message('set an alarm tomorrow at 7am', null, null, null, false);

Also if you want to add more supported fields the argument list will only increase, because changing the order or removing old values will break apps that already uses Wit.message().

The proposal

Make Wit.message() accepts an Object as a first argument and take the values from it, since message argument must be a string, this should be easy to implement. Also only if the first argument is an Object you should take the values from it, so we don't break apps that already use Wit.message().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant