replace some whatsapp stuff

This commit is contained in:
Annie Elequin 2021-09-16 18:26:58 -04:00
parent 43109ec919
commit 436c3a620e

View File

@ -32,7 +32,7 @@ var boldRegex = regexp.MustCompile("([\\s>_~]|^)\\*(.+?)\\*([^a-zA-Z\\d]|$)")
var strikethroughRegex = regexp.MustCompile("([\\s>_*]|^)~(.+?)~([^a-zA-Z\\d]|$)") var strikethroughRegex = regexp.MustCompile("([\\s>_*]|^)~(.+?)~([^a-zA-Z\\d]|$)")
var codeBlockRegex = regexp.MustCompile("```(?:.|\n)+?```") var codeBlockRegex = regexp.MustCompile("```(?:.|\n)+?```")
const mentionedJIDsContextKey = "net.maunium.whatsapp.mentioned_jids" const mentionedJIDsContextKey = "net.maunium.groupme.mentioned_jids"
type Formatter struct { type Formatter struct {
bridge *Bridge bridge *Bridge
@ -55,9 +55,9 @@ func NewFormatter(bridge *Bridge) *Formatter {
if mxid[0] == '@' { if mxid[0] == '@' {
puppet := bridge.GetPuppetByMXID(id.UserID(mxid)) puppet := bridge.GetPuppetByMXID(id.UserID(mxid))
if puppet != nil { if puppet != nil {
jids, ok := ctx[mentionedJIDsContextKey].([]whatsapp.JID) jids, ok := ctx[mentionedJIDsContextKey].([]groupme.JID)
if !ok { if !ok {
ctx[mentionedJIDsContextKey] = []whatsapp.JID{puppet.JID} ctx[mentionedJIDsContextKey] = []groupme.JID{puppet.JID}
} else { } else {
ctx[mentionedJIDsContextKey] = append(jids, puppet.JID) ctx[mentionedJIDsContextKey] = append(jids, puppet.JID)
} }