CalliEve / telexide

an easy-to-use async telegram bot library for Rust
MIT License
37 stars 4 forks source link

Missing field `language' #27

Closed artjoma closed 1 year ago

artjoma commented 1 year ago

Version: 0.1.8 OS: linux

Calling client.start():

let client = ClientBuilder::new()
      .set_token(&cfg.api_key)
      .set_framework(create_framework!(bot_name, my_test_func))
      .build();

  {
      let mut data = client.data.write();
      data.insert::<HashMapKey>(cfg);
  }

  client.start().await

Throw exception:

 2022-11-14T22:43:49.339Z TRACE hyper::proto::h1::conn       > flushed({role=client}): State { reading: Init, writing: Init, keep_alive: Idle }
 2022-11-14T22:43:49.339Z TRACE hyper::client::pool          > put; add idle connection for ("https", api.telegram.org)
 2022-11-14T22:43:49.339Z DEBUG hyper::client::pool          > pooling idle connection for ("https", api.telegram.org)
 2022-11-14T22:43:49.341Z TRACE want                         > signal: Want
 2022-11-14T22:43:49.341Z TRACE hyper::proto::h1::conn       > flushed({role=client}): State { reading: Init, writing: Init, keep_alive: Idle }
 2022-11-14T22:43:49.343Z TRACE hyper::proto::h1::dispatch   > client tx closed
 2022-11-14T22:43:49.343Z TRACE hyper::proto::h1::conn       > State::close_read()
 2022-11-14T22:43:49.343Z TRACE hyper::proto::h1::conn       > State::close_write()
 2022-11-14T22:43:49.343Z TRACE hyper::proto::h1::conn       > flushed({role=client}): State { reading: Closed, writing: Closed, keep_alive: Disabled }
 2022-11-14T22:43:49.343Z TRACE hyper::proto::h1::conn       > shut down IO complete
 2022-11-14T22:43:49.343Z TRACE mio::poll                    > deregistering event source from poller
 2022-11-14T22:43:49.346Z TRACE want                         > signal: Closed
 2022-11-14T22:43:49.346Z TRACE mio::poll                    > deregistering event source from poller
Error: Error("missing field `language`", line: 0, column: 0)
CalliEve commented 1 year ago

Thank you so much for the bug report! It seems that I didn't realize a code block could have no language specified and so forgot to set it as an optional field on a Pre message entity 😓 I pushed a fix now and will deploy a bugfix release of the library soon afterwards 👍