Code Monkey home page Code Monkey logo

telegraph's People

Contributors

adevade avatar ah-rahimi avatar alice088 avatar andrey-helldar avatar chillmouse avatar dependabot[bot] avatar evrard-c avatar fabio-ivona avatar faissaloux avatar gausoft avatar intoeetive avatar jorisdrenth avatar mahdimajidzadeh avatar marcovega avatar mariogattolla avatar moayedalhagy avatar mrjavaci avatar naimsolong avatar nicola-posa avatar oakymax avatar pou avatar rzkhrv avatar sadegh19b avatar semer-11 avatar sepgg avatar siarheipashkevich avatar siebeve avatar ternowy avatar varemel avatar ysroot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

telegraph's Issues

Chat Type Group and Commands

πŸ‘‹

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.

Requesting Methods

  • createChatInviteLink
  • getChatMemberCount
  • setChatPermissions
  • promoteChatMember

Would be helpful to have those too.

thanks!

Change Base url

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

Replybutton resize method has no effect.

Discussed in #152

Originally posted by abduqodirovshukrullo August 18, 2022
Reply button ->resize() method does not affect to buttons size

My code:
image

Current button:

image

But I want smaller one
Could you give me some advise please?

New anonymous chats created

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:

  1. Is it possible to fill in the name in the database with the chat title instead it being null?
  2. Is it possible to disable storing unknown chats like the previous behavior was with a config change?

Thank you!

Bot sends message to the same chat

πŸ‘‹

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();
}

/handle as command

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

Handle unknown commands

Hi,

I tried to handle the unknown commands but I couldn't, could you please tell me if that possible and how?

$firstName error in user DTO

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?

[FEAT] Add editMessageCaption endpoint

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):

  • added the editCaption() function inside the TelegraphChat model
  • added the editCaption() function inside the ComposesMessages trait
  • added the ENDPOINT_EDIT_CAPTION const inside the Telegraph class
  • updated the setMessageText() function inside the ComposesMessages trait, adding the line $this->data['caption'] = $message; between lines 25 and 26

This works for me, but I think it would be better this way (just as suggestion):

  • add a parameter to the edit() function -> edit($messageId, $isCaption = false)
  • add a parameter to the 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!

How to perform two WebHook actions at the same time?

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!

Delete Webhook

The documentation makes reference to delete a webhook, but the functionality for this isn’t available.

Leaking states when sending multiple messages

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"
        ]
      ]
    ]
  ]
]

PHP version

Hi,

This repo is not compatible at all with php7.4 right ?

Thanks

registerBotCommands not working

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

/chatid command not work

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

[FEAT] Add sendVoice endpoint

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:

  • added the ENDPOINT_SEND_VOICE const inside the Telegraph class
  • added the Voice DTO, copying the already existing Audio DTO (I also removed the thumbnail property)
  • added the voice() function inside the Message DTO, copying the already existing audio() function
  • added the voice() function inside the SendsAttachments trait, copying and editing the already existing location() function

I 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!

message inline

How or when can you use the functionality of telegram online messages

Fail setWebhook

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

Unknown command when in groups

πŸ‘‹

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_botbut I don't believe it's the best way when one is just using /command

Thank you for all the work ❀️

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.