Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hacxk/easy-meow
A Go package simplifying WhatsApp interactions using whatsmeow. Build bots, send messages, and more with ease & less code @whatsmeow
https://github.com/hacxk/easy-meow
baileys easy-baileys easy-meow go golang mdp multi-device whatsapp whatsapp-api whatsapp-bot whatsapp-web whatsmeow whatsmeow-bot
Last synced: about 1 month ago
JSON representation
A Go package simplifying WhatsApp interactions using whatsmeow. Build bots, send messages, and more with ease & less code @whatsmeow
- Host: GitHub
- URL: https://github.com/hacxk/easy-meow
- Owner: hacxk
- License: other
- Created: 2024-07-15T12:30:09.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-07-17T11:58:40.000Z (4 months ago)
- Last Synced: 2024-10-01T07:23:33.392Z (about 1 month ago)
- Topics: baileys, easy-baileys, easy-meow, go, golang, mdp, multi-device, whatsapp, whatsapp-api, whatsapp-bot, whatsapp-web, whatsmeow, whatsmeow-bot
- Language: Go
- Homepage:
- Size: 23.4 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
๐ฑ Easy-Meow ๐ฑ
A purr-fect wrapper for WhatsApp automation built on the Whatsmeow backbone
## ๐ About Easy-Meow
Easy-Meow is a Go package that simplifies WhatsApp automation. Built on the powerful Whatsmeow backbone, it reduces boilerplate and makes WhatsApp bot development a breeze!
### ๐ Key Features
- ๐ Less code, more functionality
- ๐ Built on the robust Whatsmeow framework
- ๐ Simplified API for common WhatsApp operations
- ๐ฑ Purr-fectly easy to integrate into your projects
## ๐ What's New in v1.0.1
- **Diverse Message Types:**
- **Text:** ๐ Send plain text messages effortlessly.
- **Images:** ๐ธ Share images with optional captions.
- **Videos:** ๐ฅ Send videos with captions.
- **Audio:** ๐ต Share audio files (including PTT โ push-to-talk).
- **Documents:** ๐ Send documents with filenames and captions.
- **Stickers:** ๐ Share your favorite stickers.
- **GIFs:** ๐บ Send animated GIFs with captions.
- **Mentions:** ๐ฅ Tag users in messages.
- **Phone Numbers:** ๐ Send messages with clickable phone numbers.
- **Reactions:** ๐ Add emojis to react to messages.- **Advanced Functionality:**
- **Replies:** ๐ Reply to specific messages.
- **Edits:** โ๏ธ Modify previously sent messages.
- **Deletion:** ๐๏ธ Delete messages you've sent.## ๐ฎ Future Plans
- ๐ Comprehensive documentation
- ๐งช Example projects
- ๐จ Customizable themes for bot responses
- ๐ Multi-language support## ๐ Stay Updated
Want to be notified about updates? Star this repository and watch for the latest news!
## ๐ฆ Usage
To get started with Easy-Meow, follow these steps:
1. Initialize a new Go module:
```sh
go mod init
```2. Get the Easy-Meow package:
```sh
go get github.com/hacxk/easy-meow
```3. Tidy up the module dependencies:
```sh
go mod tidy
```4. Import and use Easy-Meow in your Go code:
Here's a beautifully formatted `README.md` usage example for your Go program:
```markdown
# WhatsApp Client ExampleThis example demonstrates how to use the custom WhatsApp client to handle events and send messages using the `easy-meow` package.
## Usage
### Import the Necessary Packages
```go
package mainimport (
"context"
"fmt"
"log"whatsappclient "github.com/hacxk/easy-meow/Client" // Importing your custom WhatsApp client package
"go.mau.fi/whatsmeow/types/events" // Importing events from the WhatsMeow library
)// ### Define the Event Handler Function
// Define the event handler function
func myEventHandler(client *whatsappclient.WhatsAppClient, evt interface{}) {
// Type switch to handle different event types
switch v := evt.(type) {
case *events.Message:
// Extract message text from the message event (handle both conversation and extended messages)
var messageText string
if v.Message.Conversation != nil {
messageText = *v.Message.Conversation // Extract text from Conversation message
} else if v.Message.ExtendedTextMessage != nil {
messageText = *v.Message.ExtendedTextMessage.Text // Extract text from ExtendedTextMessage
}// Print image message info (if available) and sender details
fmt.Print(v.Message.ImageMessage)
fmt.Printf("Received a message from %s (%s): %s\n", v.Info.Sender.String(), v.Info.Chat.String(), messageText)// Check if the received message text is "hi"
if messageText == "hi" {sock := client.GetClient() // Get the underlying client
// Send a reply message
_, err := sock.Reply(v, "Hello! ๐")
if err != nil {
log.Printf("Error sending reply: %v", err) // Log any error encountered while sending reply
}
}case *events.Receipt:
// Handle receipt events
fmt.Printf("Received a receipt: %+v\n", v)
}
}// ### Main Function
func main() {
ctx := context.Background() // Create a context for managing the connection// Initialize the WhatsApp client with a store (database) file
client, err := whatsappclient.NewWhatsAppClient("examplestore.db")
if err != nil {
log.Fatalf("Failed to create client: %v", err) // Log and exit if client creation fails
}// Connect the client
err = client.Connect(ctx)
if err != nil {
log.Fatalf("Failed to connect: %v", err) // Log and exit if connection fails
}// Add the event handler to the client
client.AddEventHandler(func(evt interface{}) {
myEventHandler(client, evt) // Call the event handler with each received event
})// Check for any errors in sending the message
if err != nil {
log.Printf("Failed to send message: %v", err) // Log any error encountered while sending a message
} else {
fmt.Println("Message sent successfully") // Confirm successful message sending
}// Keep the program running
fmt.Println("Client is running. Press Ctrl+C to exit.") // Inform the user that the client is running
select {} // Block indefinitely to keep the program running
}
```## ๐ Credits
This project stands on the shoulders of giants:
- [Whatsmeow](https://github.com/tulir/whatsmeow) - The powerful backbone of Easy-Meow.
## ๐ License
MIT
Made with โค๏ธ by HACXK (Me Solo!)