Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ keyring = ["notecli/keyring"]

[dependencies]
# semver 未安定のため rev ピン。更新は意図的に rev を進める (ARCHITECTURE.md §10)
notecli = { git = "https://github.com/notedeck-dev/notecli.git", rev = "f1931af84a384c749efa2cd5b9aa478d22d19393", default-features = false }
notecli = { git = "https://github.com/notedeck-dev/notecli.git", rev = "1f68a91a52894c9950bdb107faae61b346f6e260", default-features = false }
tokio = { version = "1", features = ["rt-multi-thread", "macros", "signal", "sync", "time"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
Expand Down
6 changes: 3 additions & 3 deletions src/bot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::sync::Arc;
use notecli::api::MisskeyClient;
use notecli::db::Database;
use notecli::event_bus::EventBus;
use notecli::models::{Account, NormalizedNote, NormalizedUser, TimelineType};
use notecli::models::{Account, NormalizedNote, NormalizedUser, TimelineKey};
use notecli::streaming::StreamingManager;
use serde_json::Value;
use tokio::sync::mpsc;
Expand Down Expand Up @@ -246,9 +246,9 @@ impl Bot {
std::collections::HashMap::new();
for (timeline, handler) in &self.on_note {
let sub_id = manager
.subscribe_timeline(
.subscribe_notes(
&creds.account_id,
TimelineType::new(timeline.as_str()),
TimelineKey::parse(timeline.as_str())?,
None,
)
.await?;
Expand Down
11 changes: 8 additions & 3 deletions src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! ここでは emit された JSON payload から必要な部分だけを取り出す。

use notecli::models::{NormalizedNote, NormalizedNotification};
use notecli::streaming::FrontendEmitter;
use notecli::streaming::{FrontendEmitter, StreamEvent};
use serde_json::Value;
use tokio::sync::mpsc;

Expand All @@ -21,9 +21,14 @@ impl ChannelEmitter {
}

impl FrontendEmitter for ChannelEmitter {
fn emit(&self, event: &str, payload: Value) {
fn emit(&self, event: StreamEvent) {
// typed StreamEvent を (イベント名, payload JSON) に落として流す。
// parse_event / catch-up 再注入 (stream-mention + Value) の経路を
// そのまま維持するため、名前と payload は notecli の正本メソッドから取る。
// 受信側 drop 後の send 失敗は shutdown 中なので無視してよい
let _ = self.0.send((event.to_string(), payload));
let _ = self
.0
.send((event.kind().to_string(), event.payload_value()));
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ mod tests {
NoteDeckError::Api {
endpoint: "notes/create".to_string(),
status: 429,
api_code: Some("RATE_LIMIT_EXCEEDED".to_string()),
message: "notes/create: RATE_LIMIT_EXCEEDED: Rate limit exceeded".to_string(),
}
}
Expand All @@ -83,6 +84,7 @@ mod tests {
NoteDeckError::Api {
endpoint: "notes/create".to_string(),
status: 400,
api_code: Some("NO_SUCH_NOTE".to_string()),
message: "notes/create: NO_SUCH_NOTE".to_string(),
}
}
Expand Down
Loading