A tool for sending fast and managed messages to Telegram bot users

Overview

๐Ÿ‘‹๐Ÿป HiToAll

A tool for sending fast and managed messages to Telegram bot users

About

In some telegram bots programmed with php language, if there are many users of the bot, the bot will have trouble sending public messages to users and because the number of requests increases, it causes the timeout source to be sent and the message is not sent to all users. Using the simple HiToAll tool, this problem can be solved and messages can be managed in a timely manner.

Getting started

To use HiToAll, you need your bot database to use mysql. First you need to define your database information in an array:

include('hitoall.php');

define('API_KEY', ''); // Bot token

define('MYSQLI', [
    'host'=> 'localhost',
    'username'=> 'database_username',
    'password'=> 'database_password',
    'name'=> 'database_name'
]);

You then need to create a 1 minute cron job on the loop.php file. This cron job is used to manage posts per minute. You can use cron-job.org to add a cronjob, or enter the following command in the server's cronjob settings:

php -q /home/path/to/loop.php

Add to Queue

To create a new message in the send queue, just enter the sending method and information in the following format:

  • Note: In the fields where you need to enter the user's chat id, enter the phrase [*USER*]. This phrase will be replaced when sending.
// Add a new message to the queue to send to all bot users
HiToAll('sendMessage',[
    'chat_id'=>'[*USER*]',
    'text'=>'Hello Everyone!'
], $api_key=API_KEY, $mysqli=MYSQLI);

Your message will be in the queue and finally after 1 minute sending to all members of the bot will begin. Messages will be sent to 50 members of your bot every minute.

Get sending Queue

When you add a send to the queue, the id value is also returned. You can use this code to receive a list of all active sends:

// Get a array of contents waiting to be sent
$list = HiToAll('list', $api_key=API_KEY, $mysqli=MYSQLI)['list'];

Get a send info from Queue

You can use this code to receive the basic information of a post from the queue :

// Get a send with ID '15978'
$id = 15978;
$info = HiToAll('get', ['id'=>$id], $api_key=API_KEY, $mysqli=MYSQLI);

$sends = $info['send']; // Number of sends so far
$method = $info['type']; // Get send method (example: sendMessage, ...)

Remove from sending Queue

To delete or cancel a post from the queue, you can use this code:

// Delete a send with ID '15978'
$id = 15978;
HiToAll('remove', ['id'=>$id], $api_key=API_KEY, $mysqli=MYSQLI);

Adjusting the user table

The table where the user list is located is user by default, but you can set this using the users_table argument:

HiToAll('list', $users_table='botusers', $api_key=API_KEY, $mysqli=MYSQLI);

Also, the structure in which users chat id is located is on id by default. If you want to configure this manually, you can use the chatid_structure argument:

HiToAll('list', $chatid_structure='userid', $api_key=API_KEY, $mysqli=MYSQLI);
You might also like...
 Telegram bot for CC Checker with hella lotta features.
Telegram bot for CC Checker with hella lotta features.

SDMN CHECKER BOT Telegram bot for CC Checker with hella lotta features. ๐Ÿ“ Table of Contents Dependencies / Limitations Future Scope Setting up a Hero

Integrate Your PHP Code With Telegram Bot API for Beginner

Documentation[https://core.telegram.org/bots/api] Resource[https://github.com/bachors/KBBI.sql] Integrate Your PHP Code With Telegram Bot API for Begi

Simple telegram auto reminder BOT with PHP

Telebot Script Telegram BOT Auto Reminder Dibuat pake PHP OOP Sebenernya bukan buat dipublish sih, ini cuma buat praktek PHP OOP sama praktek Commit &

Simple php telegram bot.
Simple php telegram bot.

PHPTGBot Description Simple php telegram bot. Just for fun ๐Ÿšง Work In Progress ๐Ÿšง Maybe found error, since im not tested yet! Still on working, so be

A simple php telegram bot to check if the bin is valid or not!

Bin-Checker A simple php telegram bot to check if the bin is valid or not! Deploy FORK the Repo by clicking HERE Add your bot token in LINE 12 THEN DE

Bin checker telegram bot
Bin checker telegram bot

BIN Checker Bot Test Bot: Bin Checker Bot Env API_TOKEN Bot token. START_MSG Custom start message. Deploy Heroku Railway โš  Warn: Still not Tested on R

This app remembers todo list in every specified time (e. every minute, hour, day etc) through telegram bot

remember_todo_list This app remembers todo list in every specified time (e. every minute, hour, day etc) through telegram bot This project includes tw

PHP Source - Telegram Bot - Standart Method

Telegram Bot- yaratish uchun mo'ljallangan standart metod asosida ishlovchi, PHP tilida yozilgan kod Dasturchilarning eng yaxshi ko'rgan odati c/p bo'

The Telegram bot framework that doesn't drive you nuts.
The Telegram bot framework that doesn't drive you nuts.

Nutgram The Telegram bot framework that doesn't drive you nuts This framework takes advantage of the latest PHP 8 features, and tries to make the spee

Releases(0.1)
Owner
Matin Najafi
I am a developer in high-school who is interested in mathematics and developing various projects :) My social networks are included in my GitHub profile link
Matin Najafi
PHP Telegram Bot based on the official Telegram Bot API

PHP Telegram Bot based on the official Telegram Bot API

null 4 Dec 8, 2021
A Discord bot that rewards players in Minecraft for sending messages on Discord

MCRewards-Discord-Bot A Discord bot that rewards players in Minecraft for sending messages on Discord How to setup: Download this git as a .zip, or cl

null 3 Dec 26, 2021
๐Ÿค– Telegram Bot API PHP SDK. Lets you build Telegram Bots easily! Supports Laravel out of the box.

Telegram Bot API - PHP SDK Telegram Bot PHP SDK lets you develop Telegram Bots in PHP easily! Supports Laravel out of the box. Telegram Bot API is an

Irfaq Syed 2.5k Jan 6, 2023
SimSimi Bot - a Telegram ChatBot like the old SimSimi app that simulates a normal chat experience, created directly by users

SimSimi Bot - a Telegram ChatBot like the old SimSimi app that simulates a normal chat experience, created directly by users

NeleB54Gold 4 Oct 21, 2022
Create and manage advanced polls with this Telegram Bot which has many features available!

MasterPollBot Create and manage advanced polls with this Telegram Bot which has many features available! Requirements Local Telegram Bot API or a webh

NeleB54Gold 7 Oct 21, 2022
Easy to install email tracker with gui and telegram api bot with date device & ip tracking,

mail-php-tracking-with-gui ?? Simple mail tracking program that uses php, html, telegram bot, and a gui The gui The gui lets you create specific links

null 7 Dec 20, 2022
A telegram bot to check credit cards. written in php & py

MRBANKER BOT A telegram bot to check credit cards. written in php & py. You can find me on telegram STEP1: goto botfather create a bot copy the token

Nitin1818 48 Dec 30, 2022
NovaGram - An elegant, Object-Oriented, reliable PHP Telegram Bot Library

An elegant, Object-Oriented, reliable PHP Telegram Bot Library Full Documentation โ€ข Public support group Examples โ€ข Features โ€ข Installation ?

Gaetano 165 Jan 6, 2023
telegram bot for sell virtual number

Telefake Telegram bot for sell virtual number (fully automatic) Installation create bot in telegram upload script in website with php and ssl (https)

reza malekpour 4 Aug 20, 2022
laravel package untuk memudahkan penggunaan MCA dengan Telegram Bot USDI di aplikasi Universitas Udayana.

MCA KubeMQ Laravel laravel package untuk memudahkan penggunaan MCA dengan Telegram Bot USDI di aplikasi Universitas Udayana. Motivasi Proyek ini berfu

Ristek USDI 1 Nov 17, 2021