From 6411a4f462fcd039ce4d233aaf28a5186b20eeea Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Fri, 12 Feb 2016 23:26:39 +0000
Subject: [PATCH] [mod_pogoda] Podbicie wersji API yr.no
---
class/BotMessage.php | 33 ++++++++++++++++++++++++++-------
1 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/class/BotMessage.php b/class/BotMessage.php
index 4b446bf..30416f8 100644
--- a/class/BotMessage.php
+++ b/class/BotMessage.php
@@ -2,52 +2,71 @@
class BotMessage {
/**
* Informacje o kliencie
- * @var BotUser
+ * @var BotUser $user
*/
protected $user;
+
/**
* Informacje o kliencie zgodne z poprzednią wersją Bota (dot. API IMified).
* Najczęściej równe {@link BotMessage::$user}
- * @var BotUser
+ * @var BotUser $userAlt
*/
protected $userAlt;
/**
* Sesja przypisana do użytkownika i modułu
- * @var BotSession
+ * @var BotSession $session
*/
protected $session;
/**
* Tekst otrzymany od API - bez zmian
- * @var string
+ * @var string $rawText
*/
protected $rawText;
/**
* Czysty tekst, tylko znaki ASCII, małe litery, podwójne spacje zamienione na pojedyncze
- * @var string
+ * @var string $text
*/
protected $text;
/**
+ * Tablica obrazków (zobacz {@link BotImage}) przesłanych do bota przez użytkownika.
+ * @var array $images
+ */
+ protected $images = array();
+
+ /**
* Komenda, tylko znaki ASCII, małe litery
- * @var string
+ * @var string $command
*/
private $command;
/**
* Argumenty polecenia - oryginalne
- * @var string
+ * @var string $args
*/
private $args;
+ /**
+ * Umożliwia dostęp tylko do odczytu do prywanych zmiennych
+ * @param string $name Nazwa zmiennej
+ * @return mixed Wartość zmiennej prywatnej
+ */
function __get($name) {
return $this->$name;
}
+ /**
+ * Na podstawie nieprzetworzonej wiadomości ({@link BotMessage::$rawText})
+ * metoda ustawia wszystkie pola klasy.
+ * @param string $value Nieprzetworzona wiadomość
+ */
function setText($value) {
$this->rawText = $value;
+
+ $value = trim($value);
$this->text = funcs::utfToAscii($value);
$this->command = funcs::utfToAscii(trim(strtok($value, " \t\r\n")));
$this->args = trim(strtok(''));
--
Gitblit v1.9.1