Skip to content

Commit

Permalink
rename start-dm to pm
Browse files Browse the repository at this point in the history
  • Loading branch information
trek-boldly-go committed Jan 29, 2024
1 parent f7c8b2f commit 9333c2e
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type WrappedCommandEvent struct {
func (br *IMBridge) RegisterCommands() {
proc := br.CommandProcessor.(*commands.Processor)
proc.AddHandlers(
cmdStartDm,
cmdPM,
)
}

Expand All @@ -50,22 +50,22 @@ func wrapCommand(handler func(*WrappedCommandEvent)) func(*commands.Event) {
}
}

var cmdStartDm = &commands.FullHandler{
Func: wrapCommand(fnStartDm),
Name: "start-dm",
var cmdPM = &commands.FullHandler{
Func: wrapCommand(fnPM),
Name: "pm",
Help: commands.HelpMeta{
Section: HelpSectionChatManagement,
Description: "Creates a new DM with the specified number.",
Description: "Creates a new PM with the specified number or address.",
},
RequiresPortal: false,
RequiresLogin: false,
}

func fnStartDm(ce *WrappedCommandEvent) {
ce.Bridge.ZLog.Trace().Interface("args", ce.Args).Str("cmd", ce.Command).Msg("fnStartDm")
func fnPM(ce *WrappedCommandEvent) {
ce.Bridge.ZLog.Trace().Interface("args", ce.Args).Str("cmd", ce.Command).Msg("fnPM")

if len(ce.Args) == 0 {
ce.Reply("**Usage:** `start-dm <international phone number>` OR `start-dm <apple id email address>`")
ce.Reply("**Usage:** `pm <international phone number>` OR `pm <apple id email address>`")
return
}

Expand All @@ -76,7 +76,7 @@ func fnStartDm(ce *WrappedCommandEvent) {
})

if err != nil {
ce.Reply("Failed to start DM: %s", err)
ce.Reply("Failed to start PM: %s", err)
} else {
ce.Reply("Created portal room [%s](%s) and invited you to it.", startedDm.RoomID, startedDm.RoomID.URI(ce.Bridge.Config.Homeserver.Domain).MatrixToURL())
}
Expand Down

0 comments on commit 9333c2e

Please sign in to comment.