Add basic mailboxes command

This can be improved in the future, to show some additional information
about each mailbox like:

- "how many users are in that room"
- "which users are in that room"
- "who is the owner of the mailbox"

This can all be done later though.
This commit is contained in:
Slavi Pantaleev
2022-08-29 10:28:19 +03:00
parent a057654962
commit 79775c0c13
3 changed files with 51 additions and 0 deletions

View File

@@ -109,6 +109,12 @@ func (b *Bot) buildCommandList() commandList {
sanitizer: utils.SanitizeBoolString,
accessChecker: b.allowOwner,
},
{}, // delimiter
{
key: commandMailboxes,
description: "Show the list of all mailboxes",
accessChecker: b.allowAdmin,
},
}
}
@@ -138,6 +144,8 @@ func (b *Bot) handleCommand(ctx context.Context, evt *event.Event, commandSlice
b.sendHelp(ctx, evt.RoomID)
case commandStop:
b.runStop(ctx)
case commandMailboxes:
b.sendMailboxes(ctx)
default:
b.handleOption(ctx, commandSlice)
}