Skip to content

Commit

Permalink
chore: remove disposability marks
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Mar 4, 2021
1 parent 6395699 commit 293b90d
Show file tree
Hide file tree
Showing 22 changed files with 20 additions and 79 deletions.
1 change: 0 additions & 1 deletion packages/plugin-chess/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ const states: Record<string, State> = {}
export * from './state'

export const name = 'chess'
export const disposable = true

export function apply(ctx: Context) {
ctx = ctx.group()
Expand Down
1 change: 0 additions & 1 deletion packages/plugin-common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export interface Config extends AdminConfig, HandlerOptions, RepeaterOptions, Se
}

export const name = 'common'
export const disposable = true

export function apply(ctx: Context, config: Config = {}) {
ctx.command('common', '基础功能')
Expand Down
1 change: 0 additions & 1 deletion packages/plugin-dice/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import roll, { RollConfig } from './roll'
export interface Config extends RollConfig {}

export const name = 'dice'
export const disposable = true

export function apply(ctx: Context, config: Config = {}) {
ctx.plugin(roll, config)
Expand Down
1 change: 0 additions & 1 deletion packages/plugin-eval/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ const defaultConfig: EvalConfig = {
const logger = new Logger('eval')

export const name = 'eval'
export const disposable = true

export function apply(ctx: Context, config: Config = {}) {
const { prefix, authority } = config = { ...defaultConfig, ...config }
Expand Down
1 change: 0 additions & 1 deletion packages/plugin-github/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const defaultOptions: Config = {
}

export const name = 'github'
export const disposable = true

export function apply(ctx: Context, config: Config = {}) {
config = { ...defaultOptions, ...config }
Expand Down
1 change: 0 additions & 1 deletion packages/plugin-image-search/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ async function mixedSearch(url: string, session: Session, config: Config) {
}

export const name = 'search'
export const disposable = true

export function apply(ctx: Context, config: Config = {}) {
let index = 0
Expand Down
1 change: 0 additions & 1 deletion packages/plugin-puppeteer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export const defaultConfig: Config = {
}

export const name = 'puppeteer'
export const disposable = true

export function apply(ctx: Context, config: Config = {}) {
config = { ...defaultConfig, ...config }
Expand Down
1 change: 0 additions & 1 deletion packages/plugin-rss/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export interface Config {
const logger = new Logger('rss')

export const name = 'rss'
export const disposable = true

export function apply(ctx: Context, config: Config = {}) {
const { timeout = 10 * Time.second, refresh = Time.minute, userAgent } = config
Expand Down
1 change: 0 additions & 1 deletion packages/plugin-schedule/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export interface Config {
}

export const name = 'schedule'
export const disposable = true

export function apply(ctx: Context, config: Config = {}) {
const { database } = ctx
Expand Down
1 change: 0 additions & 1 deletion packages/plugin-status/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ const defaultConfig: Config = {
}

export const name = 'status'
export const disposable = true

export function apply(ctx: Context, config: Config = {}) {
const all = ctx.all()
Expand Down
2 changes: 2 additions & 0 deletions packages/plugin-tools/src/alpha.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ async function showShort(session: Session, input: string, appid: string) {
return data as string
}

export const name = 'alpha'

export function apply(ctx: Context, config: AlphaOptions) {
const { wolframAlphaAppId: appid } = config
ctx.command('tools/alpha <expr:text>', '调用 WolframAlpha 查询', { maxUsage: 10 })
Expand Down
2 changes: 2 additions & 0 deletions packages/plugin-tools/src/brainfuck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ class BrainFuck {
}
}

export const name = 'brainfuck'

export function apply(ctx: Context, config: BrainfuckOptions = {}) {
ctx.command('tools/brainfuck <code>', '运行 brainfuck 代码')
.alias('bf')
Expand Down
2 changes: 2 additions & 0 deletions packages/plugin-tools/src/crypto/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import FourSquare from './algorithms/four-square'
import { Context } from 'koishi-core'
import { segment } from 'koishi-utils'

export const name = 'crypto'

export function apply(ctx: Context) {
ctx.command('tools/crypto <algorithm> <text>', '加密解密工具')
.option('encrypt', '-e 加密模式(默认)')
Expand Down
4 changes: 0 additions & 4 deletions packages/plugin-tools/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Context } from 'koishi-core'
import { AlphaOptions } from './alpha'
import { BrainfuckOptions } from './brainfuck'
import { MusicOptions } from './music'
import { RollOptions } from './roll'
import { TranslateOptions } from './translate'

export interface Options extends AlphaOptions, TranslateOptions {
Expand All @@ -15,12 +14,10 @@ export interface Options extends AlphaOptions, TranslateOptions {
music?: false | MusicOptions
oeis?: false
qrcode?: false
roll?: false | RollOptions
weather?: false
}

export const name = 'tools'
export const disposable = true

export function apply(ctx: Context, config: Options = {}) {
ctx.command('tools', '实用工具')
Expand All @@ -35,7 +32,6 @@ export function apply(ctx: Context, config: Options = {}) {
if (config.music !== false) ctx.plugin(require('./music'), config.music)
if (config.oeis !== false) ctx.plugin(require('./oeis'))
if (config.qrcode !== false) ctx.plugin(require('./qrcode'))
if (config.roll !== false) ctx.plugin(require('./roll'), config.roll)
if (config.youdaoAppKey) ctx.plugin(require('./translate'), config)
if (config.weather !== false) ctx.plugin(require('./weather'))
}
2 changes: 2 additions & 0 deletions packages/plugin-tools/src/magi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const tagMap = {
tag: '标签',
}

export const name = 'magi'

export function apply(ctx: Context) {
ctx.command('tools/magi <text:text>', '使用 Magi 搜索')
.option('confidence', '-c 显示数据可信度')
Expand Down
2 changes: 2 additions & 0 deletions packages/plugin-tools/src/maya.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ class MayaDate {
}
}

export const name = 'maya'

export function apply(ctx: Context) {
ctx.command('tools/maya <YYYY-MM-DD> [BC|AD]', '玛雅日历换算')
.example('maya 2012-12-21')
Expand Down
2 changes: 2 additions & 0 deletions packages/plugin-tools/src/mcping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ function itob(n: number, length: number) {
return result
}

export const name = 'mcping'

export function apply(ctx: Context) {
ctx.command('tools/mcping <url>', '查看 Minecraft 服务器信息')
.action(async ({ session }, address) => {
Expand Down
2 changes: 2 additions & 0 deletions packages/plugin-tools/src/oeis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import axios from 'axios'

const BASE_URL = 'https://oeis.org'

export const name = 'oeis'

export function apply(ctx: Context) {
ctx.command('tools/oeis <sequence>', '数列查询', { maxUsage: 10 })
.option('start', '-s <start> 设置起始页码', { fallback: 0 })
Expand Down
2 changes: 2 additions & 0 deletions packages/plugin-tools/src/qrcode.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Context, segment } from 'koishi-core'
import { toDataURL } from 'qrcode'

export const name = 'qrcode'

export function apply(ctx: Context) {
ctx.command('tools/qrcode <text:text>', '生成二维码')
.option('margin', '-m <margin> 边界尺寸', { fallback: 4 })
Expand Down
65 changes: 0 additions & 65 deletions packages/plugin-tools/src/roll.ts

This file was deleted.

2 changes: 2 additions & 0 deletions packages/plugin-tools/src/translate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ function encrypt(source: string) {
return createHash('md5').update(source).digest('hex') // lgtm [js/weak-cryptographic-algorithm]
}

export const name = 'translate'

export function apply(ctx: Context, config: TranslateOptions) {
const appKey = assertProperty(config, 'youdaoAppKey')
const secret = assertProperty(config, 'youdaoSecret')
Expand Down
2 changes: 2 additions & 0 deletions packages/plugin-tools/src/weather.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ const lang = 'zh-CN'
const unit = 'metric'
const products = ['astro', 'civil', 'civillight', 'meteo', 'two']

export const name = 'weather'

export function apply(ctx: Context) {
ctx.command('tools/weather <longitude> <latitude>', '查询天气')
// typescript cannot infer type from string templates
Expand Down

0 comments on commit 293b90d

Please sign in to comment.