Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

Awesome Lists containing this project

README

        




Easy-Meow


๐Ÿฑ Easy-Meow ๐Ÿฑ


A purr-fect wrapper for WhatsApp automation built on the Whatsmeow backbone


Status: Stable
Version: 1.0.11
Made with: Go


Coding Cat

## ๐Ÿš€ 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


Excited Cat

## ๐ŸŽ‰ 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!


Cat Heart

## ๐Ÿ“ฆ 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 Example

This 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 main

import (
"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!)


Sleeping Cat