-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
665 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# https://q.qq.com/qqbot/#/developer/developer-setting | ||
QQ_BOT_APP_ID= | ||
QQ_BOT_APP_TOKEN= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export const ylfTestGuildID = '8023676110463580325' | ||
export const xyLabSubGuildId = '665652769' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
import { MessageToCreate } from 'qq-guild-bot' | ||
|
||
/** | ||
* @see https://bot.q.qq.com/wiki/develop/nodesdk/message/message_template.html#list-%E7%BB%93%E6%9E%84 | ||
*/ | ||
export const arkTemplateMessage: MessageToCreate = { | ||
ark: { | ||
template_id: 23, | ||
kv: [ | ||
{ | ||
key: '#DESC#', | ||
value: 'descaaaaaa', | ||
}, | ||
{ | ||
key: '#PROMPT#', | ||
value: 'promptaaaa', | ||
}, | ||
{ | ||
key: '#LIST#', | ||
obj: [ | ||
{ | ||
obj_kv: [ | ||
{ | ||
key: 'desc', | ||
value: '需求标题:UI问题解决', | ||
}, | ||
], | ||
}, | ||
{ | ||
obj_kv: [ | ||
{ | ||
key: 'desc', | ||
value: '当前状态"体验中"点击下列动作直接扭转状态到:', | ||
}, | ||
], | ||
}, | ||
{ | ||
obj_kv: [ | ||
{ | ||
key: 'desc', | ||
value: '已评审', | ||
}, | ||
{ | ||
key: 'link', | ||
// value: 'https://yunyoujun.cn/about', | ||
}, | ||
], | ||
}, | ||
{ | ||
obj_kv: [ | ||
{ | ||
key: 'desc', | ||
value: '已排期', | ||
}, | ||
{ | ||
key: 'link', | ||
// value: 'https://yunyoujun.cn/about', | ||
}, | ||
], | ||
}, | ||
{ | ||
obj_kv: [ | ||
{ | ||
key: 'desc', | ||
value: '开发中', | ||
}, | ||
{ | ||
key: 'link', | ||
// value: 'https://yunyoujun.cn/about', | ||
}, | ||
], | ||
}, | ||
{ | ||
obj_kv: [ | ||
{ | ||
key: 'desc', | ||
value: '增量测试中', | ||
}, | ||
{ | ||
key: 'link', | ||
// value: 'https://yunyoujun.cn/about', | ||
}, | ||
], | ||
}, | ||
{ | ||
obj_kv: [ | ||
{ | ||
key: 'desc', | ||
value: '请关注', | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
], | ||
} as any, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import { consola, defineBotPlugin } from 'el-bot' | ||
import colors from 'picocolors' | ||
|
||
export default defineBotPlugin({ | ||
pkg: { | ||
name: 'qq', | ||
}, | ||
setup: async (ctx) => { | ||
const { qq } = ctx | ||
if (!qq) | ||
return | ||
|
||
const { client, ws } = qq | ||
|
||
const { data } = await client.meApi.me() | ||
consola.info('QQ 频道机器人', colors.green(data.username), colors.dim(data.union_openid)) | ||
|
||
// const channelsRes = await client.channelApi.channels(ylfTestGuildID) | ||
// const channels = channelsRes.data as IChannel[] | ||
|
||
ws.on('GUILD_MESSAGES', (data) => { | ||
consola.info('GUILD_MESSAGES', data) | ||
|
||
const channelId = data.msg.channel_id | ||
// 主动消息不能在00:00:00 - 05:59:59 推送 | ||
client.messageApi | ||
.postMessage(channelId, { | ||
content: '2', | ||
msg_id: data.msg.id, | ||
}) | ||
|
||
// 链接、文本列表模板 | ||
// client.messageApi.postMessage(channelId, { | ||
// ark: arkTemplateMessage.ark, | ||
// }) | ||
|
||
// keyboard | ||
// 无 markdown 权限 | ||
// client.messageApi.postMessage(channelId, { | ||
// markdown: { | ||
// template_id: 1, | ||
// params: [ | ||
// { | ||
// key: 'title', | ||
// value: ['标题'], | ||
// }, | ||
// ], | ||
// }, | ||
// msg_id: 'xxxxxx', | ||
// keyboard: { | ||
// content: { | ||
// rows: [ | ||
// { | ||
// buttons: [ | ||
// { | ||
// id: '1', | ||
// render_data: { | ||
// label: 'AtBot-按钮1', | ||
// visited_label: '点击后按钮1上文字', | ||
// }, | ||
// action: { | ||
// type: 2, | ||
// permission: { | ||
// type: 2, | ||
// specify_role_ids: ['1', '2', '3'], | ||
// }, | ||
// click_limit: 10, | ||
// unsupport_tips: '编辑-兼容文本', | ||
// data: '/搜索', | ||
// at_bot_show_channel_list: true, | ||
// }, | ||
// }, | ||
// ], | ||
// }, | ||
// ], | ||
// bot_appid: 123123123, | ||
// }, | ||
// }, | ||
// }) | ||
}) | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,5 +16,8 @@ | |
"nodemon": "^3.1.7", | ||
"qq-sdk": "workspace:*", | ||
"tsup": "^8.3.0" | ||
}, | ||
"dependencies": { | ||
"axios": "^1.7.7" | ||
} | ||
} |
Oops, something went wrong.