示例#1
0
文件: room.go 项目: samuelkadolph/go
func (r *Room) message(b, t string) error {
	var wrapper struct {
		Message Message `json:"message"`
	}

	wrapper.Message.Body = n.String(strings.Replace(b, "\n", "
", -1))

	if t != "" {
		wrapper.Message.Type = n.String(t)
	}

	return r.connection.post("/room/%d/speak", r.ID, wrapper)
}
示例#2
0
文件: room.go 项目: samuelkadolph/go
func (r *Room) SetTopic(topic string) error {
	var wrapper struct {
		Room Room `json:"room"`
	}

	wrapper.Room.Topic = n.String(topic)

	return r.connection.put("/room/%d", r.ID, wrapper)
}
示例#3
0
文件: room.go 项目: samuelkadolph/go
func (r *Room) Rename(name string) error {
	var wrapper struct {
		Room Room `json:"room"`
	}

	wrapper.Room.Name = n.String(name)

	return r.connection.put("/room/%d", r.ID, wrapper)
}