Tebex is a library designed for Dragonfly servers, facilitating integration with the Tebex platform for managing online stores. With Tebex, you can seamlessly connect your Dragonfly server with your Tebex store, enabling features such as in-game purchases, virtual currency, and more. Getting Started Creating a New Store Instance
To initialize a Tebex store instance in your Dragonfly server, follow these steps:
// loadStore initializes the Tebex store connection.
func loadStore(key string, log *logrus.Logger) *tebex.Client {
store := tebex.NewClient(log, time.Second*5, key)
name, domain, err := store.Information()
if err != nil {
log.Fatalf("tebex: %v", err)
return nil
}
log.Infof("Connected to Tebex under %v (%v).", name, domain)
return store
}
key := os.Getenv("TEBEX_KEY")
log := logrus.New()
store := loadStore(key, log)
Call the ExecuteCommands method on the Tebex client instance when a player joins the server:
func acceptFunc(store *tebex.Client) func(p *player.Player) {
return func(p *player.Player) {
store.ExecuteCommands(p)
}
}