import { Context, Schema } from 'koishi'
export const name = 'get-qq-bot-transfer-link'
export interface Config { }
export const Config: Schema<Config> = Schema.object({})
export function apply(ctx: Context, config: Config) {
// write your plugin here
// 请使用napcat调用这个接口, adapter-onebot
ctx.command('napcat-getuser [userId:string]')
.action(async ({ session }, userId) => {
// const user = await session.bot.getUser(targetUserId, session.channelId);
const user = await session?.bot.internal._request('get_stranger_info', { user_id: userId });
await session?.send(`用户信息:${JSON.stringify(user)}`)
})
ctx.command('qqbot-url <userId:string>')
//userId是qq官bot的qq号
.action(async ({ session }, userId) => {
const groupCode = session?.guildId;
const botInfo = await session?.bot.internal._request('get_stranger_info', { user_id: userId });
const botUid = botInfo?.data?.uid || '';
const jsonObj = {
page_name: "ai_group_service_agreement_pop_page",
groupCode: Number(groupCode),
botUin: Number(userId),
botUid: botUid,
screen: 1,
};
const encoded = encodeURIComponent(JSON.stringify(jsonObj));
const url = `https://club.vip.qq.com/transfer?open_kuikly_info=${encoded}`;
await session?.send(`官Bot全量主动配置链接(安卓和iOSQQ 9.2.90及以上版本可用。iOS也可以直接去设置里配置):\n${url}`);
})
}
1 个赞
应开发群 群u要求,发了npm,适配了官bot的markdown和按钮,这里是新的markdown:
1 个赞
koishi-plugin-get-qq-bot-transfer-link
利用NapCat获取官bot的uid,然后获取本群的 开放官bot的全量和主动的配置链接,然后群主用手机qq打开就可以配置了
配置项
| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
useMarkdown |
boolean | true |
QQ平台使用 Markdown 富文本发送 |
addJumpButton |
boolean | true |
消息底部添加「打开配置链接」跳转按钮 |
defaultBotUin |
string | "" |
默认官Bot QQ号(option 兜底) |
defaultBotUid |
string | "" |
默认官Bot UID(option 兜底) |
defaultGroupCode |
string | "" |
默认群号(option 兜底,再兜底到当前群) |
showBotInfo |
boolean | false |
消息中显示 botUin / botUid / groupCode |
showImage |
boolean | true |
链接/按钮上方附带操作提示图片 |
imageUrl |
string | gitee raw 直链 | 操作提示图片 URL |
imageWidth |
string | 1080px |
Markdown 图片宽度 |
imageHeight |
string | 888px |
Markdown 图片高度 |
指令
napcat-getuser [userId]
通过 napcat onebot 接口查询用户信息。仅在 onebot 平台可用。
qqbot-url
生成官Bot全量主动配置链接。
选项:
| 选项 | 缩写 | 说明 |
|---|---|---|
--botuin |
-u |
官Bot的QQ号 |
--botuid |
-i |
官Bot的UID |
--groupcode |
-g |
群号 |
优先级: --option 传参 > 配置项兜底值 > 报错提示
效果
1 个赞




