-
Notifications
You must be signed in to change notification settings - Fork 609
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
🐛 修复功能少时zhenxun帮助图片排序问题 #1620
🐛 修复功能少时zhenxun帮助图片排序问题 #1620
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,7 +111,7 @@ async def build_ss_image(self, bot_id: str, group_id: str | None) -> bytes: | |
) | ||
max_len = 0 | ||
flag_index = -1 | ||
max_data = None | ||
max_data = {} | ||
plugin_list = [] | ||
for index, plu in enumerate(classify.keys()): | ||
data = { | ||
|
@@ -124,9 +124,24 @@ async def build_ss_image(self, bot_id: str, group_id: str | None) -> bytes: | |
max_data = data | ||
plugin_list.append(data) | ||
del plugin_list[flag_index] | ||
plugin_list.insert(0, max_data) | ||
# plugin_list.insert(0, max_data) | ||
_data = [] | ||
_left = 30 | ||
_pu1 = [] | ||
_pu2 = [] | ||
for i in range(len(max_data["items"])): | ||
if i % 2: | ||
_pu1.append(max_data["items"][i]) | ||
else: | ||
_pu2.append(max_data["items"][i]) | ||
_plugins = [(30, 50, _pu1), (0, 50, _pu2)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 建议: 用命名常量替换魔法数字 这个代码块中的硬编码值(30, 50, 0, 100)可以通过命名常量替换来受益。这将提高可读性和可维护性。考虑在文件顶部或配置文件中定义这些常量。
Original comment in Englishsuggestion: Replace magic numbers with named constants The hardcoded values (30, 50, 0, 100) in this block could benefit from being replaced with named constants. This would improve readability and maintainability. Consider defining these at the top of the file or in a configuration file.
|
||
_data.append( | ||
{ | ||
"name": max_data["name"], | ||
"items": [(30, 50, _pu1), (0, 50, _pu2)], | ||
"width": 100, | ||
} | ||
) | ||
for plugin in plugin_list: | ||
_plugins = [] | ||
width = 50 | ||
|
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.
建议: 如果不再需要,请删除注释掉的代码
如果这行代码不再需要,最好完全删除它,而不是将其注释掉。这有助于保持代码的整洁和可读性。
Original comment in English
suggestion: Remove commented-out code if no longer needed
If this line is no longer needed, it's better to remove it entirely rather than leaving it commented out. This helps maintain cleaner, more readable code.