mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
bridgev2/commands: include failed participants in group create response
This commit is contained in:
parent
8ee8fb1a20
commit
1aacf6e987
1 changed files with 12 additions and 1 deletions
|
|
@ -20,6 +20,7 @@ import (
|
|||
"maunium.net/go/mautrix/bridgev2/networkid"
|
||||
"maunium.net/go/mautrix/bridgev2/provisionutil"
|
||||
"maunium.net/go/mautrix/event"
|
||||
"maunium.net/go/mautrix/format"
|
||||
"maunium.net/go/mautrix/id"
|
||||
)
|
||||
|
||||
|
|
@ -195,7 +196,17 @@ func fnCreateGroup(ce *Event) {
|
|||
ce.Reply("Failed to create group: %v", err)
|
||||
return
|
||||
}
|
||||
ce.Reply("Successfully created group `%s`", resp.ID)
|
||||
var postfix string
|
||||
if len(resp.FailedParticipants) > 0 {
|
||||
failedParticipantsStrings := make([]string, len(resp.FailedParticipants))
|
||||
i := 0
|
||||
for participantID, meta := range resp.FailedParticipants {
|
||||
failedParticipantsStrings[i] = fmt.Sprintf("* %s: %s", format.SafeMarkdownCode(participantID), meta.Reason)
|
||||
i++
|
||||
}
|
||||
postfix += "\n\nFailed to add some participants:\n" + strings.Join(failedParticipantsStrings, "\n")
|
||||
}
|
||||
ce.Reply("Successfully created group `%s`%s", resp.ID, postfix)
|
||||
}
|
||||
|
||||
var CommandSearch = &FullHandler{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue