-
Notifications
You must be signed in to change notification settings - Fork 117
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
base: main
Are you sure you want to change the base?
Conversation
…out chat member filters
🚀 Deployed on https://67b5dae99f5f605d1e6a7d88--grammy.netlify.app |
There was a problem hiding this 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!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@roziscoding anything else? |
not at all, this looks great! |
There was a problem hiding this 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.
Co-authored-by: KnorpelSenf <[email protected]>
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? |
Yes, except that I would include it in the existing code group and add comments
but that's just something to try out, I am not saying that I'm sure it's better |
Co-authored-by: Roj <[email protected]>
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? |
There was a problem hiding this 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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
top notch
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.