Skip to content

Commit

Permalink
chore: remove option port assertions (#528)
Browse files Browse the repository at this point in the history
  • Loading branch information
purerosefallen authored Feb 19, 2022
1 parent 8231e34 commit ee4a3fe
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
3 changes: 1 addition & 2 deletions plugins/adapter/kaiheila/src/http.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Adapter, assertProperty, Context, Logger, Quester, sanitize, Schema } from 'koishi'
import { Adapter, Context, Logger, Quester, sanitize, Schema } from 'koishi'
import { BotConfig, KaiheilaBot } from './bot'
import { AdapterConfig, adaptSession } from './utils'

Expand All @@ -14,7 +14,6 @@ export default class HttpServer extends Adapter<BotConfig, AdapterConfig> {
])

constructor(ctx: Context, config: AdapterConfig) {
assertProperty(ctx.app.options, 'port')
config.path = sanitize(config.path || '/kaiheila')
super(ctx, config)
}
Expand Down
7 changes: 1 addition & 6 deletions plugins/adapter/onebot/src/http.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Adapter, assertProperty, Context, Logger, omit, Quester, Schema } from 'koishi'
import { Adapter, Logger, omit, Quester, Schema } from 'koishi'
import { BotConfig, OneBotBot } from './bot'
import { AdapterConfig, dispatchSession } from './utils'
import { createHmac } from 'crypto'
Expand All @@ -16,11 +16,6 @@ export class HttpServer extends Adapter<BotConfig, AdapterConfig> {

public bots: OneBotBot[]

constructor(ctx: Context, config: AdapterConfig = {}) {
super(ctx, config)
assertProperty(ctx.app.options, 'port')
}

async connect(bot: OneBotBot) {
const { endpoint, token } = bot.config
if (!endpoint) return
Expand Down
3 changes: 1 addition & 2 deletions plugins/adapter/onebot/src/ws.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Adapter, assertProperty, Context, Logger, Schema, Time, WebSocketLayer } from 'koishi'
import { Adapter, Context, Logger, Schema, Time, WebSocketLayer } from 'koishi'
import { BotConfig, OneBotBot } from './bot'
import { AdapterConfig, dispatchSession, Response } from './utils'
import WebSocket from 'ws'
Expand Down Expand Up @@ -35,7 +35,6 @@ export class WebSocketServer extends Adapter<BotConfig, AdapterConfig> {

constructor(ctx: Context, config: AdapterConfig) {
super(ctx, config)
assertProperty(ctx.app.options, 'port')
const { path = '/onebot' } = config

this.wsServer = ctx.router.ws(path, (socket, { headers }) => {
Expand Down

0 comments on commit ee4a3fe

Please sign in to comment.