1 | <?php |
||
10 | class MessageUtility extends AbstractUtility |
||
11 | { |
||
12 | /** |
||
13 | * Remove the mentioned bot username from the message. |
||
14 | * |
||
15 | * @param $message |
||
16 | * |
||
17 | * @throws \Exception |
||
18 | * |
||
19 | * @return string |
||
20 | */ |
||
21 | 9 | public function removeMentionedBot($message) |
|
27 | |||
28 | /** |
||
29 | * Check if the bot user id is mentioned in the message. |
||
30 | * |
||
31 | * @param $message |
||
32 | * |
||
33 | * @throws \Exception |
||
34 | * |
||
35 | * @return bool |
||
36 | */ |
||
37 | 2 | public function isBotMentioned($message) |
|
43 | |||
44 | /** |
||
45 | * Return command name in the message. |
||
46 | * |
||
47 | * @param $message |
||
48 | * |
||
49 | * @return null|string |
||
50 | */ |
||
51 | 8 | public function extractCommandName($message) |
|
69 | |||
70 | /** |
||
71 | * Return command details in the message. |
||
72 | * |
||
73 | * @param $message |
||
74 | * |
||
75 | * @return \Botonomous\Command|null |
||
76 | */ |
||
77 | 1 | public function extractCommandDetails($message) |
|
85 | |||
86 | /** |
||
87 | * @param $triggerWord |
||
88 | * @param $message |
||
89 | * |
||
90 | * @return string |
||
91 | */ |
||
92 | 4 | public function removeTriggerWord($message, $triggerWord) |
|
98 | |||
99 | /** |
||
100 | * @param $userId |
||
101 | * @param string $userName |
||
102 | * |
||
103 | * @throws \Exception |
||
104 | * |
||
105 | * @return string |
||
106 | */ |
||
107 | 12 | public function linkToUser($userId, $userName = '') |
|
119 | |||
120 | /** |
||
121 | * @return string |
||
122 | */ |
||
123 | 11 | private function getUserLink() |
|
127 | |||
128 | 2 | public function keywordPos(array $keywords, $message) |
|
153 | |||
154 | 2 | private function compareLength($array1, $array2) |
|
158 | |||
159 | 2 | private function isPositionTaken(array $tokensPositions, $newPosition) |
|
176 | } |
||
177 |