Dwaz 5alina men lmar9a kat3reb tsaybe bot b dwaz?
Dwaz is a lightweight and modern Discord API wrapper written in Go, designed for developers building Discord bots or integrations. With a focus on simplicity and performance, Dwaz provides an intuitive interface to interact with Discord's API, leveraging Go's concurrency features for efficient bot development. The name "Zwafriya," inspired by Moroccan Arabic.
To use Dwaz in your Go project, install it via:
go get github.com/marouanesouiri/dwazEnsure you have Go 1.22 or later installed, as specified in the project’s go.mod.
Here’s a basic Ping Pong example to get started with Dwaz:
package main
import (
"github.com/marouanesouiri/dwaz"
"context"
"fmt"
)
func main() {
// Initialize a new Dwaz client
client := dwaz.New(
context.TODO(),
dwaz.WithToken("YOUR_BOT_TOKEN"),
dwaz.WithIntents(dwaz.GatewayIntentGuildMessages, dwaz.GatewayIntentMessageContent),
)
// Add message create even handlers
client.OnMessageCreate(func(event dwaz.MessageCreateEvent) {
if event.Message.Content == "!ping" {
fmt.Println("Pong!")
}
})
// Start the bot
client.Start()
}Replace YOUR_BOT_TOKEN with your Discord bot token. Check the documentation for more examples and API details.