X-Git-Url: http://git.giacomolli.uk/onechat/blobdiff_plain/4c0da6d82252e096269ff840160618318a457d53..fb242538c1b012b0faf3cc4045a9b1c370f1ef42:/botapi_test.go diff --git a/botapi_test.go b/botapi_test.go index 9dfbcad..fb57b45 100644 --- a/botapi_test.go +++ b/botapi_test.go @@ -322,12 +322,17 @@ func (f *fakeBot) Calls() []fakeBotCall { return append([]fakeBotCall(nil), f.calls...) } -// Sent returns the texts of the sendMessage calls that succeeded. +// Sent returns the texts of the sendMessage calls and the Markdown of the +// sendRichMessage calls that succeeded, in order. func (f *fakeBot) Sent() []string { var texts []string for _, call := range f.Calls() { - if call.method == "sendMessage" && call.ok { + switch { + case !call.ok: + case call.method == "sendMessage": texts = append(texts, call.params["text"].(string)) + case call.method == "sendRichMessage": + texts = append(texts, call.params["rich_message"].(map[string]any)["markdown"].(string)) } }