gram-js / gramjs

NodeJS/Browser MTProto API Telegram client library,
MIT License
1.28k stars 179 forks source link

telegram bot #355

Closed Vo0oX closed 2 years ago

Vo0oX commented 2 years ago

Hi. I want to make a telegram bot for myself to copy data from the bottom of the group to another. (I achieved the result of copying, now I want to automate everything.)

what's the question?

phoneCode: async () => await input.text - in this.

i am using node-telegram-bot-api to write a bot.

But I still don’t understand how I can send a message from the bot instead of input.text (bot.on('message', msg => {})

my bot asks me step by step - phone number, password. how to do something like this?

await client.start({ phoneNumber: '+380634959958', phoneCode: async () => await input.text("Please enter CODE: ").then(bot.on('message', msg => { helper.switchState(msg.chat.id, 'password_received_wait'); return msg.text }))

I want to send the code that telegram sends through my telegram bot

painor commented 2 years ago

it's still not very clear what you want to do. do you want to login using a bot?

there are some examples on how to manually call these methods perhaps you want to use them https://github.com/gram-js/gramjs/blob/master/examples/expressExample/lowLevel.js#L86 ?

Vo0oX commented 2 years ago

want to create a bot using "node-telegram-bot-api"

which got gramjs login input ( phoneNumber, password,phoneCode)

painor commented 2 years ago

I think the example I sent might help you. it's similar but it's using express framework instead of a bot.

Vo0oX commented 2 years ago

Thanks