Skip to content

Commit

Permalink
add GenerateInviteLink
Browse files Browse the repository at this point in the history
  • Loading branch information
adbenitez committed Feb 6, 2024
1 parent bdee7c5 commit 61ba5a8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion botcli/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 238,7 @@ func qrForAcc(cli *BotCli, bot *deltachat.Bot, cmd *cobra.Command, args []string
invert, _ := cmd.Flags().GetBool("invert")
printQr(qrdata, invert)
fragment := strings.Replace(strings.SplitN(qrdata, ":", 2)[1], "#", "&", 1)

Check failure on line 240 in botcli/cmd.go

View workflow job for this annotation

GitHub Actions / build

fragment declared but not used
fmt.Printf("https://i.delta.chat/#%v\n", fragment)
fmt.Printf(GenerateInviteLink(qrdata))
} else {
cli.Logger.Error("account not configured")
}
Expand Down
7 changes: 7 additions & 0 deletions botcli/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 3,17 @@ package botcli
import (
"os"
"path/filepath"
"strings"

"github.com/mdp/qrterminal/v3"
)

// Generate an invite link (https://i.delta.chat) for the given invitation-QR data
func GenerateInviteLink(qrdata string) string {
fragment := strings.Replace(strings.SplitN(qrdata, ":", 2)[1], "#", "&", 1)
return "https://i.delta.chat/#" fragment
}

func getDefaultAppDir(appName string) string {
cfgDir, _ := os.UserConfigDir()
return filepath.Join(cfgDir, appName)
Expand Down

0 comments on commit 61ba5a8

Please sign in to comment.