Commit 94892c7c by HanSon

修改PHP5兼容

1 parent 17f576d3
...@@ -33,6 +33,8 @@ class ContactFactory ...@@ -33,6 +33,8 @@ class ContactFactory
$this->makeContactList(); $this->makeContactList();
myself()->alias = contact()->get(myself()->username)['Alias'] ?? myself()->nickname ? : myself()->username;
$this->getBatchGroupMembers(); $this->getBatchGroupMembers();
if(server()->config['debug']){ if(server()->config['debug']){
...@@ -65,8 +67,6 @@ class ContactFactory ...@@ -65,8 +67,6 @@ class ContactFactory
contact()->put($contact['UserName'], $contact); contact()->put($contact['UserName'], $contact);
} }
} }
myself()->alias = contact()->get(myself()->username)['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!