Vi ripropongo questo canale per chi vuole imparare a usare PHP per i bot Telegram, all'interno troverete guide specifiche su come inviare e ricevere file, inviare foto e molto altro
@Piaccapi
@Piaccapi
Debuggare Bot Telegram in modo semplice
Debuggare bot telegram può essere molto ostico non potendo leggere valori stampati in pagina da
Mentre si prova a mandare la variabile in chat spesso può capitare di superare il limite di 4096 char (limite di sendMessage)
Per questo ho deciso di fare una funzione per semplificare il tutto.
Descrizione:
Valori restituiti:
Sempre
- Sostituire tutti i $chat_id con i chat_id.
- Sostituire sendMessage(chat_id, text) con la vostra sendmessage, ed eventualmente aggiustare l'ordine dei parametri.
- Settare o sostituire MYID con il vostro id.
Debuggare bot telegram può essere molto ostico non potendo leggere valori stampati in pagina da
var_dump()
o simili a meno che non si simulino le richieste delle Bot API.Mentre si prova a mandare la variabile in chat spesso può capitare di superare il limite di 4096 char (limite di sendMessage)
Per questo ho deciso di fare una funzione per semplificare il tutto.
Descrizione:
bool debug ( mixed $expression [, mixed $... ] )Se esiste
$chat_id
manda il messaggio in quella chat, altrimenti lo manda al id settato alla costante MYID
Parametri:expression= La variabile che vuoi dumpare
Valori restituiti:
Sempre
true
Esempi:debug(true, $var, 123, $update);Funzione:
function debug()
{
global $chat_id;
$args = func_get_args();
if (!isset($chat_id) or $chat_id == 0 or $chat_id == '') {
$id = MYID;
} else {
$id = $chat_id;
}
foreach ($args as $debug) {
$str = var_export($debug, true);
$array_str = str_split($str, 4050);
foreach ($array_str as $value) {
sendMessage($id, 'Debug:' . PHP_EOL . $value);
}
}
return true;
}
Come adattarla per altri framework:- Sostituire tutti i $chat_id con i chat_id.
- Sostituire sendMessage(chat_id, text) con la vostra sendmessage, ed eventualmente aggiustare l'ordine dei parametri.
- Settare o sostituire MYID con il vostro id.
Forwarded from Turi Code
Si possono mandare richieste alle Bot API senza bisogno di specificare il metodo nel URL ma semplicemente mandandole con POST in RAW con l'header "Content-Type: application/json", come per il json payload, bisognerà specificare il metodo nel json; ringrazio @V1rus_Falcon per la scoperta di questa cosa non documentata.
Inoltre dopo qualche test ho scoperto che è possibile fare lo stesso mandando i parametri con una richiesta POST normale.
Inoltre dopo qualche test ho scoperto che è possibile fare lo stesso mandando i parametri con una richiesta POST normale.
Forwarded from BotNews
Bot API 4.4 has arrived.
- Added support for animated stickers.
- Added support for default permissions in any groups.
- Added support for descriptions and invite links in basic groups.
- All webhook requests from the Bot API are now coming from the subnets
- The next Bot API update (v.4.5) will allow nested MessageEntity objects, make sure your code can correctly handle such entities.
Full changelog:
https://core.telegram.org/bots/api-changelog#july-29-2019
- Added support for animated stickers.
- Added support for default permissions in any groups.
- Added support for descriptions and invite links in basic groups.
- All webhook requests from the Bot API are now coming from the subnets
149.154.160.0/20
and 91.108.4.0/22
. Update your configuration if you control inbound access with a firewall.- The next Bot API update (v.4.5) will allow nested MessageEntity objects, make sure your code can correctly handle such entities.
Full changelog:
https://core.telegram.org/bots/api-changelog#july-29-2019
core.telegram.org
Bot API changelog
The Bot API is an HTTP-based interface created for developers keen on building bots for Telegram. To learn how to create…
Forwarded from BotNews
Bot API 4.5 is here right before 2020:
- New MarkdownV2 that supports new entity types (underline andstrikethrough) and nested entities.
- New and Nested Entities in incoming messages and captions.
- Added support for custom titles in groups.
- Added new slow_mode_delay field in Chat object.
Full changelog:
https://core.telegram.org/bots/api-changelog#December-31-2019
- New MarkdownV2 that supports new entity types (underline and
- New and Nested Entities in incoming messages and captions.
- Added support for custom titles in groups.
- Added new slow_mode_delay field in Chat object.
Full changelog:
https://core.telegram.org/bots/api-changelog#December-31-2019
core.telegram.org
Telegram Bot API
The Bot API is an HTTP-based interface created for developers keen on building bots for Telegram. To learn how to create…
Forwarded from Turi Code
Parser per le nested entity delle BotAPI
Permette di formattare il testo e le entity ricevute dalle BotAPI in testo HTML
Potete provarlo usando @TuriBot e facendo /html in risposta a un messaggio formattato
https://github.com/davtur19/TelegramEntityParser
Permette di formattare il testo e le entity ricevute dalle BotAPI in testo HTML
Potete provarlo usando @TuriBot e facendo /html in risposta a un messaggio formattato
https://github.com/davtur19/TelegramEntityParser
GitHub
GitHub - davtur19/TelegramEntityParser: Parser for nested entities of Telegram Bot API
Parser for nested entities of Telegram Bot API. Contribute to davtur19/TelegramEntityParser development by creating an account on GitHub.
Forwarded from BotNews
Bot API 4.6 is here to support Polls 2.0.
• Create bots like our demo @QuizBot.
• Send new types of polls: non-anonymous, with multiple answers, and quiz-style.
• Send polls to private chats with users.
• Get updates about changes of user answers in non-anonymous polls that were sent by your bot.
• And more.
Full change log:
https://core.telegram.org/bots/api-changelog#January-23-2020
• Create bots like our demo @QuizBot.
• Send new types of polls: non-anonymous, with multiple answers, and quiz-style.
• Send polls to private chats with users.
• Get updates about changes of user answers in non-anonymous polls that were sent by your bot.
• And more.
Full change log:
https://core.telegram.org/bots/api-changelog#January-23-2020
core.telegram.org
Bot API changelog
The Bot API is an HTTP-based interface created for developers keen on building bots for Telegram. To learn how to create…
Bot API 4.7
- Added the method sendDice for sending a dice message, which will have a random value from 1 to 6. (Yes, we're aware of the “proper” singular of die. But it's awkward, and we decided to help it change. One dice at a time!)
- Added the field dice to the Message object.
- Added the method getMyCommands for getting the current list of the bot's commands.
- Added the method setMyCommands for changing the list of the bot's commands through the Bot API instead of @BotFather.
- Added the ability to create animated sticker sets by specifying the parameter tgs_sticker instead of png_sticker in the method createNewStickerSet.
- Added the ability to add animated stickers to sets created by the bot by specifying the parameter tgs_sticker instead of png_sticker in the method addStickerToSet.
- Added the field thumb to the StickerSet object.
- Added the ability to change thumbnails of sticker sets created by the bot using the method setStickerSetThumb.
Full changelog:
https://core.telegram.org/bots/api#march-30-2020
- Added the method sendDice for sending a dice message, which will have a random value from 1 to 6. (Yes, we're aware of the “proper” singular of die. But it's awkward, and we decided to help it change. One dice at a time!)
- Added the field dice to the Message object.
- Added the method getMyCommands for getting the current list of the bot's commands.
- Added the method setMyCommands for changing the list of the bot's commands through the Bot API instead of @BotFather.
- Added the ability to create animated sticker sets by specifying the parameter tgs_sticker instead of png_sticker in the method createNewStickerSet.
- Added the ability to add animated stickers to sets created by the bot by specifying the parameter tgs_sticker instead of png_sticker in the method addStickerToSet.
- Added the field thumb to the StickerSet object.
- Added the ability to change thumbnails of sticker sets created by the bot using the method setStickerSetThumb.
Full changelog:
https://core.telegram.org/bots/api#march-30-2020
core.telegram.org
Telegram Bot API
The Bot API is an HTTP-based interface created for developers keen on building bots for Telegram. To learn how to create…
Forwarded from BotNews
Bot API 4.8 is live.
• Supported explanations in polls for Quizzes 2.0.
• Supported timed polls that close automatically at a predetermined moment. Use the new open_period and close_date fields.
• Supported new 🎯 animation for the Dice minigame.
Full change log:
https://core.telegram.org/bots/api-changelog#april-24-2020
• Supported explanations in polls for Quizzes 2.0.
• Supported timed polls that close automatically at a predetermined moment. Use the new open_period and close_date fields.
• Supported new 🎯 animation for the Dice minigame.
Full change log:
https://core.telegram.org/bots/api-changelog#april-24-2020
core.telegram.org
Bot API changelog
The Bot API is an HTTP-based interface created for developers keen on building bots for Telegram. To learn how to create…
Forwarded from BotNews
Bot API 4.9 is ready for you.
• Added the via_bot field to show through which bot a message was sent.
• Supported video thumbnails for inline GIF and MPEG4 animations.
• Supported the 🏀 animation for dice (in addition to 🎲 and 🎯).
Full change log:
https://core.telegram.org/bots/api-changelog#june-4-2020
• Added the via_bot field to show through which bot a message was sent.
• Supported video thumbnails for inline GIF and MPEG4 animations.
• Supported the 🏀 animation for dice (in addition to 🎲 and 🎯).
Full change log:
https://core.telegram.org/bots/api-changelog#june-4-2020
core.telegram.org
Bot API changelog
The Bot API is an HTTP-based interface created for developers keen on building bots for Telegram. To learn how to create…
Forwarded from BotNews
Introducing Bot API 5.0
• Run your own Bot API server.
• Transfer Bot ownership to another account.
• New options for Webhooks.
• New method copyMessage to send a copy of any message.
• Support for Live Locations, including the latest changes.
• Support for Multiple Pinned Messages
• Support for File Albums
• Support for Anonymous Admins.
• Support for ⚽️ and 🎰 animated emoji.
• And much more, read the full changelog here:
https://core.telegram.org/bots/api-changelog#November-4-2020
• Run your own Bot API server.
• Transfer Bot ownership to another account.
• New options for Webhooks.
• New method copyMessage to send a copy of any message.
• Support for Live Locations, including the latest changes.
• Support for Multiple Pinned Messages
• Support for File Albums
• Support for Anonymous Admins.
• Support for ⚽️ and 🎰 animated emoji.
• And much more, read the full changelog here:
https://core.telegram.org/bots/api-changelog#November-4-2020