Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add GroupJoinApprovalMode/GroupMemberAddMode/GroupUpdateDescrip… #660

Merged
merged 6 commits into from
Sep 24, 2024

Conversation

gustavorafaeldev
Copy link
Contributor

This commit introduces new functionality that enables group join approval (GroupJoinApprovalMode), control over how new members are added (GroupMemberAddMode), and the ability to update group descriptions (GroupUpdateDescription).

Copy link

@mateusfmello mateusfmello left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good to me

Copy link

@mateusfmello mateusfmello left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Module name has been changed to the contributor repository, I RECOMMEND REJECTING THE PR.

There is no reason to change the WhatsMeow module.

@gustavorafaeldev
Copy link
Contributor Author

Sorry, I rolled back the module name

Copy link

@mateusfmello mateusfmello left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you change this error message:

if mode != "on" && mode != "off" {
    return fmt.Errorf("invalid mode %q", mode)
}

Therefore:

if mode != "on" && mode != "off" {
    return errors.New("invalid mode, must be 'on' or 'off'")
}

It will help the user to better understand the error.
Leaving it the same as the GroupMemberAddMode method

Copy link

@mateusfmello mateusfmello left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

group.go Outdated

// GroupMemberAddMode sets the group member add mode to 'admin_add' or 'all_member_add'.
func (cli *Client) GroupMemberAddMode(jid types.JID, mode string) error {
if mode != "admin_add" && mode != "all_member_add" {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to use the existing type rather than a string https://pkg.go.dev/go.mau.fi/whatsmeow/types#GroupMemberAddMode

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's done.

group.go Outdated

// GroupJoinApprovalMode sets the group join approval mode to 'on' or 'off'.
func (cli *Client) GroupJoinApprovalMode(jid types.JID, mode string) error {
if mode != "on" && mode != "off" {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it should be a boolean rather than a string

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's done

group.go Outdated Show resolved Hide resolved
group.go Outdated Show resolved Hide resolved
group.go Outdated Show resolved Hide resolved
@tulir tulir merged commit b295fbe into tulir:main Sep 24, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants