{"id":16486006,"url":"https://github.com/roziscoding/grammy-chat-members","last_synced_at":"2026-06-13T10:32:48.469Z","repository":{"id":105784225,"uuid":"565158526","full_name":"roziscoding/grammy-chat-members","owner":"roziscoding","description":null,"archived":false,"fork":false,"pushed_at":"2023-02-22T02:11:37.000Z","size":15,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-26T02:19:34.301Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/roziscoding.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-12T14:22:02.000Z","updated_at":"2022-12-23T22:41:11.000Z","dependencies_parsed_at":"2023-06-13T21:30:50.058Z","dependency_job_id":null,"html_url":"https://github.com/roziscoding/grammy-chat-members","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":"grammyjs/plugin-template","purl":"pkg:github/roziscoding/grammy-chat-members","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roziscoding%2Fgrammy-chat-members","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roziscoding%2Fgrammy-chat-members/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roziscoding%2Fgrammy-chat-members/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roziscoding%2Fgrammy-chat-members/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roziscoding","download_url":"https://codeload.github.com/roziscoding/grammy-chat-members/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roziscoding%2Fgrammy-chat-members/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34281700,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-13T02:00:06.617Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T13:28:04.501Z","updated_at":"2026-06-13T10:32:48.450Z","avatar_url":"https://github.com/roziscoding.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Chat members plugin for grammY\n\nThis plugin watches for `chat_member` updates and stores a list of users, their statuses and permissions for each chat\nin which they and the bot are a member.\n\n## Usage\n\n### Storing chat members\n\nYou can use a valid grammY [storage adapter](https://grammy.dev/plugins/session.html#known-storage-adapters) or an\ninstance of any class that implements the [`StorageAdapter`](https://deno.land/x/grammy/mod.ts?s=StorageAdapter)\ninterface.\n\n```typescript\nimport { Bot, Context, MemorySessionStorage } from \"https://deno.land/x/grammy/mod.ts\";\nimport type { ChatMember } from \"https://deno.land/x/grammy/types.ts\";\nimport { chatMembers, ChatMembersFlavor } from \"https://deno.land/x/grammy_chat_members/mod.ts\";\n\ntype MyContext = Context \u0026 ChatMembersFlavor;\n\nconst adapter = new MemorySessionStorage\u003cChatMember\u003e();\n\nconst bot = new Bot\u003cMyContext\u003e(\"\u003cyour bot token\u003e\");\n\nbot.use(chatMembers(adapter));\n\nbot.start({\n  allowed_updates: [\"chat_member\", \"message\"],\n  onStart: ({ username }) =\u003e console.log(`Listening as ${username}`),\n});\n```\n\n### Reading chat member info\n\nThis plugin also adds a new `ctx.chatMembers.getChatMember` function that will check the storage for information about a\nchat member before querying telegram for it. If the chat member exists in the storage, it will be returned. Otherwise,\n`ctx.api.getChatMember` will be called and the result will be saved to the storage, making subsequent calls faster and\nremoving the need to call telegram again for that user and chat in the future.\n\nHere's an example:\n\n```typescript\nbot.on(\"message\", async (ctx) =\u003e {\n  const chatMember = await ctx.chatMembers.getChatMember();\n\n  return ctx.reply(`Hello, ${chatMember.user.first_name}! I see you are a ${chatMember.status} of this chat!`);\n});\n```\n\nThe second parameter, which is the chat id, is optional; if you don't provide it, `ctx.chat.id` will be used instead.\nPlease notice that, if you don't provide a chat id and there's no `chat` property inside the context (for example: on\ninline query updates), this will throw an error.\n\n## Aggressive storage\n\nThe `enableAggressiveStorage` config option will install middleware to cache chat members without depending on the\n`chat_member` event. For every update, the middleware checks if `ctx.chat` and `ctx.from` exist. If they both do, it\nthen proceeds to call `ctx.chatMembers.getChatMember` to add the chat member information to the storage in case it\ndoesn't exist.\n\nPlease note that this means the storage will be called for **every update**, which may be a lot, depending on how many\nupdates your bot receives. This also has the potential to impact the performance of your bot drastically. Only use this\nif you _really_ know what you're doing and are ok with the risks and consequences.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froziscoding%2Fgrammy-chat-members","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froziscoding%2Fgrammy-chat-members","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froziscoding%2Fgrammy-chat-members/lists"}