Add /api/get-message-answer API

This commit is contained in:
Yang Luo
2023-05-01 23:15:51 +08:00
parent eea2e1d271
commit 2cd6f9df8e
7 changed files with 159 additions and 2 deletions

View File

@ -20,6 +20,7 @@ import (
"encoding/hex"
"errors"
"fmt"
"math/rand"
"os"
"strconv"
"strings"
@ -141,6 +142,16 @@ func GenerateSimpleTimeId() string {
return t
}
func GetRandomName() string {
rand.Seed(time.Now().UnixNano())
const charset = "0123456789abcdefghijklmnopqrstuvwxyz"
result := make([]byte, 6)
for i := range result {
result[i] = charset[rand.Intn(len(charset))]
}
return string(result)
}
func GetId(owner, name string) string {
return fmt.Sprintf("%s/%s", owner, name)
}