Passed
Push — main ( 1f3d08...95c480 )
by Miaad
10:28
created

callbackQuery::answer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 4
dl 0
loc 2
rs 10
1
<?php
2
3
namespace BPT\types;
4
5
use BPT\telegram\telegram;
6
use stdClass;
7
8
/**
9
 * This object represents an incoming callback query from a callback button in an inline keyboard. If the button
10
 * that originated the query was attached to a message sent by the bot, the field message will be present. If the
11
 * button was attached to a message sent via the bot (in inline mode), the field inline_message_id will be
12
 * present. Exactly one of the fields data or game_short_name will be present.
13
 */
14
class callbackQuery extends types {
0 ignored issues
show
Bug introduced by
The type BPT\types\types was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
    /** Keep all of properties which has sub properties */
16
    private const subs = ['from' => 'BPT\types\user', 'message' => 'BPT\types\message'];
17
18
    /** Unique identifier for this query */
19
    public string $id;
20
21
    /** Sender */
22
    public user $from;
23
24
    /**
25
     * Optional. Message with the callback button that originated the query. Note that message content and message
26
     * date will not be available if the message is too old
27
     */
28
    public null|message $message = null;
29
30
    /** Optional. Identifier of the message sent via the bot in inline mode, that originated the query. */
31
    public null|string $inline_message_id = null;
32
33
    /**
34
     * Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent.
35
     * Useful for high scores in games.
36
     */
37
    public null|string $chat_instance = null;
38
39
    /**
40
     * Optional. Data associated with the callback button. Be aware that the message originated the query can contain
41
     * no callback buttons with this data.
42
     */
43
    public null|string $data = null;
44
45
    /** Optional. Short name of a Game to be returned, serves as the unique identifier for the game */
46
    public null|string $game_short_name = null;
47
48
49
    public function __construct(stdClass|null $object = null) {
50
        if ($object != null) {
51
            parent::__construct($object, self::subs);
52
        }
53
    }
54
55
    public function answer (string|null $text = null, bool|null $show_alert = null, string|null $url = null, int|null $cache_time = null): responseError|bool {
56
        return telegram::answerCallbackQuery($this->id, $text, $show_alert, $url, $cache_time);
57
    }
58
59
    public function editText (string $text): message|responseError|bool {
60
        return telegram::editMessageText($text);
61
    }
62
63
    public function editCaption (string $text = ''): message|responseError|bool {
64
        return telegram::editMessageCaption(caption: $text);
65
    }
66
67
    public function editKeyboard (inlineKeyboardMarkup|stdClass|array $reply_markup = null): message|responseError|bool {
68
        return telegram::editMessageReplyMarkup(reply_markup: $reply_markup);
69
    }
70
71
    public function editMedia (inputMedia|array|stdClass $media): message|responseError|bool {
72
        return telegram::editMessageMedia($media);
73
    }
74
}
75