Updated documentation for chat-members plugin, adding new sections about filters
This pull request adds documentation for chat member filters in the chat-members plugin section.
https://github.com/grammyjs/chat-members/pull/10
Let me know if the paragraph structure or anything else could be improved.
🚀 Deployed on https://6908b6b55618fb20d5501152--grammy.netlify.app
@roziscoding anything else?
@roziscoding anything else?
not at all, this looks great! thanks @rayz1065!
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?
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
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?
@LWJerri @niusia-ua do you think it is better to translate the SVG file, too?
@KnorpelSenf No, I don't think so. In that image, terms are used as actual values in code. They are not something to translate.
That's a great point. Let's leave it like it is.