serenity-rs / serenity

A Rust library for the Discord API.
https://discord.gg/serenity-rs
ISC License
4.65k stars 571 forks source link

little spelling error in the implementation of MessageReaction Struct #2909

Closed ItsGamerik closed 2 months ago

ItsGamerik commented 2 months ago

Serenity version: 0.12.2

Rust version (rustc -V): 1.79.0

Backtrace (make sure to run RUST_BACKTRACE=1):

thread 'tokio-runtime-worker' panicked at src/commands/index.rs:59:73: called `Result::unwrap()` on an `Err` value: Json(Error("missing field `burst_colours`", line: 1, column: 1352)) stack backtrace: 0: rust_begin_unwind at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:652:5 1: core::panicking::panic_fmt at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/panicking.rs:72:14 2: core::result::unwrap_failed at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/result.rs:1654:5 3: core::result::Result::unwrap at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/result.rs:1077:23 4: get_img::commands::index::index::{{closure}} at ./src/commands/index.rs:59:5 5: get_img::commands::index::run::{{closure}} at ./src/commands/index.rs:36:33 6: ::interaction_create::{{closure}} at ./src/main.rs:100:82 7: as core::future::future::Future>::poll at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/future/future.rs:123:9 8: serenity::client::event_handler::FullEvent::dispatch::{{closure}} at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serenity-0.12.2/src/client/event_handler.rs:74:84 9: serenity::client::dispatch::dispatch_model::{{closure}} at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serenity-0.12.2/src/client/dispatch.rs:70:56 10: as core::future::future::Future>::poll at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/future/future.rs:123:9 11: tokio::runtime::task::core::Core::poll::{{closure}} at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/task/core.rs:328:17 12: tokio::loom::std::unsafe_cell::UnsafeCell::with_mut at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/loom/std/unsafe_cell.rs:16:9 13: tokio::runtime::task::core::Core::poll at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/task/core.rs:317:13 14: tokio::runtime::task::harness::poll_future::{{closure}} at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/task/harness.rs:485:19 15: as core::ops::function::FnOnce<()>>::call_once at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/panic/unwind_safe.rs:272:9 16: std::panicking::try::do_call at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:559:40 17: __rust_try 18: std::panicking::try at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:523:19 19: std::panic::catch_unwind at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panic.rs:149:14 20: tokio::runtime::task::harness::poll_future at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/task/harness.rs:473:18 21: tokio::runtime::task::harness::Harness::poll_inner at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/task/harness.rs:208:27 22: tokio::runtime::task::harness::Harness::poll at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/task/harness.rs:153:15 23: tokio::runtime::task::raw::poll at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/task/raw.rs:271:5 24: tokio::runtime::task::raw::RawTask::poll at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/task/raw.rs:201:18 25: tokio::runtime::task::LocalNotified<[]S>::run at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/task/mod.rs:427:9 26: tokio::runtime::scheduler::multi_thread::worker::Context::run_task::{{closure}} at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/scheduler/multi_thread/worker.rs:648:17 27: tokio::runtime::coop::with_budget at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/coop.rs:107:5 28: tokio::runtime::coop::budget at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/coop.rs:73:5 29: tokio::runtime::scheduler::multi_thread::worker::Context::run_task at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/scheduler/multi_thread/worker.rs:584:9 30: tokio::runtime::scheduler::multi_thread::worker::Context::run at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/scheduler/multi_thread/worker.rs:535:24 31: tokio::runtime::scheduler::multi_thread::worker::run::{{closure}}::{{closure}} at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/scheduler/multi_thread/worker.rs:500:21 32: tokio::runtime::context::scoped::Scoped::set at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/context/scoped.rs:40:9 33: tokio::runtime::context::set_scheduler::{{closure}} at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/context.rs:180:26 34: std::thread::local::LocalKey::try_with at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/thread/local.rs:286:12 35: std::thread::local::LocalKey::with at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/thread/local.rs:262:9 36: tokio::runtime::context::set_scheduler at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/context.rs:180:9 37: tokio::runtime::scheduler::multi_thread::worker::run::{{closure}} at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/scheduler/multi_thread/worker.rs:495:9 38: tokio::runtime::context::runtime::enter_runtime at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/context/runtime.rs:65:16 39: tokio::runtime::scheduler::multi_thread::worker::run at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/scheduler/multi_thread/worker.rs:487:5 40: tokio::runtime::scheduler::multi_thread::worker::Launch::launch::{{closure}} at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/scheduler/multi_thread/worker.rs:455:45 41: as core::future::future::Future>::poll at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/blocking/task.rs:42:21 42: tokio::runtime::task::core::Core::poll::{{closure}} at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/task/core.rs:328:17 43: tokio::loom::std::unsafe_cell::UnsafeCell::with_mut at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/loom/std/unsafe_cell.rs:16:9 44: tokio::runtime::task::core::Core::poll at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/task/core.rs:317:13 45: tokio::runtime::task::harness::poll_future::{{closure}} at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/task/harness.rs:485:19 46: as core::ops::function::FnOnce<()>>::call_once at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/panic/unwind_safe.rs:272:9 47: std::panicking::try::do_call at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:559:40 48: __rust_try 49: std::panicking::try at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:523:19 50: std::panic::catch_unwind at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panic.rs:149:14 51: tokio::runtime::task::harness::poll_future at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/task/harness.rs:473:18 52: tokio::runtime::task::harness::Harness::poll_inner at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/task/harness.rs:208:27 53: tokio::runtime::task::harness::Harness::poll at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/task/harness.rs:153:15 54: tokio::runtime::task::raw::poll at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/task/raw.rs:271:5 55: tokio::runtime::task::raw::RawTask::poll at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/task/raw.rs:201:18 56: tokio::runtime::task::UnownedTask<[]S>::run at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/task/mod.rs:464:9 57: tokio::runtime::blocking::pool::Task::run at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/blocking/pool.rs:159:9 58: tokio::runtime::blocking::pool::Inner::run at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/blocking/pool.rs:513:17 59: tokio::runtime::blocking::pool::Spawner::spawn_thread::{{closure}} at /home/erik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.38.0/src/runtime/blocking/pool.rs:471:13 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Minimal test case if possible:

  1. Send a message to a channel
  2. add a reaction emoji
  3. Try to get that message with the message or messages method.

As far as i can see the json parser fails to parse the burst_colours field from the serenity::model::channel::MessageReaction struct. In the API docs, it is spelled "burst_colors"

here is the link to the api docs, and an example response that i got with curl:

  "reactions": [
    {
      "emoji": {
        "id": null,
        "name": "😭"
      },
      "count": 1,
      "count_details": {
        "burst": 0,
        "normal": 1
      },
      "burst_colors": [],
      "me_burst": false,
      "burst_me": false,
      "me": false,
      "burst_count": 0
    }
  ]
GnomedDev commented 2 months ago

Duplicate of #2892.