marquesch / marquesch/wacli

Feature: read QR code from client

Open
#8 0 comments 0 reactions 0 assignees View on GitHub
enhancement good first issue
Dominant language
Go
Stars
1
Forks
1
PR merge metrics
No merged PRs in 30d

Description

# Feature Request: Implement QR code reading from client

## 📝 Description
Currently, the QR Code is generated and sent to stdout of the server. That should not be responsibility of the server. Instead, there should be a command to tell the server to connect and, on success, get a QR Code. If the QR Code expires, the user must run the command again.

Since we're now implementing a way to connect, there must be another command that checks the connection.

## 💡 Proposed Solution

The main part of this issue should be achieved with a command `wacli connect`. It'll first check whether the whatsmeow client is connected. If it's false, it should render the most recent QR Code. If the client is already connected, just return a friendly message informing the user.
The command should be idempotent.

Also, it should be implemented a group of commands, e.g. `check`, that'll have, at first only `wacli check connection`. This should return whether or not the user has a valid connection to whatsapp websocket.

## 💻 Example Usage

```bash
# Whatsmeow client already connected to a device
wacli connect
> you are already connected

# Otherwise
wacli connect

# Checking connection
wacli check connection
> connected

wacli check connection
> disconnected
```

### Acceptance Criteria:
- [ ] A new command `wacli connect` is implemented.
- [ ] When the command is used, if the user is not connected, it shows a QR Code to connect to whatsmeow client.
- [ ] When the command is used, if the user is connected, it returns "you are already connected".
- [ ] The command exits with a status code of 0 to indicate success.
- [ ] A new command `wacli check connection` is implemented.
- [ ] When the command is used, if the user is not connected, it returns 'disconnected'. Otherwise, it returns 'connected'.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the existing wacli command entry points and the whatsmeow client connection state. Implement and manually exercise `wacli connect` and `wacli check connection` against both connected and disconnected states. Done means QR output or the already-connected message is correct, connection status is reported, and successful commands exit with status 0.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli, networking
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.