diff --git a/bridge/config/config.go b/bridge/config/config.go index 18c60920..2d83b6e8 100644 --- a/bridge/config/config.go +++ b/bridge/config/config.go @@ -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 { diff --git a/gateway/command.go b/gateway/command.go index 46ff1c73..b749da0a 100644 --- a/gateway/command.go +++ b/gateway/command.go @@ -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)