Decode the API's actual fields in neoirc-cli (closes #146)
check / check (push) Waiting to run
check / check (push) Waiting to run
The CLI read the poll cursor from `lastId` while the server sends `last_id`, so the cursor stayed at 0 and every poll returned the whole queue at once. It now reads `last_id`. /names decodes the member objects the server sends and prints each nick with `@` for an operator or `+` for a voiced member. /list prints each channel's name and topic, since the server sends no member count. StateResponse.Channels decodes channel objects. /topic with no text prints a usage line and sends nothing, because the HTTP API has no topic query and a TOPIC without text gets 461. The help says "Set topic". The client tests serve the bodies the handlers send, so a wrong JSON tag in types.go fails a test; another test covers the /names prefixes. Model: opus-5-5
This commit was merged in pull request #170.
This commit is contained in:
@@ -250,7 +250,7 @@ func (client *Client) ListChannels() (
|
||||
// GetMembers returns members of a channel.
|
||||
func (client *Client) GetMembers(
|
||||
channel string,
|
||||
) ([]string, error) {
|
||||
) ([]Member, error) {
|
||||
name := strings.TrimPrefix(channel, "#")
|
||||
|
||||
data, err := client.do(
|
||||
@@ -263,7 +263,7 @@ func (client *Client) GetMembers(
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var members []string
|
||||
var members []Member
|
||||
|
||||
err = json.Unmarshal(data, &members)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user