utils

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultTimeZone = 8
)

Functions

func CalculateGridPosition

func CalculateGridPosition(gridList []decimal.Decimal, price decimal.Decimal) (int, bool)

func DeleteMessages

func DeleteMessages(botApi *tgbotapi.BotAPI, chatId int64, messagesIds []int, delaySeconds int)

func FormaDate

func FormaDate(t time.Time, timeZone ...int) string

func FormaTime

func FormaTime(t time.Time, timeZone ...int) string

func GenerateGrid

func GenerateGrid(lowerPriceBound, upperPriceBound, takeProfitRatio decimal.Decimal) ([]decimal.Decimal, error)
func GetBlockExplorerAccountLink(chainId int64, account string) string
func GetBlockExplorerTokenLink(chainId int64, token string) string
func GetBlockExplorerTxLink(chainId int64, hash string) string

func GetChatId

func GetChatId(update *tgbotapi.Update) (int64, bool)
func GetDexscreenerTokenLink(chainId int64, token string) string
func GetGmgnAccountLink(chainId int64, account string) string
func GetGmgnTokenLink(chainId int64, token string) string

func GetNetworkName

func GetNetworkName(chainId int64) string
func GetOkxAccountLink(chainId int64, account string) string
func GetOkxTokenLink(chainId int64, token string) string

func ParseTime

func ParseTime(date string, timeZone ...int) (time.Time, error)

func RandomMobileUserAgent

func RandomMobileUserAgent() string

RandomMobileUserAgent generates a random MOBILE browser user-agent on every requests

func RandomUserAgent

func RandomUserAgent() string

RandomUserAgent generates a random DESKTOP browser user-agent on every requests

func ReplyMessage

func ReplyMessage(
	botApi *tgbotapi.BotAPI,
	update tgbotapi.Update,
	text string,
	markup tgbotapi.InlineKeyboardMarkup,
) (tgbotapi.Message, error)

func Retry

func Retry(attempts int, sleep time.Duration, fn func() error) error

func SendMessage

func SendMessage(botApi *tgbotapi.BotAPI, chatId int64, text string) (tgbotapi.Message, error)

func SendMessageAndDelayDeletion

func SendMessageAndDelayDeletion(botApi *tgbotapi.BotAPI, chatId int64, text string, delaySeconds int)

func String

func String(s string) *string

func Tx

func Tx(ctx context.Context, db *ent.Client, callback func(tx *ent.Tx) error) (err error)

Types

type HashEncoder

type HashEncoder struct {
	// contains filtered or unexported fields
}

func NewHashEncoder

func NewHashEncoder(salt string) (*HashEncoder, error)

func (*HashEncoder) Decryption

func (coder *HashEncoder) Decryption(message string) (string, error)

func (*HashEncoder) Encryption

func (coder *HashEncoder) Encryption(message string) (string, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL