群组动作
大约 2 分钟
群组动作
标准
获取群信息action: get_group_info
字段名 | 数据类型 | 说明 |
---|---|---|
group_id | string | 群 ID |
字段名 | 数据类型 | 说明 |
---|---|---|
group_id | string | 群 ID |
group_name | string | 群名称 |
wx.avatar | string | 拓展字段: 群头像url |
{
"action": "get_group_info",
"params": {
"group_id": "1234567"
}
}
{
"status": "ok",
"retcode": 0,
"data": {
"group_id": "1234567",
"group_name": "nb2",
"wx.avatar": "https://wx.qlogo.cn/mmhead/ver_1/xxx/0"
},
"message": ""
}
from nonebot.adapters.onebot.v12 import Bot, MessageSegment
from nonebot import get_bot
async def test():
bot = get_bot()
group_info = await bot.get_group_info(group_id="1234567")
标准
获取群列表action: get_group_list
无
群信息列表,数据类型为 list[resp[get_group_info
]]。
{
"action": "get_group_list",
"params": {}
}
{
"status": "ok",
"retcode": 0,
"data": [
{
"group_id": "1234567",
"group_name": "nb2",
},
{
"group_id": "1234568",
"group_name": "nb2",
}
],
"message": ""
}
from nonebot.adapters.onebot.v12 import Bot, MessageSegment
from nonebot import get_bot
async def test():
bot = get_bot()
group_list = await bot.get_group_list()
标准
获取群成员信息action: get_group_member_info
字段名 | 数据类型 | 说明 |
---|---|---|
group_id | string | 群 ID |
user_id | string | 用户 ID |
字段名 | 数据类型 | 说明 |
---|---|---|
user_id | string | 用户 ID |
user_name | string | 昵称 |
user_displayname | string | 为空 |
wx.avatar | string | 拓展字段: 头像url |
wx.wx_number | string | 拓展字段: 微信号 |
wx.nation | string | 拓展字段: 国家 |
wx.province | string | 拓展字段: 省份 |
wx.city | string | 拓展字段: 城市 |
{
"action": "get_group_member_info",
"params": {
"group_id": "1234567",
"user_id": "1234567"
}
}
{
"status": "ok",
"retcode": 0,
"data": {
"user_id": "1234567",
"user_name": "nb2",
"user_displayname": "",
"wx.avatar": "https://wx.qlogo.cn/mmhead/ver_1/xxx/0",
"wx.wx_number": "nb2",
"wx.nation": "中国",
"wx.province": "广东",
"wx.city": "深圳"
},
"message": ""
}
from nonebot.adapters.onebot.v12 import Bot, MessageSegment
from nonebot import get_bot
async def test():
bot = get_bot()
group_member_info = await bot.get_group_member_info(group_id="1234567", user_id="1234567")
标准
获取群成员列表action: get_group_member_list
字段名 | 数据类型 | 说明 |
---|---|---|
group_id | string | 群 ID |
群成员信息列表,数据类型为 list[resp[get_group_member_info
]]。
{
"action": "get_group_member_list",
"params": {
"group_id": "1234567"
}
}
{
"status": "ok",
"retcode": 0,
"data": [
{
"user_id": "1234567",
"user_name": "nb2",
"user_displayname": "",
"wx.avatar": "https://wx.qlogo.cn/mmhead/ver_1/xxx/0",
"wx.wx_number": "nb2",
"wx.nation": "中国",
"wx.province": "广东",
"wx.city": "深圳"
},
{
"user_id": "1234568",
"user_name": "nb2",
"user_displayname": "",
"wx.avatar": "https://wx.qlogo.cn/mmhead/ver_1/xxx/0",
"wx.wx_number": "nb2",
"wx.nation": "中国",
"wx.province": "广东",
"wx.city": "深圳"
}
],
"message": ""
}
from nonebot.adapters.onebot.v12 import Bot, MessageSegment
from nonebot import get_bot
async def test():
bot = get_bot()
group_member_list = await bot.get_group_member_list(group_id="1234567")
标准
设置群名称action: set_group_name
字段名 | 数据类型 | 说明 |
---|---|---|
group_id | string | 群 ID |
group_name | string | 群名称 |
无
{
"action": "set_group_name",
"params": {
"group_id": "1234567",
"group_name": "nb2"
}
}
{
"status": "ok",
"retcode": 0,
"data": null,
"message": ""
}
from nonebot.adapters.onebot.v12 import Bot, MessageSegment
from nonebot import get_bot
async def test():
bot = get_bot()
await bot.set_group_name(group_id="1234567", group_name="nb2")
标准
退出群action: leave_group
未实现