-
Notifications
You must be signed in to change notification settings - Fork 128
Updated documentation for chat-members plugin, adding new sections about filters #1181
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
base: main
Are you sure you want to change the base?
Conversation
…out chat member filters
|
🚀 Deployed on https://6908b6b55618fb20d5501152--grammy.netlify.app |
KnorpelSenf
left a comment
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!
KnorpelSenf
left a comment
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! |
KnorpelSenf
left a comment
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 |
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.