Remove redundant args of BotSession

This commit is contained in:
Him188 2019-12-07 13:17:04 +08:00
parent c78c8ac46c
commit cb083922d8
2 changed files with 3 additions and 9 deletions

View File

@ -21,11 +21,8 @@ import java.io.InputStream
*/ */
@UseExperimental(MiraiInternalAPI::class) @UseExperimental(MiraiInternalAPI::class)
actual class BotSession internal actual constructor( actual class BotSession internal actual constructor(
bot: Bot, bot: Bot
sessionKey: SessionKey, ) : BotSessionBase(bot) {
socket: DataPacketSocketAdapter,
NetworkScope: CoroutineScope
) : BotSessionBase(bot, sessionKey, socket, NetworkScope) {
suspend inline fun Image.downloadAsStream(): InputStream = download().inputStream() suspend inline fun Image.downloadAsStream(): InputStream = download().inputStream()
suspend inline fun Image.downloadAsBitmap(): Bitmap = withContext(Dispatchers.IO) { downloadAsStream().use { BitmapFactory.decodeStream(it) } } suspend inline fun Image.downloadAsBitmap(): Bitmap = withContext(Dispatchers.IO) { downloadAsStream().use { BitmapFactory.decodeStream(it) } }

View File

@ -316,10 +316,7 @@ internal object DebugNetworkHandler : BotNetworkHandler<DataPacketSocketAdapter>
} }
override val bot: Bot = Bot(qq, "", coroutineContext) override val bot: Bot = Bot(qq, "", coroutineContext)
override val session = BotSession( override val session = BotSession(bot)
bot, sessionKey,
socket, this
)
override suspend fun login(): LoginResult = LoginResult.SUCCESS override suspend fun login(): LoginResult = LoginResult.SUCCESS