From fcd44fe63fe0cedc038db92ae39507237cc5589a Mon Sep 17 00:00:00 2001 From: Jaron Swab Date: Thu, 13 Jun 2019 21:14:32 -0400 Subject: 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. --- matrix/matrix.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'matrix') 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) -- cgit v1.2.3