1111using TVTComment . Model . ChatCollectServiceEntry ;
1212using TVTComment . Model . NiconicoUtils ;
1313using TVTComment . Model . TwitterUtils ;
14+ using TVTComment . Model . TwitterUtils . AnnictUtils ;
1415using static TVTComment . Model . ChatCollectServiceEntry . TwitterLiveChatCollectServiceEntry . ChatCollectServiceCreationOption ;
1516
1617namespace TVTComment . Model . ChatCollectService
@@ -37,15 +38,16 @@ public ChatPostObject(string text, string suffixtext) : base(text)
3738 private readonly ConcurrentQueue < Status > statusQueue = new ConcurrentQueue < Status > ( ) ;
3839 private readonly CancellationTokenSource cancel = new CancellationTokenSource ( ) ;
3940 private readonly ObservableValue < string > SearchWord = new ObservableValue < string > ( "" ) ;
41+ private readonly ObservableValue < string > EventTextWord = new ObservableValue < string > ( "" ) ;
4042 private readonly SearchWordResolver SearchWordResolver ;
4143 private readonly ModeSelectMethod ModeSelect ;
42-
44+ private readonly AnnictApis Annict ;
4345
4446 public TwitterLiveChatCollectService ( IChatCollectServiceEntry serviceEntry , string searchWord , ModeSelectMethod modeSelect , SearchWordResolver searchWordResolver , TwitterAuthentication twitter )
4547 {
48+ Twitter = twitter ;
4649 ServiceEntry = serviceEntry ;
4750 SearchWord . Value = searchWord ;
48- Twitter = twitter ;
4951 ModeSelect = modeSelect ;
5052 SearchWordResolver = searchWordResolver ;
5153 switch ( modeSelect )
@@ -58,6 +60,10 @@ public TwitterLiveChatCollectService(IChatCollectServiceEntry serviceEntry, stri
5860 chatCollectTask = SearchStreamAsync ( searchWord , cancel . Token ) ;
5961 break ;
6062 }
63+ if ( Twitter . AnnictToken != null && ! Twitter . AnnictToken . Equals ( "" ) ) {
64+ Annict = new ( Twitter . AnnictToken ) ;
65+ EventTextWord . Where ( x => x != null && ! x . Equals ( "" ) ) . Subscribe ( res => _ = annictSearch ( EventTextWord . Value ) ) ;
66+ }
6167 }
6268
6369 public string GetInformationText ( )
@@ -81,11 +87,16 @@ await Task.Run(() =>
8187 } , cancel ) ;
8288 }
8389
90+ private async Task annictSearch ( string evetnText )
91+ {
92+ var result = await Annict . GetTwitterHashtagAsync ( evetnText ) ;
93+ if ( result != null && ! result . Equals ( "" ) ) SearchWord . Value += " OR #" + result ;
94+ }
95+
8496 public IEnumerable < Chat > GetChats ( ChannelInfo channel , EventInfo events , DateTime time )
8597 {
8698 if ( ModeSelect == ModeSelectMethod . Auto )
8799 {
88-
89100 SearchWord . Value = SearchWordResolver . Resolve ( channel . NetworkId , channel . ServiceId ) ;
90101 }
91102 if ( chatCollectTask != null )
@@ -100,6 +111,9 @@ public IEnumerable<Chat> GetChats(ChannelInfo channel,EventInfo events, DateTime
100111 }
101112 }
102113
114+ var result = AnnimeTitleGetter . Convert ( events . EventName ) ;
115+ if ( result != null && ! result . Equals ( "" ) ) EventTextWord . Value = result ;
116+
103117 var list = new List < Chat > ( ) ;
104118 while ( statusQueue . TryDequeue ( out var status ) )
105119 {
0 commit comments