Follow the instuctions on how to install and integrate the backend bot to your current system.
Let's get started then! 😃
To start off, you can clone this repository using git:
$ git clone https://github.com/ahmedrhuma/libyantrader-telegram-bot.git
We use composer
, you can download the dependencies using it.
composer.phar install
Structure This is the files structure, and what each file contains.
composer.json
(Describes the project and it's dependencies)set.php
(Used to set the webhook)unset.php
(Used to unset the webhook)hook.php
(Used for the webhook method)config.php
(used to held the config params)test.php
(Showcase on how to use the API out of commands context)Commands
(used to held all the commands under the hood work)
create a new database (utf8mb4_unicode_520_ci), import structure.sql.
Edit the database connection on config.php
file
$mysql_credentials = [
'host' => 'localhost',
'user' => 'root',
'password' => '',
'database' => 'telegram',
];
Change the authentication token and bot name on config.php
file.
$bot_api_key = 'TOKEN_HERE';
$bot_username = 'BOT_NAME';
After getting the telegram user ID, you can set some users as admins, so they can run admin commands, set the user admins ID on config.php
$admin_users = [
ID_HERE,
ID_TWO
...etc
]
Set the URl for the hook on config.php
file.
$hook_url = 'https://your_path/hook.php';
To activate the bot and to be able to recieve messages from telegram you need to register the bot.
just go to the link https://YOURLINK.com/set.php
and all done the bot is registered.
To unregister the bot "it will no longer recieve updates from telegram you can visit the link https://YOURLINK/unset.php
THE LINKS SHOULD NOT BE PUBLICLY ACCESSABLE
All Business logic related queries can be found on Commands/LibyanTrader.php
class.
it's has the inline comments describes the inputs and the outputs needed.
DO NOT CHANGE OTHER FILES UNDRE Commands
FOLDER
- login
- Logout
- AuthorizedData
- transferToAccount
- withdrawalRequest
- getSummary
- getResult
- contact
- sendMessageWithPhoto
- sendMessageWithPictureToMany
- sendMessage
- sendMessageToMany
Performs login request, the unique user ID's are $user_id
and $telegram_id
performs logout request, must clear the data
Checks if the user is already authenticated or not, by checking the telegram $user_id
and $chat_id
if they exists.
Performs internal transfer request
Performs withdrawal request
Get account summary, current balance and holder name.
Get the last performance result.
Contact us form result
Send Message with picture to specific user
Send message to specific user
send message to multiple users
send message to multiple users
You can check the file test.php
to see how to send message to particular user using $chat_id
.