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

Updated documentation for chat-members plugin, adding new sections about filters #1181

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

rayz1065
Copy link
Member

This pull request adds documentation for chat member filters in the chat-members plugin section.

grammyjs/chat-members#10

Let me know if the paragraph structure or anything else could be improved.

Copy link

github-actions bot commented Jan 23, 2025

@github-actions github-actions bot temporarily deployed to pull request January 23, 2025 14:18 Inactive
Copy link
Member

@KnorpelSenf KnorpelSenf left a comment

Choose a reason for hiding this comment

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

Got a few things here and there, mostly nitpicks. Thanks for the extensive docs, though, we need more people like you who do this!

@github-actions github-actions bot temporarily deployed to pull request January 24, 2025 11:37 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 24, 2025 12:04 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 27, 2025 22:51 Inactive
@rayz1065 rayz1065 requested a review from KnorpelSenf January 28, 2025 09:23
Copy link
Member

@KnorpelSenf KnorpelSenf left a comment

Choose a reason for hiding this comment

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

LGTM

@KnorpelSenf
Copy link
Member

@roziscoding anything else?

@roziscoding
Copy link
Contributor

@roziscoding anything else?

not at all, this looks great!
thanks @rayz1065!

@KnorpelSenf KnorpelSenf requested a review from rojvv January 30, 2025 14:02
@github-actions github-actions bot temporarily deployed to pull request February 6, 2025 15:21 Inactive
Copy link
Member

@KnorpelSenf KnorpelSenf left a comment

Choose a reason for hiding this comment

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

LGTM.

If you want, you can add a few lines to the existing code example and contrast it with the code that is necessary without this plugin. This would be similar to how the explanations for the hydrate plugin work. This is just an idea, feel free to ignore it—I approve either way.

@github-actions github-actions bot temporarily deployed to pull request February 14, 2025 10:43 Inactive
@rayz1065
Copy link
Member Author

add a few lines to the existing code example and contrast it with the code

Were you thinking something like:

In contrast, filtering for users joining a group/supergroup without this plugin would require the following code:

// filter for users joining the group without the plugin
bot
  .chatType(["group", "supergroup"])
  .on("chat_member")
  .filter(
    (ctx) => {
      const { old_chat_member: oldMember, new_chat_member: newMember } =
        ctx.chatMember;
      return (
        (["kicked", "left"].includes(oldMember.status) ||
          (oldMember.status === "restricted" && !oldMember.is_member)) &&
        (["administrator", "creator", "member"].includes(newMember.status) ||
          (newMember.status === "restricted" && newMember.is_member))
      );
    },
    (ctx) => {
      ctx.chatMember.new_chat_member.status; // type is not narrowed :(
    }
  );

Right after the code-group showing the various filters?

@KnorpelSenf
Copy link
Member

Yes, except that I would include it in the existing code group and add comments

// WITHOUT this plugin:
complexCode
// WITH this plugin:
easyCode

but that's just something to try out, I am not saying that I'm sure it's better

@github-actions github-actions bot temporarily deployed to pull request February 17, 2025 12:00 Inactive
@github-actions github-actions bot temporarily deployed to pull request February 19, 2025 11:17 Inactive
@github-actions github-actions bot temporarily deployed to pull request February 19, 2025 11:24 Inactive
@rayz1065
Copy link
Member Author

Yes, except that I would include it in the existing code group and add comments

I included that snippet within the code group, I think it's a nice addition as it makes for some nice contrast, let me know if it should be changed in some way.

Thank you @rojvv for the review!

Is there anything else that should be changed before this PQ is ready for translation?

@rayz1065 rayz1065 requested a review from rojvv February 19, 2025 12:08
Copy link
Member

@KnorpelSenf KnorpelSenf left a comment

Choose a reason for hiding this comment

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

Looks great! Just two minor details

@rayz1065 rayz1065 requested a review from KnorpelSenf February 19, 2025 13:20
@github-actions github-actions bot temporarily deployed to pull request February 19, 2025 13:22 Inactive
Copy link
Member

@KnorpelSenf KnorpelSenf left a comment

Choose a reason for hiding this comment

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

top notch

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.

5 participants