use modified string to get key/value pairs

This commit is contained in:
Aaron Bieber 2020-05-14 07:41:19 -06:00
parent 695358aa0c
commit 1d950179fe

View File

@ -224,8 +224,8 @@ func main() {
if plugins.ToMe(username, post) { if plugins.ToMe(username, post) {
mp := plugins.RemoveName(shortName, post) mp := plugins.RemoveName(shortName, post)
if kvRE.MatchString(mp) { if kvRE.MatchString(mp) {
key := kvRE.ReplaceAllString(post, "$1") key := kvRE.ReplaceAllString(mp, "$1")
val := kvRE.ReplaceAllString(post, "$2") val := kvRE.ReplaceAllString(mp, "$2")
store.Set(key, val) store.Set(key, val)
log.Printf("Setting %q to %q", key, val) log.Printf("Setting %q to %q", key, val)
err := plugins.SendMD(cli, ev.RoomID, fmt.Sprintf("Set **%q** = *%q*", key, val)) err := plugins.SendMD(cli, ev.RoomID, fmt.Sprintf("Set **%q** = *%q*", key, val))