Posting messages to matrix
This commit is contained in:
@@ -42,16 +42,20 @@ abstract class Base
|
||||
|
||||
case 'room':
|
||||
$room_alias = Http::withToken(config('matrix.as_token'))
|
||||
->get(sprintf('%s/_matrix/client/v3/rooms/%s/state/m.room.canonical_alias',config('matrix.server'),$this->room_id));
|
||||
->get(sprintf('https://%s/_matrix/client/v3/rooms/%s/state/m.room.canonical_alias',config('matrix.server'),$this->room_id));
|
||||
|
||||
return $room_alias->json('alias',$this->room_id);
|
||||
|
||||
case 'topic':
|
||||
$subject = Http::withToken(config('matrix.as_token'))
|
||||
->get(sprintf('%s/_matrix/client/v3/rooms/%s/state/m.room.topic',config('matrix.server'),$this->room_id));
|
||||
->get(sprintf('https://%s/_matrix/client/v3/rooms/%s/state/m.room.topic',config('matrix.server'),$this->room_id));
|
||||
|
||||
return $subject->json('topic','Message from Matrix');
|
||||
|
||||
case 'ts':
|
||||
return object_get($this->_data,'origin_server_ts');
|
||||
|
||||
case 'event_id':
|
||||
case 'room_id':
|
||||
default:
|
||||
return object_get($this->_data,$key);
|
||||
|
@@ -36,15 +36,6 @@ class Factory {
|
||||
|
||||
public static function make(array $request): Base
|
||||
{
|
||||
// During the life of the event, this method is called twice - once during Middleware processing, and finally by the Controller.
|
||||
static $o = NULL;
|
||||
static $or = NULL;
|
||||
|
||||
if (! $o OR ($or != $request)) {
|
||||
$or = $request;
|
||||
$o = self::create(Arr::get($request,'type','unknown'),$request);
|
||||
}
|
||||
|
||||
return $o;
|
||||
return self::create(Arr::get($request,'type','unknown'),$request);
|
||||
}
|
||||
}
|
@@ -42,9 +42,6 @@ class Message extends Base
|
||||
case 'sender':
|
||||
return object_get($this->_data,$key);
|
||||
|
||||
case 'ts':
|
||||
return object_get($this->_data,'origin_server_ts');
|
||||
|
||||
default:
|
||||
return parent::__get($key);
|
||||
}
|
||||
|
Reference in New Issue
Block a user