Skip to content

Commit be792a6

Browse files
committed
最初のコメントだけ読むオプションを追加
1 parent aaebd76 commit be792a6

File tree

7 files changed

+19
-4
lines changed

7 files changed

+19
-4
lines changed

BouyomiPlugin/ConfigView.xaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,7 @@
576576
<RowDefinition />
577577
<RowDefinition />
578578
<RowDefinition />
579+
<RowDefinition />
579580
</Grid.RowDefinitions>
580581
<Grid.ColumnDefinitions>
581582
<ColumnDefinition />
@@ -585,9 +586,10 @@
585586
</Grid.ColumnDefinitions>
586587
<CheckBox x:Name="CheckMixchComment" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="4" IsChecked="{Binding IsMixchComment}" Content="コメント" />
587588
<CheckBox IsEnabled="{Binding IsChecked, ElementName=CheckMixchComment}" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" IsChecked="{Binding IsMixchCommentNickname}" Content="コテハン" />
588-
<CheckBox x:Name="CheckMixchItem" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="4" IsChecked="{Binding IsMixchItem}" Content="アイテム" />
589-
<CheckBox IsEnabled="{Binding IsChecked, ElementName=CheckMixchItem}" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="3" IsChecked="{Binding IsMixchItemNickname}" Content="コテハン" />
590-
<CheckBox x:Name="CheckMixchSystem" Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="4" IsChecked="{Binding IsMixchSystem}" Content="システムメッセージ" />
589+
<CheckBox IsEnabled="{Binding IsChecked, ElementName=CheckMixchComment}" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" IsChecked="{Binding IsMixchCommentOnlyFirst}" Content="最初のコメントだけ読む" />
590+
<CheckBox x:Name="CheckMixchItem" Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="4" IsChecked="{Binding IsMixchItem}" Content="アイテム" />
591+
<CheckBox IsEnabled="{Binding IsChecked, ElementName=CheckMixchItem}" Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="3" IsChecked="{Binding IsMixchItemNickname}" Content="コテハン" />
592+
<CheckBox x:Name="CheckMixchSystem" Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="4" IsChecked="{Binding IsMixchSystem}" Content="システムメッセージ" />
591593
</Grid>
592594
</Border>
593595

BouyomiPlugin/ConfigViewModel.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,14 @@ public bool IsMixchCommentNickname
231231
set => _options.IsMixchCommentNickname = value;
232232
}
233233
/// <summary>
234+
/// MIXCHのコメントで最初だけ読むか
235+
/// </summary>
236+
public bool IsMixchCommentOnlyFirst
237+
{
238+
get => _options.IsMixchCommentOnlyFirst;
239+
set => _options.IsMixchCommentOnlyFirst = value;
240+
}
241+
/// <summary>
234242
/// MIXCHのアイテムを読み上げるか
235243
/// </summary>
236244
public bool IsMixchItem

BouyomiPlugin/Options.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class Options : DynamicOptionsBase
4343
//ミクチャ
4444
public bool IsMixchComment { get { return GetValue(); } set { SetValue(value); } }
4545
public bool IsMixchCommentNickname { get { return GetValue(); } set { SetValue(value); } }
46+
public bool IsMixchCommentOnlyFirst { get { return GetValue(); } set { SetValue(value); } }
4647
public bool IsMixchItem { get { return GetValue(); } set { SetValue(value); } }
4748
public bool IsMixchItemNickname { get { return GetValue(); } set { SetValue(value); } }
4849
public bool IsMixchSystem { get { return GetValue(); } set { SetValue(value); } }
@@ -164,6 +165,7 @@ protected override void Init()
164165
//ミクチャ
165166
Dict.Add(nameof(IsMixchComment), new Item { DefaultValue = true, Predicate = b => true, Serializer = b => b.ToString(), Deserializer = s => bool.Parse(s) });
166167
Dict.Add(nameof(IsMixchCommentNickname), new Item { DefaultValue = true, Predicate = b => true, Serializer = b => b.ToString(), Deserializer = s => bool.Parse(s) });
168+
Dict.Add(nameof(IsMixchCommentOnlyFirst), new Item { DefaultValue = false, Predicate = b => true, Serializer = b => b.ToString(), Deserializer = s => bool.Parse(s) });
167169
Dict.Add(nameof(IsMixchItem), new Item { DefaultValue = true, Predicate = b => true, Serializer = b => b.ToString(), Deserializer = s => bool.Parse(s) });
168170
Dict.Add(nameof(IsMixchItemNickname), new Item { DefaultValue = true, Predicate = b => true, Serializer = b => b.ToString(), Deserializer = s => bool.Parse(s) });
169171
Dict.Add(nameof(IsMixchSystem), new Item { DefaultValue = true, Predicate = b => true, Serializer = b => b.ToString(), Deserializer = s => bool.Parse(s) });

BouyomiPlugin/main.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ private static (string name, string comment) GetData(ISiteMessage message, Optio
223223
switch (mixchMessage.MixchMessageType)
224224
{
225225
case MixchMessageType.Comment:
226-
if (options.IsMixchComment)
226+
if (options.IsMixchComment && (!options.IsMixchCommentOnlyFirst || mixchMessage.IsFirstComment))
227227
{
228228
if (options.IsMixchCommentNickname)
229229
{

MixchIF/Message.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public interface IMixchMessage : ISiteMessage
2727
IEnumerable<IMessagePart> MessageItems { get; }
2828
string Id { get; }
2929
DateTime PostTime { get; }
30+
bool IsFirstComment { get; }
3031
string UserId { get; }
3132
}
3233
}

MixchSitePlugin/CommentProvider.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ private MixchMessageContext CreateMessageContext(Packet p, bool isInitialComment
255255
NameItems = nameItems,
256256
PostTime = DateTimeOffset.FromUnixTimeSeconds(p.Created).LocalDateTime,
257257
UserId = p.UserId.ToString(),
258+
IsFirstComment = isFirstComment,
258259
};
259260
var metadata = new MessageMetadata(message, _options, _siteOptions, user, this, isFirstComment)
260261
{

MixchSitePlugin/Message/MixchMessage.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ internal class MixchMessage : MessageBase2, IMixchMessage
1111
public string Id { get; set; }
1212
public string UserId { get; set; }
1313
public DateTime PostTime { get; set; }
14+
public bool IsFirstComment { get; set; }
1415
public IEnumerable<IMessagePart> NameItems { get; set; }
1516
public IEnumerable<IMessagePart> MessageItems { get; set; }
1617
public MixchMessage(string raw) : base(raw)

0 commit comments

Comments
 (0)