官q给指定群广播消息

如题,翻了好久没找到方法

官q适配器

通过

ctx.command(‘gb’)
.action(async ({ session }) => {
await ctx.broadcast([‘qq:channelId’], ‘123’)
})

或者直接用/broadcast 123

都会app Error: property database is not registered, declare it as inject to suppress this warningbot
TypeError: Cannot read properties of undefined (reading ‘id’)

database启用了

2 个赞

把完整源码贴一下

import { Context, Schema, h } from ‘koishi’
import puppeteer from ‘puppeteer’
import type {} from ‘@koishijs/plugin-adapter-qq’

export const name = ‘the-test’

export interface Config { }

export const Config: Schema = Schema.object({})

export function apply(ctx: Context) {
ctx.command(‘gb’)
.action(async ({ session }) => {
await ctx.broadcast([‘qq:97039F345567F9CA34F811962EDCE3E5’], ‘123’)
})
}
大概这样的,就是想搞一个群定时广播

1 个赞

一个月只有四条主动消息,

你是打算定时一周一次吗…

2 个赞

啊,我以为一天能有好几次,那好吧,谢谢

2 个赞