diff options
author | Jaron Swab <jrswab@gmail.com> | 2019-06-13 21:14:32 -0400 |
---|---|---|
committer | Jaron Swab <jrswab@gmail.com> | 2019-06-13 21:14:32 -0400 |
commit | fcd44fe63fe0cedc038db92ae39507237cc5589a (patch) | |
tree | ee3b13cbf99dc8ccdadbd20c22c62e8f7fcdcfb0 /matrix | |
parent | 4bcdcd1ccd1d616d29614e5eaf8bfb1df679aa6d (diff) |
Users can now create a new room directly in Gomuks
Added the ability to create a room from within gomuks using the now
`/create` command. This comman takes the room name followed by the
alias. Room name may contain spaces but the alias may not as per the
Matrix alias conventions.
Also update `/help` to include the new command.
Diffstat (limited to 'matrix')
-rw-r--r-- | matrix/matrix.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/matrix/matrix.go b/matrix/matrix.go index b87042e..ef272b0 100644 --- a/matrix/matrix.go +++ b/matrix/matrix.go @@ -538,6 +538,16 @@ func (c *Container) SendTyping(roomID string, typing bool) { } } +// CreateRoom attempts to create a new room and join the user. +func (c *Container) CreateRoom(req *mautrix.ReqCreateRoom) (*rooms.Room, error) { + resp, err := c.client.CreateRoom(req) + if err != nil { + return nil, err + } + room := c.GetRoom(resp.RoomID) + return room, nil +} + // JoinRoom makes the current user try to join the given room. func (c *Container) JoinRoom(roomID, server string) (*rooms.Room, error) { resp, err := c.client.JoinRoom(roomID, server, nil) |