Commit c601f0cd authored by nanahira's avatar nanahira

bump to latest

parent d975c13a
import { App, Plugin, Session } from 'koishi'; import { App, Session } from 'koishi';
import koishiPluginOnebot, { BotConfig } from '@koishijs/plugin-adapter-onebot'; import koishiPluginOnebot, { BotConfig } from '@koishijs/plugin-adapter-onebot';
import * as koishiPluginVerifier from '@koishijs/plugin-verifier'; import * as koishiPluginVerifier from '@koishijs/plugin-verifier';
import { Adapter } from 'koishi'; import { Adapter } from 'koishi';
...@@ -7,13 +7,12 @@ import targetPlugin from './plugin'; ...@@ -7,13 +7,12 @@ import targetPlugin from './plugin';
import yaml from 'yaml'; import yaml from 'yaml';
import { promises as fs } from 'fs'; import { promises as fs } from 'fs';
type ConfigFromPlugin<P> = P extends Plugin<infer C> ? C : never;
interface Config { interface Config {
adapter: Adapter.PluginConfig<AdapterConfig, BotConfig>; adapter: Adapter.PluginConfig<AdapterConfig, BotConfig>;
koishiOptions: App.Config; koishiOptions: App.Config;
commandPrefix: string; commandPrefix: string;
adminIds: string[]; adminIds: string[];
acceptFriendRequest: boolean;
app: any; app: any;
} }
...@@ -31,6 +30,7 @@ const defaultConfig: Config = { ...@@ -31,6 +30,7 @@ const defaultConfig: Config = {
koishiOptions: {}, koishiOptions: {},
commandPrefix: process.env.COMMAND_PREFIX || '.', commandPrefix: process.env.COMMAND_PREFIX || '.',
adminIds: process.env.ADMIN_ID ? process.env.ADMIN_ID.split(',') : [], adminIds: process.env.ADMIN_ID ? process.env.ADMIN_ID.split(',') : [],
acceptFriendRequest: true,
app: process.env.APP_CONFIG ? JSON.parse(process.env.APP_CONFIG) : undefined, app: process.env.APP_CONFIG ? JSON.parse(process.env.APP_CONFIG) : undefined,
}; };
...@@ -48,7 +48,7 @@ async function main() { ...@@ -48,7 +48,7 @@ async function main() {
const adminIds = config.adminIds.map((id) => id.toString()); const adminIds = config.adminIds.map((id) => id.toString());
app.plugin(koishiPluginVerifier, { app.plugin(koishiPluginVerifier, {
onFriendRequest: true, onFriendRequest: config.acceptFriendRequest || undefined,
onGuildRequest: (session: Session) => onGuildRequest: (session: Session) =>
session.userId && adminIds.includes(session.userId), session.userId && adminIds.includes(session.userId),
}); });
......
This diff is collapsed.
...@@ -29,11 +29,11 @@ ...@@ -29,11 +29,11 @@
"author": "Nanahira <nanahira@momobako.com>", "author": "Nanahira <nanahira@momobako.com>",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@koishijs/plugin-adapter-onebot": "^4.0.0-beta.2", "@koishijs/plugin-adapter-onebot": "^4.2.1",
"@koishijs/plugin-verifier": "^1.0.0-beta.1", "@koishijs/plugin-verifier": "^1.0.2",
"koishi": "^4.0.0-beta.2", "koishi": "^4.6.2",
"ws": "^8.2.3", "ws": "^8.2.3",
"yaml": "^1.10.2" "yaml": "^2.0.1"
}, },
"devDependencies": { "devDependencies": {
"@types/better-sqlite3": "^7.4.0", "@types/better-sqlite3": "^7.4.0",
......
#!/bin/bash
set -x
set -o errexit
targetPlugin=$1
currentPath="$PWD"
cd "$targetPlugin"
fullTargetPluginPath="$PWD"
npm run build
cd "$currentPath"
rm ./plugin
ln -s "$fullTargetPluginPath" ./plugin
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment