Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dragon-fish committed Apr 23, 2024
2 parents a54526f + 48ec5cf commit a45b409
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 9 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"koishi-plugin-github": "^5.5.1",
"koishi-plugin-image-search": "^4.3.0",
"koishi-plugin-mediawiki": "^2.1.0",
"koishi-plugin-novelai": "^1.21.1",
"koishi-plugin-puppeteer": "^3.7.3",
"koishi-plugin-rate-limit": "^2.0.1",
"koishi-plugin-recall": "^1.4.0",
Expand Down
43 changes: 43 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ import * as PluginDialogueFlow from 'koishi-plugin-dialogue-flow'
import * as PluginDialogueRateLimit from 'koishi-plugin-dialogue-rate-limit'
import PluginGithub from 'koishi-plugin-github'
import * as PluginImageSearch from 'koishi-plugin-image-search'
import * as PluginNovelAi from 'koishi-plugin-novelai'
import PluginPuppeteer from 'koishi-plugin-puppeteer'
import * as PluginRateLimit from 'koishi-plugin-rate-limit'
import * as PluginRecall from 'koishi-plugin-recall'
Expand Down Expand Up @@ -330,6 +331,31 @@ app.plugin(function PluginCollectionSILICore(ctx) {
ctx.plugin(PluginHljs)
ctx.plugin(PluginMinecraft)
ctx.plugin(PluginMute)
if (process.env.NOVELAI_USERNAME) {
// 部分开启 NovelAI 测试
ctx
.channel(
process.env.CHANNEL_QQ_SANDBOX,
process.env.CHANNEL_QQ_NGNL_COMMON,
process.env.CHANNEL_QQ_IPE
)
.plugin(PluginNovelAi, {
type: 'login',
email: process.env.NOVELAI_USERNAME,
password: process.env.NOVELAI_PASSWORD,
latinOnly: true,
})
ctx.command('novelai', {
minInterval(session) {
if ((session.user as any)?.authority > 1) return 0
return 60 * 1000
},
maxUsage(session) {
if ((session.user as any)?.authority > 1) return undefined
return 10
},
})
}
ctx.plugin(PluginOpenAi, {
openaiOptions: {
baseURL: env.OPENAI_BASE_RUL,
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/debug/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export class PluginDebug extends BasePlugin {
constructor(ctx: Context) {
super(ctx, {}, 'plugin-debug')

ctx.inject(['piggyback'], () => {
ctx.inject(['piggyback'], (ctx) => {
ctx
.command(
'debug.piggyback <command:text>',
Expand Down
4 changes: 3 additions & 1 deletion src/plugins/mediawiki/infoboxDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ export const INFOBOX_DEFINITION: {
/* 右下角悬浮的功能按钮 */
#bottomRightCorner,
/* 全站公告弹窗 */
body > .n-modal-container
body > .n-modal-container,
/* [[WAF]] */
.mw-parser-output [data-id="lr-overlay"]
{
display: none !important;
}
Expand Down
12 changes: 5 additions & 7 deletions src/plugins/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @authority 1
*/

import { Context, version as KOISHI_VERSION } from 'koishi'
import { Context, version as KOISHI_VERSION, h } from 'koishi'
import BasePlugin from '~/_boilerplate'

export default class PluginVersion extends BasePlugin {
Expand All @@ -24,15 +24,13 @@ export default class PluginVersion extends BasePlugin {
const siliCoreInfo = (
await import('../../package.json', { assert: { type: 'json' } })
).default
const onebotInfo = await ctx.bots
.find((i) => i.platform === 'onebot')
?.internal.getVersionInfo()
const platforms = Array.from(new Set(ctx.root.bots.map((i) => i.platform)))
const registeredPlugins = ctx.registry.entries()
console.info(registeredPlugins)

if (!options!.all) {
return `[SILI Core] v${siliCoreInfo.version} (${gitHashInfo?.trim()})
[Onebot] protocol ${onebotInfo?.protocol_version} / go-cqhttp ${onebotInfo?.version}
[Platforms] ${platforms}
[Koishi.js] v${KOISHI_VERSION}`
}

Expand All @@ -52,13 +50,13 @@ export default class PluginVersion extends BasePlugin {
const img = await ctx.html.hljs(
[
`[SILI Core] v${siliCoreInfo.version} (${gitHashInfo})`,
`[Onebot] protocol ${onebotInfo?.protocol_version} / go-cqhttp ${onebotInfo?.version}`,
`[Platforms] ${platforms}`,
`[Koishi.js] v${KOISHI_VERSION}`,
` - ${plugins.join('\n - ')}`,
].join('\n'),
'markdown'
)
return img || '检查版本时发生未知错误。'
return img ? h.image(img,'image/jpeg') : '检查版本时发生未知错误。'
})
}
}

0 comments on commit a45b409

Please sign in to comment.