Skip to content

Commit

Permalink
feat(core): add timer service as built-in
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Jan 9, 2024
1 parent 9aac05e commit 6e04d1e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions adapters/matrix/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,10 @@ function parsseContent(bot: MatrixBot, content: Matrix.M_ROOM_MESSAGE) {
break
}
if (src.match(/^(data|https?):/)) {
result += `<image url="${src}"/>`
result += `<img src="${src}"/>`
break
} else if (src.startsWith('mxc://')) {
result += `<image url="${bot.internal.getAssetUrl(src)}">`
result += `<img src="${bot.internal.getAssetUrl(src)}">`
break
}
break
Expand Down
7 changes: 7 additions & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
/// <reference types="@cordisjs/timer" />

import * as cordis from 'cordis'
import { Awaitable, defineProperty, Dict } from 'cosmokit'
import { Bot } from './bot'
import { Session } from './session'
import Schema from 'schemastery'
import Quester from 'cordis-axios'
import * as logger from '@cordisjs/logger'
import timer from '@cordisjs/timer'
import { Event, SendOptions } from '@satorijs/protocol'
import h from '@satorijs/element'

Expand Down Expand Up @@ -142,7 +145,11 @@ export class Context extends cordis.Context {

constructor(config: Context.Config = {}) {
super(config)
this.provide('logger', undefined, true)
this.provide('timer', undefined, true)
this.provide('http', undefined, true)
this.plugin(logger)
this.plugin(timer)
this.http = new Quester(config.request)
}

Expand Down

0 comments on commit 6e04d1e

Please sign in to comment.