xooniverse / televerse

Your gateway to seamless Telegram Bot Development 💙
https://televerse.xooniverse.com
BSD 3-Clause "New" or "Revised" License
64 stars 11 forks source link

Setting `error: true` in `LoggerOptions` gives vague error when sending media. #148

Closed doiraduc closed 1 year ago

doiraduc commented 1 year ago

When using replyWithVideo or replyWithPhoto, while error is enabled in LoggerOptions, Televerse throws a vague error and does not send the media.

│ TelegramException [500]:
│
┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄   
│ #0   HttpClient._dioCatch (package:televerse/src/utils/http.dart:32:7)
│ #1   HttpClient.multipartPost (package:televerse/src/utils/http.dart:114:7)
│ #2   <asynchronous suspension>
│ #3   RawAPI.sendVideo (package:televerse/src/televerse/raw_api.dart:564:18)
│ #4   <asynchronous suspension>
│ #5   MessageMixin.replyWithVideo (package:televerse/src/televerse/context/mixins/message_mixin.dart:178:12)
│ #6   <asynchronous suspension>
│ #7   processVideoLink (file:///D:/Programming/Projekt/cosminobot/bin/handlers/on/url/videodl.dart:17:7)

Do note that, when using InputFile.fromFileId or InputFile.fromUrl, this error does not occur. I only had it happen with InputFile.fromBytes and InputFile.fromFile.

HeySreelal commented 1 year ago

Thanks for the report, lemme check that quickly :)

HeySreelal commented 1 year ago

Hey @iamcosmin, just released v1.10.11 fixes this issue.

It was some encoding issue. Basically, I blindly called jsonEncode on the request body, and when the body contains FormData it all went crashing down.

Thanks again for reporting :)