mirror of
https://github.com/42wim/matterbridge.git
synced 2025-02-20 20:39:01 -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 {
|
||||
Key string // irc, xmpp
|
||||
WebhookURL string // discord
|
||||
Topic string // zulip
|
||||
Key string // irc, xmpp
|
||||
WebhookURL string // discord
|
||||
Topic string // zulip
|
||||
WelcomeMessage string // all
|
||||
}
|
||||
|
||||
type Bridge struct {
|
||||
|
@ -27,8 +27,11 @@ func (r *Router) handleCommand(msg *config.Message) bool {
|
||||
|
||||
r.replyCmd(msg, help)
|
||||
case "!ping":
|
||||
r.logger.Debug("!pong:")
|
||||
r.logger.Debug("!pong")
|
||||
r.replyCmd(msg, "pong!")
|
||||
case "!pingdm":
|
||||
r.logger.Debug("!pongdm")
|
||||
r.replyDM(msg, "pong!")
|
||||
default:
|
||||
return false
|
||||
}
|
||||
@ -52,6 +55,22 @@ func (r *Router) replyCmd(msg *config.Message, str string) {
|
||||
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) {
|
||||
err := r.setOptOutStatus(msg.UserID, newStaus)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user