mirror of
https://github.com/coaidev/coai.git
synced 2025-05-19 04:50:14 +09:00
28 lines
490 B
Go
28 lines
490 B
Go
package cli
|
|
|
|
import (
|
|
"chat/auth"
|
|
"chat/connection"
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
func CreateInvitationCommand(args []string) {
|
|
db := connection.ConnectDatabase()
|
|
|
|
var (
|
|
t = GetArgString(args, 0)
|
|
num = GetArgInt(args, 1)
|
|
quota = GetArgFloat32(args, 2)
|
|
)
|
|
|
|
resp, err := auth.GenerateInvitations(db, num, quota, t)
|
|
if err != nil {
|
|
outputError(err)
|
|
return
|
|
}
|
|
|
|
outputInfo("invite", fmt.Sprintf("%d invitation codes generated", len(resp)))
|
|
fmt.Println(strings.Join(resp, "\n"))
|
|
}
|