Commit 560148d1 by HanSon Committed by GitHub

Merge pull request #41 from HanSon/dev

修改PHP5兼容
2 parents b8a1acf3 c29efe72
...@@ -33,6 +33,10 @@ class ContactFactory ...@@ -33,6 +33,10 @@ class ContactFactory
$this->makeContactList(); $this->makeContactList();
$contact = contact()->get(myself()->username);
myself()->alias = isset($contact['Alias']) ? $contact['Alias'] : myself()->nickname ? : myself()->username;
$this->getBatchGroupMembers(); $this->getBatchGroupMembers();
if(server()->config['debug']){ if(server()->config['debug']){
...@@ -65,10 +69,6 @@ class ContactFactory ...@@ -65,10 +69,6 @@ class ContactFactory
contact()->put($contact['UserName'], $contact); contact()->put($contact['UserName'], $contact);
} }
} }
$contact = contact()->get(myself()->username);
myself()->alias = isset($contact['Alias']) ? $contact['Alias'] : myself()->nickname ? : myself()->username;
} }
/** /**
......
...@@ -27,16 +27,18 @@ class Text extends Message implements MessageInterface ...@@ -27,16 +27,18 @@ class Text extends Message implements MessageInterface
/** /**
* 发送消息 * 发送消息
* *
* @param $word string 消息内容 * @param $word string|Text 消息内容
* @param $username string 目标username * @param $username string 目标username
* @return bool * @return bool
*/ */
public static function send($username, string $word) public static function send($username, $word)
{ {
if (!$word) { if (!$word) {
return false; return false;
} }
$word = is_string($word) ? $word : $word->content;
$random = strval(time() * 1000) . '0' . strval(rand(100, 999)); $random = strval(time() * 1000) . '0' . strval(rand(100, 999));
$data = [ $data = [
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!