!pm users changes

This commit is contained in:
Aine
2022-08-30 15:00:34 +03:00
parent 00b84fba0e
commit ea1ef9da7f
2 changed files with 7 additions and 3 deletions

View File

@@ -102,8 +102,8 @@ func (b *Bot) runUsers(ctx context.Context, commandSlice []string) {
msg.WriteString("Usage: `")
msg.WriteString(b.prefix)
msg.WriteString(" users PATTERN1 PATTERN2 PATTERN3...`")
msg.WriteString("where patterns like `@someone:example.com ")
msg.WriteString(" @bot.*:example.com @*:another.com @*:*`\n")
msg.WriteString("where each pattern is like `@someone:example.com`, ")
msg.WriteString("`@bot.*:example.com`, `@*:another.com`, or `@*:*`\n")
b.SendNotice(ctx, evt.RoomID, msg.String())
return

View File

@@ -28,7 +28,11 @@ func (s botSettings) Set(key, value string) {
// Users option
func (s botSettings) Users() []string {
return strings.Split(s.Get(botOptionUsers), " ")
value := s.Get(botOptionUsers)
if strings.Contains(value, " ") {
return strings.Split(value, " ")
}
return []string{}
}
// TODO: remove after migration