mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-03 08:57:54 +00:00
mut cleanup
This commit is contained in:
1 parent
4b0cd9c197
commit
38deee044f
2 files changed
+5
-7
No files matched your search
+3
-4
@@ -29,7 +29,7 @@ impl BitsEventHandler {
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn handle(&mut self, topic: ChannelBitsEventsV2, reply: Box<ChannelBitsEventsV2Reply>) -> AnyhowResult<()> {
|
||||
pub async fn handle(&self, topic: ChannelBitsEventsV2, reply: Box<ChannelBitsEventsV2Reply>) -> AnyhowResult<()> {
|
||||
match *reply {
|
||||
ChannelBitsEventsV2Reply::BitsEvent { data, message_id, version, is_anonymous } => {
|
||||
self.handle_bits_event(&data).await?;
|
||||
@@ -39,15 +39,14 @@ impl BitsEventHandler {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// NB: &mut is for Redis pool in downstream write_tts.
|
||||
async fn handle_bits_event(&mut self, data: &BitsEventData) -> AnyhowResult<()> {
|
||||
async fn handle_bits_event(&self, data: &BitsEventData) -> AnyhowResult<()> {
|
||||
self.tts_writer.write_tts(&data.chat_message).await?;
|
||||
// Report event for analytics
|
||||
self.report_event_for_analytics(&data).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn report_event_for_analytics(&mut self, data: &BitsEventData) -> AnyhowResult<()> {
|
||||
async fn report_event_for_analytics(&self, data: &BitsEventData) -> AnyhowResult<()> {
|
||||
let user_id = data.user_id.to_string();
|
||||
let user_name = data.user_name.to_string();
|
||||
let mut event_builder = TwitchPubsubBitsInsertBuilder::new();
|
||||
|
||||
+2
-3
@@ -29,7 +29,7 @@ impl ChannelPointsEventHandler {
|
||||
}
|
||||
|
||||
// NB: &mut is for Redis pool in downstream write_tts.
|
||||
pub async fn handle(&mut self, topic: ChannelPointsChannelV1, reply: Box<ChannelPointsChannelV1Reply>) -> AnyhowResult<()> {
|
||||
pub async fn handle(&self, topic: ChannelPointsChannelV1, reply: Box<ChannelPointsChannelV1Reply>) -> AnyhowResult<()> {
|
||||
match *reply {
|
||||
// Unimplemented
|
||||
ChannelPointsChannelV1Reply::CustomRewardUpdated { .. } => {}
|
||||
@@ -45,8 +45,7 @@ impl ChannelPointsEventHandler {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// NB: &mut is for Redis pool in downstream write_tts.
|
||||
async fn handle_reward_redeemed(&mut self, redemption: Redemption) -> AnyhowResult<()> {
|
||||
async fn handle_reward_redeemed(&self, redemption: Redemption) -> AnyhowResult<()> {
|
||||
if let Some(user_text) = redemption.user_input.as_deref() {
|
||||
self.tts_writer.write_tts(user_text).await?;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user