Commit 19048f8f authored by MBoretto's avatar MBoretto

fix chat type and cs

parent 7f170b07
...@@ -69,7 +69,7 @@ class ChatsCommand extends Command ...@@ -69,7 +69,7 @@ class ChatsCommand extends Command
$chat = new Chat($result); $chat = new Chat($result);
if ($chat->isPrivateChat()) { if ($chat->isPrivateChat()) {
$text .= '- P '.$chat->tryMentionChat()."\n"; $text .= '- P '.$chat->tryMention()."\n";
++$user_chats; ++$user_chats;
} elseif ($chat->isGroupChat()) { } elseif ($chat->isGroupChat()) {
$text .= '- G '.$chat->getTitle()."\n"; $text .= '- G '.$chat->getTitle()."\n";
......
...@@ -30,6 +30,6 @@ class ChannelchatcreatedCommand extends Command ...@@ -30,6 +30,6 @@ class ChannelchatcreatedCommand extends Command
$channel_chat_created = $message->getChannelChatCreated(); $channel_chat_created = $message->getChannelChatCreated();
// temporary do nothing // temporary do nothing
return 1 return 1;
} }
} }
...@@ -30,6 +30,6 @@ class GroupchatcreatedCommand extends Command ...@@ -30,6 +30,6 @@ class GroupchatcreatedCommand extends Command
$group_chat_created = $message->getGroupChatCreated(); $group_chat_created = $message->getGroupChatCreated();
// temporary do nothing // temporary do nothing
return 1 return 1;
} }
} }
...@@ -57,7 +57,7 @@ class WeatherCommand extends Command ...@@ -57,7 +57,7 @@ class WeatherCommand extends Command
return false; return false;
} }
try{ try {
$data = $this->getWeather($location); $data = $this->getWeather($location);
$decode = json_decode($data, true); $decode = json_decode($data, true);
......
...@@ -59,7 +59,7 @@ class DB ...@@ -59,7 +59,7 @@ class DB
* *
* @param array credential, string table_prefix * @param array credential, string table_prefix
*/ */
public static function initialize(array $credentials, $table_prefix = null, Telegram $telegram) public static function initialize(array $credentials, Telegram $telegram, $table_prefix = null)
{ {
self::$telegram = $telegram; self::$telegram = $telegram;
if (empty($credentials)) { if (empty($credentials)) {
......
...@@ -117,7 +117,7 @@ class Chat extends Entity ...@@ -117,7 +117,7 @@ class Chat extends Entity
public function tryMention() public function tryMention()
{ {
if ($chat->isPrivateChat()) { if ($this->isPrivateChat()) {
if (is_null($this->username)) { if (is_null($this->username)) {
if (!is_null($this->last_name)) { if (!is_null($this->last_name)) {
return $this->first_name.' '.$this->last_name; return $this->first_name.' '.$this->last_name;
...@@ -126,6 +126,6 @@ class Chat extends Entity ...@@ -126,6 +126,6 @@ class Chat extends Entity
} }
return '@'.$this->username; return '@'.$this->username;
} }
return $chat->getTitle(); return $this->getTitle();
} }
} }
...@@ -180,7 +180,7 @@ class Telegram ...@@ -180,7 +180,7 @@ class Telegram
*/ */
public function enableMySQL(array $credential, $table_prefix = null) public function enableMySQL(array $credential, $table_prefix = null)
{ {
$this->pdo = DB::initialize($credential, $table_prefix, $this); $this->pdo = DB::initialize($credential, $this, $table_prefix);
$this->mysql_enabled = true; $this->mysql_enabled = true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment