add !pm signature option

This commit is contained in:
Aine
2023-09-23 16:35:12 +03:00
parent 74defa85e4
commit 480c99cf79
5 changed files with 39 additions and 1 deletions

View File

@@ -84,7 +84,7 @@ func (b *Bot) getOption(ctx context.Context, name string) {
b.SendNotice(ctx, evt.RoomID, msg)
}
//nolint:gocognit
//nolint:gocognit // TODO
func (b *Bot) setOption(ctx context.Context, name, value string) {
cmd := b.commands.get(name)
if cmd != nil && cmd.sanitizer != nil {
@@ -119,6 +119,14 @@ func (b *Bot) setOption(ctx context.Context, name, value string) {
}
}
if name == config.RoomSignature {
value = strings.Join(b.parseCommand(evt.Content.AsMessage().Body, false)[1:], " ")
}
if value == "reset" {
value = ""
}
old := cfg.Get(name)
cfg.Set(name, value)