Skip to content

Commit c633706

Browse files
committed
棒読みちゃんにTwitchのエモートのIDを読んでもらえるようにした
1 parent 76b3c55 commit c633706

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

Diff for: BouyomiPlugin/ConfigView.xaml

+2
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@
187187
<Grid.RowDefinitions>
188188
<RowDefinition />
189189
<RowDefinition />
190+
<RowDefinition />
190191
</Grid.RowDefinitions>
191192
<Grid.ColumnDefinitions>
192193
<ColumnDefinition />
@@ -196,6 +197,7 @@
196197
</Grid.ColumnDefinitions>
197198
<CheckBox x:Name="CheckTwitchComment" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="4" IsChecked="{Binding IsTwitchComment}" Content="コメント" />
198199
<CheckBox IsEnabled="{Binding IsChecked, ElementName=CheckTwitchComment}" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" IsChecked="{Binding IsTwitchCommentNickname}" Content="コテハン" />
200+
<CheckBox IsEnabled="{Binding IsChecked, ElementName=CheckTwitchComment}" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" IsChecked="{Binding IsTwitchCommentEmoteId}" Content="エモートID" />
199201
</Grid>
200202
</Grid>
201203
</Border>

Diff for: BouyomiPlugin/ConfigViewModel.cs

+8
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,14 @@ public bool IsTwitchCommentNickname
297297
get => _options.IsTwitchCommentNickname;
298298
set => _options.IsTwitchCommentNickname = value;
299299
}
300+
/// <summary>
301+
/// TwitchのコメントのエモートIDを読み上げるか
302+
/// </summary>
303+
public bool IsTwitchCommentEmoteId
304+
{
305+
get => _options.IsTwitchCommentEmoteId;
306+
set => _options.IsTwitchCommentEmoteId = value;
307+
}
300308
///// <summary>
301309
///// Twitchのアイテムを読み上げるか
302310
///// </summary>

Diff for: BouyomiPlugin/Options.cs

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class Options : DynamicOptionsBase
5353
public bool IsTwitchDisconnect { get { return GetValue(); } set { SetValue(value); } }
5454
public bool IsTwitchComment { get { return GetValue(); } set { SetValue(value); } }
5555
public bool IsTwitchCommentNickname { get { return GetValue(); } set { SetValue(value); } }
56+
public bool IsTwitchCommentEmoteId { get { return GetValue(); } set { SetValue(value); } }
5657

5758
//ニコ生
5859
public bool IsNicoConnect { get { return GetValue(); } set { SetValue(value); } }
@@ -178,6 +179,7 @@ protected override void Init()
178179
Dict.Add(nameof(IsTwitchDisconnect), new Item { DefaultValue = false, Predicate = b => true, Serializer = b => b.ToString(), Deserializer = s => bool.Parse(s) });
179180
Dict.Add(nameof(IsTwitchComment), new Item { DefaultValue = true, Predicate = b => true, Serializer = b => b.ToString(), Deserializer = s => bool.Parse(s) });
180181
Dict.Add(nameof(IsTwitchCommentNickname), new Item { DefaultValue = true, Predicate = b => true, Serializer = b => b.ToString(), Deserializer = s => bool.Parse(s) });
182+
Dict.Add(nameof(IsTwitchCommentEmoteId), new Item { DefaultValue = false, Predicate = b => true, Serializer = b => b.ToString(), Deserializer = s => bool.Parse(s) });
181183

182184
//ニコ生
183185
Dict.Add(nameof(IsNicoConnect), new Item { DefaultValue = false, Predicate = b => true, Serializer = b => b.ToString(), Deserializer = s => bool.Parse(s) });

Diff for: BouyomiPlugin/main.cs

+8-1
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,14 @@ private static (string name, string comment) GetData(ISiteMessage message, Optio
291291
{
292292
name = (twitchMessage as ITwitchComment).DisplayName;
293293
}
294-
comment = (twitchMessage as ITwitchComment).CommentItems.ToText();
294+
if (options.IsTwitchCommentEmoteId)
295+
{
296+
comment = (twitchMessage as ITwitchComment).CommentItems.ToTextWithImageAlt();
297+
}
298+
else
299+
{
300+
comment = (twitchMessage as ITwitchComment).CommentItems.ToText();
301+
}
295302
}
296303
break;
297304
}

0 commit comments

Comments
 (0)