Core: complete beginners giude?

Created on 2 Jul 2017  路  11Comments  路  Source: php-telegram-bot/core

  • Operating system: CentOS 7.3
  • PHP version: 5.6
  • PHP Telegram Bot version: 0.45.0
  • Using MySQL database: yes
  • MySQL version: 5.5
  • Update Method: Webhook
  • Self-signed certificate: no

btw i followed the readme.md steps and i did exact same things! but what i should do now?
i want to get user inputs and answer to them with some default messages
and after checking some conditions, show and hide some keyboard buttons

but i dont now how to do that!

actually i'm noob at this,
i dont know anything about how it works!
also the readme.md file is have so little information.. actually it's not a guide!

i already have ssl and iwant to know how to get updates using webhook!
and how to use mysql CRUD in this library?
is there any compelete beginner's guide?
i really need it
thanks

Most helpful comment

Better would be to use the webhook, if you can. Otherwise you will have to execute the getUpdatesCLI.php in a loop, to make sure that there is no delay for users.

All 11 comments

hi @jacklul
thanks for the link..
can you write an example that how i should create my project?
i mean do i need to control inputs using normal getupdates? (curl)
when i can use this library to get user inputs and reply them?
and how?

i don't know if is it possible to get all inputs using this library?? if yes: how?
i already using example code that gives me this:
./getUpdatesCLI.php 2017-07-03 08:28:27 - Processed 0 updates

but i want to control inputs

save some of them inside database and show some buttons and keyboard..
please help me

You can control inputs by using custom commands.

To test this, you can add some custom commands (from the example-bot repo that @jacklul linked above), for example the WhoamiCommand.php one, to a Commands folder in your project.
Then add that folder to your code using $telegram->addCommandsPath(__DIR__ . '/Commands');.

You can then send /whoami to your bot and call your getUpdatesCLI.php script.
The bot will then process your message and send you a reply.

Also, you will see the output of the command change to Processed 1 updates.

From there I suggest you play around with the /whoami command file to see how it works.

@noplanman hi
thanks for the relpy

ok i got it, i did what you said about Processed 1 updates. and it works.
but Commands? i think dunno know what should i exactly do..

can you tell my what i should do step by step?
thanks

I suggest you have a look at the updated guide to creating custom commands.

If you need any extra info, ask again :smiley:

thanks a lot man馃榿
it just work's well

but wait 馃槕
one other thing..
already i should refresh my:https:://mydomain.ext/getUpdateCLI.php to send an answer
how i can doing it automatically?

and another thing 馃檪
how i can add keyboard for an authentication process?
i want to get some inputs from user and check them in the DB and if they're right, then change the keyboard and...

thanks

As instructed on https://github.com/php-telegram-bot/core#getupdate-installation

give the file permission to execute:

chmod 775 getUpdateCLI.php

then run

./getUpdateCLI.php

So you should connect to your server and run the getUpdateCLI.php using the command line.

Better would be to use the webhook, if you can. Otherwise you will have to execute the getUpdatesCLI.php in a loop, to make sure that there is no delay for users.

hello again my friends @noplanman and @haiksu

i've payed for ssl and i have it, so i like to use it
can you help me how?

@666b666 easiest if you get in touch via Telegram, my username there is @noplanman

Webhook installation is explained here by the way:
https://github.com/php-telegram-bot/core#webhook-installation

i tried that but it says "you can only send messages to mutual contacts at the moment"
my username is: yumji

Was this page helpful?
0 / 5 - 0 ratings