Discord.js: Send a message with a ID from a channel or user?

Created on 7 Sep 2017  路  1Comment  路  Source: discordjs/discord.js

I want send a text to a id, but I don't know what it is. Means, that id is from a user or a channel. With discord.io this was very easy with

client.sendMessage({to: ID, message: 'message text'});

How I can send a message only with a ID with discord.js?

For a ID that is from a user:

console.log(client.channels.find('id', 'a-user-id'));
Result is "null".

console.log(client.users.find('id', 'a-user-id'));
is working.

So I must check first channel and when this is null, I must check users too? Is here a better way?

question (please use Discord instead)

>All comments

This is not the place to ask lib questions. Please join the discord server. Also read the docs carefully. You'll notice that everything is explained there!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Lombra picture Lombra  路  3Comments

shukriadams picture shukriadams  路  3Comments

Dmitry221060 picture Dmitry221060  路  3Comments

Dmitry221060 picture Dmitry221060  路  3Comments

DatMayo picture DatMayo  路  3Comments