R
R
rsoinvi2018-10-22 10:45:34
JavaScript
rsoinvi, 2018-10-22 10:45:34

How to force a bot to send a message to a channel?

I am writing a bot for a cart on a node. I use telegraph. I can't figure out how to get the bot to send a message to my channel

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
My joy, 2018-10-22
@t-alexashka

It doesn't really matter what you write on. in this case, you need to add the bot to the channel and make it an admin, with the ability to add posts. then send messages not to the bot but by channelId.

V
Vlad Maska, 2019-03-17
@VladMaska

For example, on node.js you need to make a variable with the channel id, for example:
const Channelid = [channel id];
bot.onText( '/\/write (.+), (msg, match) => {
bot.sendMessage( Channelid, match [1] );
});
/write hello world!
The channel will only contain text.
And by the way, right, before that you need to add a bot to the channel and make it an admin

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question