File tree Expand file tree Collapse file tree
Discord Stream Notify Bot/Interaction/Youtube Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,15 +38,24 @@ public override async Task<AutocompletionResult> GenerateSuggestionsAsync(IInter
3838 {
3939 if ( item . Key . Contains ( value , StringComparison . CurrentCultureIgnoreCase ) || item . Value . Contains ( value , StringComparison . CurrentCultureIgnoreCase ) )
4040 {
41- channelIdList2 . Add ( item . Key , item . Value ) ;
41+ // 後來發現是有一個備用頻道的名稱跟主頻道名稱相同,之後備用頻道才改名稱,導致 Dictionary 出現重複的資料
42+ // 所以如果判定到有相同名稱的話就加上 "_2" 來區分
43+
44+ if ( channelIdList2 . ContainsKey ( item . Key ) )
45+ channelIdList2 . Add ( item . Key + "_2" , item . Value ) ;
46+ else
47+ channelIdList2 . Add ( item . Key , item . Value ) ;
4248 }
4349 }
4450 }
4551 else
4652 {
4753 foreach ( var item in channelIdList )
4854 {
49- channelIdList2 . Add ( item . Key , item . Value ) ;
55+ if ( channelIdList2 . ContainsKey ( item . Key ) )
56+ channelIdList2 . Add ( item . Key + "_2" , item . Value ) ;
57+ else
58+ channelIdList2 . Add ( item . Key , item . Value ) ;
5059 }
5160 }
5261 }
You can’t perform that action at this time.
0 commit comments