defstudio / telegraph Goto Github PK
View Code? Open in Web Editor NEWTelegraph is a Laravel package for fluently interacting with Telegram Bots
License: MIT License
Telegraph is a Laravel package for fluently interacting with Telegram Bots
License: MIT License
Hello, thanks for this amazing package.
Do you plan to add support for any other messages (medias) retrieving by the bot throughout Webhook?
We can actually get only text message
Thanks
In order to interact with a sent message (replacing or removing a keyboard) the messageId should be returned from the ->send()
method
send photo/document with file_id in telegram
this option will disable the web page display for urls in messages
Hello
I did not understand how I can read the message sent by the user and respond to the user according to the message
I read here:
https://def-studio.github.io/telegraph/features/messages
But it was only about commands and Callback Queries and nothing was said about the text messages
please help
π
Thank you for all the work π
regarding this "issue" I don't believe it to be an issue but more of an enhancement.
in a chat group if you do /command all will work but in groups you can have lots of bots with the /start command and doing this will make all of them respond.
Normally one does this /command@my_test_bot but for know the implementation will not respond to this command
Giving the following log message:
local.ERROR: No Telegram Webhook handler defined for received command@my_test_bot: command@my_test_bot
Once more thank you for your work.
src/Keyboard/Keyboard.php
line 61
How to use telegram-bot-api in Telegraph?
todo
Would be helpful to have those too.
thanks!
Hello
I have (self host) in server
and I use http://localhost:8000 instead of https://api.telegram.org
and I need to a method in send message, send document &...
before method send()
that I can specify the base url method
And I can specify its default value in config
this method just change the base url
Thanks
using reply_to_message_id message option
Hello,
With the latest upgrade, the package started to create chats from webhooks that can not be identified which group they belong to because the name is null.
I have two questions:
Thank you!
π
Hi believe I found a problem but I cant understand where the problem is.
The following fode when in a controller will always send all the messages to the first chat.
/** @var TelegraphChat $chats */
$chats = TelegraphChat::all();
foreach ($chats as $chat) {
$chat->markdown("*Hello!*\n\nI'm here!")->send();
}
if i sent /handle to bot, webhook got error
[2022-05-24 11:57:24] production.DEBUG: Telegraph webhook message {"text":"/handle"}
[2022-05-24 11:57:24] production.ERROR: Too few arguments to function DefStudio\Telegraph\Handlers\WebhookHandler::handle(), 0 passed in vendor/defstudio/telegraph/src/Handlers/WebhookHandler.php on line 82 and exactly 2 expected {"exception":"[object] (ArgumentCountError(code: 0): Too few arguments to function DefStudio\\Telegraph\\Handlers\\WebhookHandler::handle(), 0 passed in /home/other/domains/korol.dp.ua/public_html/vendor/defstudio/telegraph/src/Handlers/WebhookHandler.php on line 82 and exactly 2 expected at vendor/defstudio/telegraph/src/Handlers/WebhookHandler.php:179)
[stacktrace]
possible need check if $command !== 'handle' or something else
a new ->deleteMessage()
method should be added to the Telegraph
class in order to delete a sent message
Hi,
I tried to handle the unknown commands but I couldn't, could you please tell me if that possible and how?
Hi there, I'd like to report an issue that we face when we're using this library in one of the webhook handling events. This error message showed up for one of the groups that trigger the webhook.
Cannot assign null to property DefStudio\Telegraph\DTO\User::$firstName of type string {"exception":"[object] (TypeError(code: 0): Cannot assign null to property DefStudio\Telegraph\DTO\User::$firstName of type string at /vendor/defstudio/telegraph/src/DTO/User.php:31)
Does anyone have an idea on this?
Location method used in docs here: https://def-studio.github.io/telegraph/features/attachments but not working
Hi, any plan to support reply_to_message
Message field for incoming messages?
Hi
we can't use getFileInfo in TelegraphBot but can use after setBaseurl
please fix it: @fabio-ivona
The method won't remove the keyboard from the Callback message.
public function setRole(): void
{
$this->deleteKeyboard();
}
I'm investigating into this.
Hello everyone,
Thanks a lot for your superb work, this package is amazing.
I just wanted to ask for an enhancement: the edit()
function provided by the TelegraphChat
model doesn't work for messages with files. To make it work, I followed these steps (it's working, but I'm not sure if this is the best way to do this):
editCaption()
function inside the TelegraphChat
modeleditCaption()
function inside the ComposesMessages
traitENDPOINT_EDIT_CAPTION
const inside the Telegraph
classsetMessageText()
function inside the ComposesMessages
trait, adding the line $this->data['caption'] = $message;
between lines 25 and 26This works for me, but I think it would be better this way (just as suggestion):
edit()
function -> edit($messageId, $isCaption = false)
setMessageText()
function (and related handler) -> setMessageText($message, $isCaption = false)
or maybe it would be possible to just add a function that changes the parameter if the message has files attached
Reference:
https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1edit_message_caption.html
Thanks a lot in advance!
Hello! I've been using your package very heavily recently. Great job!
I have a question: I have a method called setRole
that's hooked to a Telegram action. This is an example of the contents:
$this->chat->message("You selected $role_id.")->send();
$this->chat->deleteMessage($the_action_message_id);
Only the first command gets executed, if I swap send message for delete message, then the message gets deleted. Is there a way to make them both work?
Thanks!
The documentation makes reference to delete a webhook, but the functionality for this isnβt available.
Your Package looks great, I was wondering if there is any way we can use the following methods:
https://core.telegram.org/bots/api#setchattitle
https://core.telegram.org/bots/api#setchatdescription
https://core.telegram.org/bots/api#setchatphoto
This code:
/** @var TelegraphChat $telegraphChat */
$telegraphChat = $user->telegraphChat;
$telegraphChat
->markdown('*new message*')
->send();
$telegraphChat
->location(
latitude: 12,
longitude: 34,
)
->send();
$telegraphChat
->markdown('*action*')
->keyboard(
Keyboard::make()
->buttons([
Button::make('Do it')->action('solved')->param('id', '12'),
])
)
->send();
Results in following final post data:
array:6 [
"text" => """
*action*
"""
"chat_id" => "xxx"
"parse_mode" => "markdown"
"latitude" => 12.0
"longitude" => 34.0
"reply_markup" => array:1 [
"inline_keyboard" => array:1 [
0 => array:1 [
0 => array:2 [
"text" => "Do it"
"callback_data" => "action:solved;id:12"
]
]
]
]
]
Hi,
This repo is not compatible at all with php7.4 right ?
Thanks
I am trying to set menu with commands
class TestWebhook extends \DefStudio\Telegraph\Handlers\WebhookHandler
{
public function start()
{
$this->bot->registerCommands([
'info' => 'Info',
'registration' => 'Registration',
'search' => 'Search'
]);
}
}
and nothing changes
In documentation exists command /chat_id but in code is /chatid
/chatid command not work
you need replace this line src\Handlers\WebhookHandler.php:141
$chat = $this->bot->chats()->where('chat_id', $this->request->input('message.chat.id'))->firstOrNew();
on this code:
$chat = $this->bot->chats()->firstOrNew([
'chat_id' => $this->request->input('message.chat.id')
]);
for fix problem
Hello again,
I'm using this amazing package in group chats where are sent a lot of voice recordings. My bot should be able to forward these voices to other chats, but this is not possible at the moment. I've seen through your docs that you're planning to add this feature, but I wanted to share how I made it working:
ENDPOINT_SEND_VOICE
const inside the Telegraph
classVoice
DTO, copying the already existing Audio
DTO (I also removed the thumbnail
property)voice()
function inside the Message
DTO, copying the already existing audio()
functionvoice()
function inside the SendsAttachments
trait, copying and editing the already existing location()
functionI don't remember if it required other steps, but I've done these for sure.
Reference:
https://core.telegram.org/bots/api#sendvoice
Again, thanks a lot in advance!
How or when can you use the functionality of telegram online messages
Can I set webHook locally?
For ReplyButton not working action
Hello. I try use command php artisan telegraph set-webhook, but im recive error
Failed to register webhook
{"ok":false,"error_code":400,"description":"Bad Request: bad webhook: IP address 127.0.0.1 is reserved"}
I think this becouse im use docker compose configuration on my vds. But how fix it no idea.
Empty laravel 9.19 project, just install sanctum, orchid and telegraph.
thx
Hello,
I get this error message when trying to create a webhook. I'm trying it out on local and my app is using valet with https.
TelegramWebhookException
You application must have a secure (https) url in order to accept webhook calls
Any idea on why this is happening?
π
The solution in #47 works very well π
But it raises an issue.
When any command is used in the group that does not exist in our bot it will respond with Unknown command
this would be expected if one uses the command like /command@my_super_bot
but I don't believe it's the best way when one is just using /command
Thank you for all the work β€οΈ
Hi
on https://def-studio.github.io/telegraph/quickstart/setting-webhook page artisan command needs {bot_id}. Where can I find it?
In table 'telegraph_bots' in ID column?
run function like handleChatCommand for not file command in bot
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.