mirror of
https://github.com/42wim/matterbridge.git
synced 2025-02-21 20:59:02 -08:00
ping dm
(might not work for whatsapp if jid contains Agent and Device)
This commit is contained in:
parent
7f9c3620e3
commit
cd08d586c5
@ -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 {
|
||||||
|
@ -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)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user