refactor: 使用kook接口中获取的bot_id判断是否过滤来自bot自身的信息,而不是用户手动输入的bot_nickname来判断#5705
refactor: 使用kook接口中获取的bot_id判断是否过滤来自bot自身的信息,而不是用户手动输入的bot_nickname来判断#5705shuiping233 wants to merge 2 commits intoAstrBotDevs:masterfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 此拉取请求旨在提升 KOOK 平台适配器的消息处理准确性和用户体验。通过直接利用 KOOK 接口提供的 Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Hey - 我在这里给了一些高层次的反馈:
- 在
_should_ignore_event_by_bot_self中,建议考虑对self.client.bot_id为None或未设置的情况进行保护(例如,当其为假值时直接返回False),以避免在客户端尚未完全初始化之前出现意外行为。 - 之前的过滤逻辑使用的是
extra.author,而新版本使用的是author_id;请再次确认所有受支持的 KOOK 消息事件类型(例如类型 9 和 10)是否都能稳定地在顶层包含author_id字段,或者添加一个简短注释说明这是一个前提假设。
给 AI 代理的提示
Please address the comments from this code review:
## Overall Comments
- In `_should_ignore_event_by_bot_self`, consider guarding against `self.client.bot_id` being `None` or unset (e.g., return `False` if it's falsy) to avoid unexpected behavior before the client has fully initialized.
- Previously the filter logic used `extra.author` while the new version uses `author_id`; please double-check that all supported KOOK message event types (e.g., type 9 and 10) reliably include `author_id` at the top level, or add a brief comment explaining this assumption.帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续的评审。
Original comment in English
Hey - I've left some high level feedback:
- In
_should_ignore_event_by_bot_self, consider guarding againstself.client.bot_idbeingNoneor unset (e.g., returnFalseif it's falsy) to avoid unexpected behavior before the client has fully initialized. - Previously the filter logic used
extra.authorwhile the new version usesauthor_id; please double-check that all supported KOOK message event types (e.g., type 9 and 10) reliably includeauthor_idat the top level, or add a brief comment explaining this assumption.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `_should_ignore_event_by_bot_self`, consider guarding against `self.client.bot_id` being `None` or unset (e.g., return `False` if it's falsy) to avoid unexpected behavior before the client has fully initialized.
- Previously the filter logic used `extra.author` while the new version uses `author_id`; please double-check that all supported KOOK message event types (e.g., type 9 and 10) reliably include `author_id` at the top level, or add a brief comment explaining this assumption.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
ce41798 to
931e01c
Compare
|
#5719 已经把这个包含了,所以关掉这个pr) def _should_ignore_event_by_bot_nickname(self, author_id: str) -> bool:
return self.client.bot_id == author_id |
Modifications / 改动点
Screenshots or Test Results / 运行截图或测试结果
Checklist / 检查清单
requirements.txt和pyproject.toml文件相应位置。/ I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations inrequirements.txtandpyproject.toml.Summary by Sourcery
使用来自平台客户端的 KOOK 机器人 ID 来识别并忽略由机器人自身发送的消息,并移除现已不再需要的机器人昵称配置。
Bug Fixes:
Enhancements:
Original summary in English
Summary by Sourcery
Use KOOK bot ID from the platform client to identify and ignore messages sent by the bot itself, and remove the now-unnecessary bot nickname configuration.
Bug Fixes:
Enhancements: