Skip to content

#858 add chat action constants #859

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 14, 2018
Merged

Conversation

smoqadam
Copy link
Contributor

#858 add chat action constants

src/Telegram.php Outdated
/**
* Upload Video note chat action
*/
const ACTION_UPLOAD_VIDEO_NOTE = 'record_video_note';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smoqadam

...to prevent from future mistakes like typos.

Unless they are built-in 😁
Please correct this one.

@noplanman
Copy link
Member

@php-telegram-bot/developers
Would we want these all in the Telegram class or a separate class Action that has just those constants in it, i.e.

class Action
{
    const TYPING            = 'typing';
    const UPLOAD_PHOTO      = 'upload_photo';
    const RECORD_VIDEO      = 'record_video';
    const UPLOAD_VIDEO      = 'upload_video';
    const RECORD_AUDIO      = 'record_audio';
    const UPLOAD_AUDIO      = 'upload_audio';
    const UPLOAD_DOCUMENT   = 'upload_document';
    const FIND_LOCATION     = 'find_location';
    const RECORD_VIDEO_NOTE = 'record_video_note';
    const UPLOAD_VIDEO_NOTE = 'upload_video_note';
}

We'd also have to decide what namespace to put them in.

@akalongman
Copy link
Member

+1 for separate class

@smoqadam
Copy link
Contributor Author

ChatAction class wouldn't be more meaningful?

class ChatAction
{
    /**
     * Typing chat action
     */
    const TYPING = 'typing';

    /**
     * Upload Photo chat action
     */
    const UPLOAD_PHOTO = 'upload_photo';

    /**
     * Record Video chat action
     */
    const RECORD_VIDEO = 'record_video';
    .....

usage

Request::sendChatAction([
    'chat_id' => $chat_id,
    'action'  => Longman\TelegramBot\ChatAction::TYPING,
]);

@noplanman
Copy link
Member

ChatAction class wouldn't be more meaningful?

Absolutely! Thanks for the fixed PR 👍

@noplanman noplanman merged commit 9bf5c34 into php-telegram-bot:develop Jul 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants