Good evening (or morning) I'm learning how to create a bot

and I can't find anything about using more methods (i.e.: sendMessage) or using the same method many times for each request while using webhook
Can you help me?

I don't know if I wrote bad my code or if the bot can't use many methods for each request with webhook

For example, if a user writes "/ start", can my bot sends back 2 or more messages?

9 ответов

12 просмотров

how does your code look like?

yes, you can

Ugo Pesce-- Cum Monster Автор вопроса
dotvhs
how does your code look like?

At the moment it can just tell you if you are in my database or not and if not it will write id, nick, name and lastname on the db

Ugo Pesce - Cum Monster
At the moment it can just tell you if you are in m...

can you show your code? part where you're trying to send the message

Ugo Pesce-- Cum Monster Автор вопроса
dotvhs
can you show your code? part where you're trying t...

Not at the moment, my password is in my pc and i can't use it right now Anyway, it sends sendMessage method using header() I wrote it in php

By webhook url the bot can't reply to user You need to use api send message For automatic reply by bot if someone send /start you need to make a script and host it on heroku or something else

Ugo Pesce-- Cum Monster Автор вопроса
ッ Marshmallow 🎀 ❦ ᵐⁱˢˢ Σ ᶜᵒˡˡᵉᵍⁱᵃⁿ ᵃⁿᵈ ᵍᵃᵐᵉʳ 👱🏻‍♀ 🦋²⁰²²ᵗʰ 🎀 🧞‍♀️×͜×
By webhook url the bot can't reply to user You nee...

Of course i have to use sendMessage method and I'm hosting the bot in a free server (low quality but it's perfect for testing and learning) At the moment, if you start the bot it send you a message and write some stuff on my database, but at the moment the bot can't send 2 or more messages for each command/message

Ugo Pesce - Cum Monster
Of course i have to use sendMessage method and I'm...

Actually sending msg has nothing to do with user sending u msg (as long as they started the bot before, otherwise u can still send the msg but they wont receive it, and besides that in order to your code gets triggered/run it needs some update such as user msg so TG calls ur webhook) u can just send a msg using ur browser to a chat given this, in ur method, whenever user sent u /start u just make 2 GET request to the sendMessage API method

Похожие вопросы

Карта сайта