Skip to content

Commit

Permalink
[fix] quoting your own messages
Browse files Browse the repository at this point in the history
  • Loading branch information
akshettrj committed Feb 26, 2023
1 parent f3b1a39 commit 4432320
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"gorm.io/gorm"
)

const WATGBRIDGE_VERSION = "1.1.1"
const WATGBRIDGE_VERSION = "1.1.2"

type state struct {
Config *Config
Expand Down
3 changes: 3 additions & 0 deletions telegram/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ func BridgeTelegramToWhatsAppHandler(b *gotgbot.Bot, c *ext.Context) error {
// Status Update
if strings.HasSuffix(waChatID, "@broadcast") {
waChatID = participantID
} else if participantID != "" {
participant, _ := utils.WaParseJID(participantID)
participantID = participant.ToNonAD().String()
}

waChatJID, _ := utils.WaParseJID(waChatID)
Expand Down
18 changes: 9 additions & 9 deletions utils/telegram.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ func TgSendToWhatsApp(b *gotgbot.Bot, c *ext.Context,
}(b, msg)
}

err = database.MsgIdAddNewPair(sentMsg.ID, waClient.Store.ID.User, waChatJID.String(),
err = database.MsgIdAddNewPair(sentMsg.ID, waClient.Store.ID.String(), waChatJID.String(),
cfg.Telegram.TargetChatID, msgToForward.MessageId, msgToForward.MessageThreadId)
if err != nil {
return TgReplyWithErrorByContext(b, c, "Failed to add to database", err)
Expand Down Expand Up @@ -340,7 +340,7 @@ func TgSendToWhatsApp(b *gotgbot.Bot, c *ext.Context,
}(b, msg)
}

err = database.MsgIdAddNewPair(sentMsg.ID, waClient.Store.ID.User, waChatJID.String(),
err = database.MsgIdAddNewPair(sentMsg.ID, waClient.Store.ID.String(), waChatJID.String(),
cfg.Telegram.TargetChatID, msgToForward.MessageId, msgToForward.MessageThreadId)
if err != nil {
return TgReplyWithErrorByContext(b, c, "Failed to add to database", err)
Expand Down Expand Up @@ -409,7 +409,7 @@ func TgSendToWhatsApp(b *gotgbot.Bot, c *ext.Context,
}(b, msg)
}

err = database.MsgIdAddNewPair(sentMsg.ID, waClient.Store.ID.User, waChatJID.String(),
err = database.MsgIdAddNewPair(sentMsg.ID, waClient.Store.ID.String(), waChatJID.String(),
cfg.Telegram.TargetChatID, msgToForward.MessageId, msgToForward.MessageThreadId)
if err != nil {
return TgReplyWithErrorByContext(b, c, "Failed to add to database", err)
Expand Down Expand Up @@ -481,7 +481,7 @@ func TgSendToWhatsApp(b *gotgbot.Bot, c *ext.Context,
}(b, msg)
}

err = database.MsgIdAddNewPair(sentMsg.ID, waClient.Store.ID.User, waChatJID.String(),
err = database.MsgIdAddNewPair(sentMsg.ID, waClient.Store.ID.String(), waChatJID.String(),
cfg.Telegram.TargetChatID, msgToForward.MessageId, msgToForward.MessageThreadId)
if err != nil {
return TgReplyWithErrorByContext(b, c, "Failed to add to database", err)
Expand Down Expand Up @@ -548,7 +548,7 @@ func TgSendToWhatsApp(b *gotgbot.Bot, c *ext.Context,
}(b, msg)
}

err = database.MsgIdAddNewPair(sentMsg.ID, waClient.Store.ID.User, waChatJID.String(),
err = database.MsgIdAddNewPair(sentMsg.ID, waClient.Store.ID.String(), waChatJID.String(),
cfg.Telegram.TargetChatID, msgToForward.MessageId, msgToForward.MessageThreadId)
if err != nil {
return TgReplyWithErrorByContext(b, c, "Failed to add to database", err)
Expand Down Expand Up @@ -615,7 +615,7 @@ func TgSendToWhatsApp(b *gotgbot.Bot, c *ext.Context,
}(b, msg)
}

err = database.MsgIdAddNewPair(sentMsg.ID, waClient.Store.ID.User, waChatJID.String(),
err = database.MsgIdAddNewPair(sentMsg.ID, waClient.Store.ID.String(), waChatJID.String(),
cfg.Telegram.TargetChatID, msgToForward.MessageId, msgToForward.MessageThreadId)
if err != nil {
return TgReplyWithErrorByContext(b, c, "Failed to add to database", err)
Expand Down Expand Up @@ -685,7 +685,7 @@ func TgSendToWhatsApp(b *gotgbot.Bot, c *ext.Context,
}(b, msg)
}

err = database.MsgIdAddNewPair(sentMsg.ID, waClient.Store.ID.User, waChatJID.String(),
err = database.MsgIdAddNewPair(sentMsg.ID, waClient.Store.ID.String(), waChatJID.String(),
cfg.Telegram.TargetChatID, msgToForward.MessageId, msgToForward.MessageThreadId)
if err != nil {
return TgReplyWithErrorByContext(b, c, "Failed to add to database", err)
Expand Down Expand Up @@ -794,7 +794,7 @@ func TgSendToWhatsApp(b *gotgbot.Bot, c *ext.Context,
}(b, msg)
}

err = database.MsgIdAddNewPair(sentMsg.ID, waClient.Store.ID.User, waChatJID.String(),
err = database.MsgIdAddNewPair(sentMsg.ID, waClient.Store.ID.String(), waChatJID.String(),
cfg.Telegram.TargetChatID, msgToForward.MessageId, msgToForward.MessageThreadId)
if err != nil {
return TgReplyWithErrorByContext(b, c, "Failed to add to database", err)
Expand Down Expand Up @@ -856,7 +856,7 @@ func TgSendToWhatsApp(b *gotgbot.Bot, c *ext.Context,
}(b, msg)
}

err = database.MsgIdAddNewPair(sentMsg.ID, waClient.Store.ID.User, waChatJID.String(),
err = database.MsgIdAddNewPair(sentMsg.ID, waClient.Store.ID.String(), waChatJID.String(),
cfg.Telegram.TargetChatID, msgToForward.MessageId, msgToForward.MessageThreadId)
if err != nil {
return TgReplyWithErrorByContext(b, c, "Failed to add to database", err)
Expand Down

0 comments on commit 4432320

Please sign in to comment.