# !rem keyword = information match(/rem ([^ ]+) = (.+)$/, method: :remember) def remember(m, term, val) @db.execute("INSERT OR REPLACE INTO infobot (term, value) VALUES (?, ?)", term, val) m.reply("Okay, #{term} now means #{val}") rescue => e exception(e) m.reply("Error remembering '#{term}'") end # ! match(/([^ ]+)$/, method: :lookup) def lookup(m, term) res = @db.get_first_value("SELECT value FROM infobot WHERE term = ?", term) if res m.reply(res) end end