Repository navigation
chore(deps): bump twilight 0.17 → 0.18 and adapt the Discord adapter - #194
Merged
Merged
Conversation
twilight 0.18 replaced the `MessageCreate` newtype-over-`Box<Message>` with a
plain struct:
pub struct MessageCreate {
pub channel_type: Option<ChannelType>,
#[serde(flatten)]
pub message: Message,
}
impl Deref for MessageCreate { type Target = Message; ... }
The tuple field is now private, so `msg.0` no longer compiles. Adapted the
adapter to `msg.guild_id` (via Deref) and `&msg.message`.
Both crates move together through the new `twilight-*` dependabot group, so
twilight-http (pulled in by twilight-gateway) stays on the same version and
`cargo deny`'s multiple-versions ban stays clean.
Verified: cargo clippy -p easybot-adapter-discord --all-targets -- -D warnings,
cargo test -p easybot-adapter-discord (37 + 27 pass), cargo check --workspace
--all-targets --features "default,plugin-system", cargo deny check.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
接管 #193(dependabot 的
twilight-*成组升级):原 PR 只改 lock 里的版本号,easybot-adapter-discord编译失败,本 PR 补上迁移。0.18 的破坏性变化
MessageCreate不再是Box<Message>的 newtype(.0字段变私有),改成:适配
crates/easybot-adapter-discord/src/lib.rs:msg.0.guild_id→msg.guild_id(走Deref)&msg.0→&msg.messagetwilight-*成组升级后,twilight-gateway内部依赖的twilight-http也同步到 0.18,因此不会出现同 crate 双版本,cargo deny的multiple-versions = "deny"保持干净。验证
cargo clippy -p easybot-adapter-discord --all-targets --locked -- -D warnings✅cargo test -p easybot-adapter-discord --locked✅(37 + 27 通过)cargo check --workspace --all-targets --features "default,plugin-system" --locked✅cargo deny check advisories bans licenses sources✅