Skip to content

Commit 429a6c9

Browse files
committed
更新了qq适配器中的exporter,以支持更多的Button style
1 parent 0d56421 commit 429a6c9

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

  • src/nonebot_plugin_alconna/uniseg/adapters/qq

src/nonebot_plugin_alconna/uniseg/adapters/qq/exporter.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,12 +296,23 @@ def _button(self, seg: Button, bot: Bot | None):
296296
else:
297297
perm = Permission(type=0, specify_user_ids=[i.target for i in seg.permission])
298298
label = str(seg.label)
299+
style_dict = {
300+
"grey": 0,
301+
"secondary": 0,
302+
"blue": 1,
303+
"primary": 1,
304+
"success": 1,
305+
"info": 2,
306+
"warning": 3,
307+
"danger": 3,
308+
"link": 4,
309+
}
299310
return ButtonModel(
300311
id=seg.id or (label if seg.flag == "action" else None),
301312
render_data=RenderData(
302313
label=label,
303314
visited_label=seg.clicked_label or label,
304-
style=0 if seg.style == "secondary" else 1,
315+
style=style_dict[seg.style] if seg.style else 0,
305316
),
306317
action=Action(
307318
type=0 if seg.flag == "link" else 1 if seg.flag == "action" else 2,

0 commit comments

Comments
 (0)