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.
This commit is contained in:
Jaron Swab
2019-06-13 21:14:32 -04:00
parent 4bcdcd1ccd
commit fcd44fe63f
3 changed files with 39 additions and 0 deletions

View File

@ -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)