Skip to content

Commit

Permalink
refa: add http inject
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Jan 1, 2024
1 parent 601eaba commit 5d87791
Show file tree
Hide file tree
Showing 18 changed files with 20 additions and 8 deletions.
1 change: 1 addition & 0 deletions adapters/dingtalk/src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Internal } from './internal'
// https://open.dingtalk.com/document/orgapp/enterprise-created-chatbot
export class DingtalkBot<C extends Context = Context> extends Bot<C, DingtalkBot.Config> {
static MessageEncoder = DingtalkMessageEncoder
static inject = ['http']

public oldHttp: Quester
public http: Quester
Expand Down
1 change: 1 addition & 0 deletions adapters/discord/src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { version } from '../package.json'

export class DiscordBot<C extends Context = Context> extends Bot<C, DiscordBot.Config> {
static MessageEncoder = DiscordMessageEncoder
static inject = ['http']

public http: Quester
public internal: Internal
Expand Down
1 change: 1 addition & 0 deletions adapters/kook/src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { isDirectChannel, KookMessageEncoder } from './message'

export class KookBot<C extends Context = Context, T extends KookBot.Config = KookBot.Config> extends Bot<C, T> {
static MessageEncoder = KookMessageEncoder
static inject = ['http']

http: Quester
internal: Kook.Internal
Expand Down
2 changes: 1 addition & 1 deletion adapters/lark/src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Internal } from './types'
import * as Utils from './utils'

export class LarkBot<C extends Context = Context> extends Bot<C, LarkBot.Config> {
static inject = ['server']
static inject = ['server', 'http']
static MessageEncoder = LarkMessageEncoder

_token?: string
Expand Down
2 changes: 1 addition & 1 deletion adapters/line/src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Internal } from './types'
import { LineMessageEncoder } from './message'

export class LineBot<C extends Context = Context> extends Bot<C, LineBot.Config> {
static inject = ['server']
static inject = ['server', 'http']
static MessageEncoder = LineMessageEncoder

public http: Quester
Expand Down
1 change: 1 addition & 0 deletions adapters/mail/src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { MailMessageEncoder } from './message'

export class MailBot<C extends Context = Context> extends Bot<C, MailBot.Config> {
static MessageEncoder = MailMessageEncoder
static inject = ['http']

internal: SMTP

Expand Down
1 change: 1 addition & 0 deletions adapters/matrix/src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { adaptMessage, decodeUser, dispatchSession } from './utils'

export class MatrixBot<C extends Context = Context> extends Bot<C, MatrixBot.Config> {
static MessageEncoder = MatrixMessageEncoder
static inject = ['http']

http: Quester
id: string
Expand Down
2 changes: 2 additions & 0 deletions adapters/qq/src/bot/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ interface GetAppAccessTokenResult {

export class QQBot<C extends Context = Context> extends Bot<C, QQBot.Config> {
static MessageEncoder = QQMessageEncoder
static inject = ['http']

public guildBot: QQGuildBot<C>

internal: GroupInternal
Expand Down
1 change: 1 addition & 0 deletions adapters/satori/src/ws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { SatoriBot, transformKey } from './bot'
export class SatoriAdapter<C extends Context = Context> extends Adapter.WsClientBase<C, SatoriBot<C>> {
static schema = true as any
static reusable = true
static inject = ['http']

public http: Quester
public logger: Logger
Expand Down
2 changes: 2 additions & 0 deletions adapters/slack/src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { Internal, Token } from './types/internal'

export class SlackBot<C extends Context = Context, T extends SlackBot.Config = SlackBot.Config> extends Bot<C, T> {
static MessageEncoder = SlackMessageEncoder
static inject = ['http']

public http: Quester
public internal: Internal

Expand Down
1 change: 1 addition & 0 deletions adapters/telegram/src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface TelegramResponse {

export class TelegramBot<C extends Context = Context, T extends TelegramBot.Config = TelegramBot.Config> extends Bot<C, T> {
static MessageEncoder = TelegramMessageEncoder
static inject = ['http']

http: Quester
file: Quester
Expand Down
2 changes: 1 addition & 1 deletion adapters/wechat-official/src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { WechatOfficialMessageEncoder } from './message'
// import { Internal } from './types/internal'

export class WechatOfficialBot<C extends Context = Context> extends Bot<C, WechatOfficialBot.Config> {
static inject = ['server']
static inject = ['server', 'http']
static MessageEncoder = WechatOfficialMessageEncoder

http: Quester
Expand Down
2 changes: 1 addition & 1 deletion adapters/wecom/src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { HttpServer } from './http'
import { WecomMessageEncoder } from './message'

export class WecomBot<C extends Context = Context> extends Bot<C, WecomBot.Config> {
static inject = ['server']
static inject = ['server', 'http']
static MessageEncoder = WecomMessageEncoder

http: Quester
Expand Down
2 changes: 1 addition & 1 deletion adapters/whatsapp/src/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class HttpServer {
}

export class WhatsAppAdapter<C extends Context = Context> extends Adapter<C, WhatsAppBot<C>> {
static inject = ['server']
static inject = ['server', 'http']
static schema = true as any
static reusable = true

Expand Down
1 change: 1 addition & 0 deletions adapters/zulip/src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { decodeGuild, decodeMessage, decodeUser } from './utils'

export class ZulipBot<C extends Context = Context> extends Bot<C, ZulipBot.Config> {
static MessageEncoder = ZulipMessageEncoder
static inject = ['http']

public http: Quester
public internal: Internal
Expand Down
2 changes: 1 addition & 1 deletion packages/server-proxy/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ declare module '@satorijs/core' {
}

class ProxyServer {
static inject = ['server']
static inject = ['server', 'http']

public path: string

Expand Down
2 changes: 1 addition & 1 deletion packages/server-satori/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {} from '@cordisjs/server'
import WebSocket from 'ws'

export const name = 'server'
export const inject = ['server']
export const inject = ['server', 'http']

const kClient = Symbol('state')

Expand Down
2 changes: 1 addition & 1 deletion packages/server-temp/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface Entry {
}

class TempServer {
static inject = ['server']
static inject = ['server', 'http']

public path: string
public selfUrl!: string
Expand Down

0 comments on commit 5d87791

Please sign in to comment.