(might not work for whatsapp if jid contains Agent and Device)
This commit is contained in:
Yousef Mansy 2023-03-14 03:21:02 -07:00
parent 7f9c3620e3
commit cd08d586c5
2 changed files with 24 additions and 4 deletions

View File

@ -179,9 +179,10 @@ type Protocol struct {
} }
type ChannelOptions struct { type ChannelOptions struct {
Key string // irc, xmpp Key string // irc, xmpp
WebhookURL string // discord WebhookURL string // discord
Topic string // zulip Topic string // zulip
WelcomeMessage string // all
} }
type Bridge struct { type Bridge struct {

View File

@ -27,8 +27,11 @@ func (r *Router) handleCommand(msg *config.Message) bool {
r.replyCmd(msg, help) r.replyCmd(msg, help)
case "!ping": case "!ping":
r.logger.Debug("!pong:") r.logger.Debug("!pong")
r.replyCmd(msg, "pong!") r.replyCmd(msg, "pong!")
case "!pingdm":
r.logger.Debug("!pongdm")
r.replyDM(msg, "pong!")
default: default:
return false return false
} }
@ -52,6 +55,22 @@ func (r *Router) replyCmd(msg *config.Message, str string) {
srcBridge.Send(reply) srcBridge.Send(reply)
} }
func (r *Router) replyDM(msg *config.Message, str string) {
srcBridge := r.getBridge(msg.Account)
reply := config.Message{
Text: str,
Channel: msg.UserID,
Account: msg.Account,
Username: "",
UserID: "",
Protocol: msg.Protocol,
Gateway: msg.Gateway,
}
srcBridge.Send(reply)
}
func (r *Router) handleOptOutCmd(msg *config.Message, newStaus OptOutStatus) { func (r *Router) handleOptOutCmd(msg *config.Message, newStaus OptOutStatus) {
err := r.setOptOutStatus(msg.UserID, newStaus) err := r.setOptOutStatus(msg.UserID, newStaus)