gofluxer is an API wrapper that allows you to create fluxer.app bots as well as use fluxer.app webhooks
If you need help with using the gofluxer package, join the gofluxer Fluxer server.
NOTICE: This library is still a heavy work in progress. Expect unfinished and buggy features.
This Go package is not officially endorsed by or affiliated with fluxer.app
This assumes you already have a Go environment on your system. If not, download Go from here. Make sure you have Go 1.21 or newer.
Install gofluxer by using the following command.
go get github.com/go-fluxer/gofluxerAfter installing the package, import the gostoat package using this within your code.
import (
"fmt"
"strings"
"github.com/go-fluxer/gofluxer"
)Here is a basic example of a ping pong bot.
package main
import (
"fmt"
"strings"
"github.com/go-fluxer/gofluxer"
)
func main() {
bot := gofluxer.NewBot("FLUXERBOTTOKEN", "!")
// Replace FLUXERBOTTOKEN with your actual fluxer.app bot token.
// bot.NewBotInstance("https://example.com/api/v1", "wss://example.com/gateway/?v=1")
// Use a 3rd party Fluxer instance with NewBotInstance
bot.OnMessage(func(m *gofluxer.Message) {
fmt.Printf("[%s]: %s\n", m.Author.Username, m.Content)
if strings.ToLower(m.Content) == "ping" {
bot.SendMessage(m.ChannelID, "Pong!")
}
})
bot.Run()
}You can refer to the examples directory for more examples to see how to use this Go package
- Added support for using 3rd party Fluxer instances with a new bot function: NewBotInstance
- The reconnection logic should now work this time.
- Updated the example_pingpong.go example and the example_commands.go example.
- gofluxer will now try to reconnect if connection to fluxer has dropped.
- Updated heartbeat to fix a potiental issue where data could still try to be sent to closed connections.
- The first early release version of gofluxer.
- Supports message and command handlers.
- Supports NSFW channel and bot owner checks.
- Supports sending messages to webhooks.
- Uses Apache License 2.0.
- Added a example_pingpong.go example and a example_commands.go example.