Skip to content

feat: check if bot is admin before group management#85

Merged
toto04 merged 2 commits intomainfrom
add-admin-check
Apr 11, 2026
Merged

feat: check if bot is admin before group management#85
toto04 merged 2 commits intomainfrom
add-admin-check

Conversation

@lorenzocorallo
Copy link
Copy Markdown
Member

No description provided.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 11, 2026

Warning

Rate limit exceeded

@lorenzocorallo has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 17 minutes and 44 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 17 minutes and 44 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7795820d-3d49-48e9-a858-71b39ef609b2

📥 Commits

Reviewing files that changed from the base of the PR and between 05474d4 and 9961402.

📒 Files selected for processing (1)
  • src/lib/group-management/index.ts

Walkthrough

Added an upfront administrator privilege check to GroupManagement.create and GroupManagement.update methods that validates the bot's status before fetching chat information or handling invite links, returning an error if the bot lacks administrator privileges.

Changes

Cohort / File(s) Summary
Bot Privilege Verification
src/lib/group-management/index.ts
Added upfront administrator status validation in create and update methods via modules.shared.api.getChatMember() check, with early error return if bot is not an administrator.

Possibly related PRs

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change: adding an upfront bot-privilege check before group management operations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/lib/group-management/index.ts`:
- Around line 92-99: In GroupManagement.update, the logger.error call uses the
wrong operation label ("Cannot CREATE group"); update the message string to
"Cannot UPDATE group" so the log reflects the update-path failure — locate the
logger.error usage that follows the getChatMember call (the block that sets
reason = "The bot is not an administrator") and change its message argument from
"[GroupManagement] Cannot CREATE group" to "[GroupManagement] Cannot UPDATE
group".
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3927c26b-56d3-4d5d-89d7-178be12655a7

📥 Commits

Reviewing files that changed from the base of the PR and between b25e1de and 05474d4.

📒 Files selected for processing (1)
  • src/lib/group-management/index.ts

Comment thread src/lib/group-management/index.ts
@lorenzocorallo lorenzocorallo requested a review from toto04 April 11, 2026 15:49
@toto04 toto04 merged commit 8232a74 into main Apr 11, 2026
2 checks passed
@toto04 toto04 deleted the add-admin-check branch April 11, 2026 15:51
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.

2 participants