Skip to content

Commit

Permalink
moved functions from context_funcs.go to general.go
Browse files Browse the repository at this point in the history
  • Loading branch information
Borbot33 committed Jun 22, 2024
1 parent f23b531 commit 6559042
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions common/templates/context_funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import (
"strconv"
"strings"
"time"
"crypto/sha256"
"encoding/base64"

"github.com/botlabs-gg/yagpdb/v2/bot"
"github.com/botlabs-gg/yagpdb/v2/common"
Expand Down Expand Up @@ -2424,24 +2422,3 @@ func (c *Context) validateDurationDelay(in interface{}) time.Duration {
return ToDuration(t)
}
}

func (c *Context) tmplDecodeBase64(str string) (string, error) {
raw, err := base64.StdEncoding.DecodeString(str)
if err != nil {
return "", err
}
return string(raw), nil
}

func (c *Context) tmplEncodeBase64(str string) string {
return base64.StdEncoding.EncodeToString([]byte(str))
}

func (c *Context) tmplSha256(str string) string {
hash := sha256.New()
hash.Write([]byte(str))

sha256 := base64.URLEncoding.EncodeToString(hash.Sum(nil))

return sha256
}

0 comments on commit 6559042

Please sign in to comment.