Skip to content

Commit 3e11254

Browse files
feat: skip user tts and phonetic word swapping
Handling skipping user's TTS based on username and swapping out words in ways that TTS might pronounce them more accurately.
1 parent 251e06c commit 3e11254

31 files changed

+1049
-32
lines changed
10.3 KB
Loading
5.81 KB
Loading

src/TwitchStreamingTools/Configuration.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public static Configuration Instance {
7676
/// <summary>
7777
/// The collection of phonetic pronunciations of words.
7878
/// </summary>
79-
public IDictionary<string, string>? TtsPhoneticUsernames { get; set; }
79+
public IDictionary<string, string>? TtsPhonetics { get; set; }
8080

8181
/// <summary>
8282
/// Writes the configuration file to disk.
@@ -86,7 +86,7 @@ public bool WriteConfiguration() {
8686
try {
8787
Directory.CreateDirectory(Path.GetDirectoryName(CONFIG_LOCATION)!);
8888

89-
string json = JsonConvert.SerializeObject(this);
89+
string json = JsonConvert.SerializeObject(this, Formatting.Indented);
9090
File.WriteAllText(CONFIG_LOCATION, json);
9191
return true;
9292
}

src/TwitchStreamingTools/Constants.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,26 @@ public static class Constants {
5252
/// <remarks>This is a hack because it's hard to get to.</remarks>
5353
public static IClipboard? Clipboard;
5454

55+
/// <summary>
56+
/// The default bot list to populate when a user doesn't any have bots configured.
57+
/// </summary>
58+
public static readonly IEnumerable<string> TWITCH_DEFAULT_BOT_LIST = new[] {
59+
"streamelements",
60+
"nightbot",
61+
"sery_bot",
62+
"wizebot",
63+
"kofistreambot",
64+
"tangiabot",
65+
"botrixoficial",
66+
"moobot",
67+
"own3d",
68+
"creatisbot",
69+
"frostytoolsdotcom",
70+
"streamlabs",
71+
"pokemoncommunitygame",
72+
"fossabot"
73+
};
74+
5575
/// <summary>
5676
/// The twitch permissions to request.
5777
/// </summary>
@@ -78,6 +98,7 @@ public static class Constants {
7898
"clips:edit",
7999
"moderation:read",
80100
"moderator:manage:automod",
101+
"moderator:read:chatters",
81102
"user:edit",
82103
"user:edit:follows",
83104
"user:manage:blocked_users",

src/TwitchStreamingTools/Views/Loading.axaml renamed to src/TwitchStreamingTools/Controls/Loading.axaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
44
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
55
mc:Ignorable="d" Width="200" Height="200"
6-
x:Class="TwitchStreamingTools.Views.Loading">
6+
x:Class="TwitchStreamingTools.Controls.Loading">
77
<UserControl.Styles>
88
<Style Selector="Rectangle.textColor">
99
<Setter Property="Fill" Value="rgb(204, 200, 175)" />

src/TwitchStreamingTools/Views/Loading.axaml.cs renamed to src/TwitchStreamingTools/Controls/Loading.axaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using Avalonia.Controls;
22

3-
namespace TwitchStreamingTools.Views;
3+
namespace TwitchStreamingTools.Controls;
44

55
/// <summary>
66
/// A loading icon.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<UserControl xmlns="https://github.com/avaloniaui"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
4+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5+
xmlns:viewModels="clr-namespace:TwitchStreamingTools.Controls.ViewModels"
6+
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
7+
x:Class="TwitchStreamingTools.Controls.TwoListView"
8+
x:DataType="viewModels:TwoListViewModel">
9+
<Design.DataContext>
10+
<viewModels:TwoListViewModel />
11+
</Design.DataContext>
12+
13+
<Grid>
14+
<Grid.RowDefinitions>
15+
<RowDefinition Height="Auto" />
16+
<RowDefinition Height="*" />
17+
</Grid.RowDefinitions>
18+
<Grid.ColumnDefinitions>
19+
<ColumnDefinition Width="*" />
20+
<ColumnDefinition Width="*" />
21+
</Grid.ColumnDefinitions>
22+
<TextBlock Grid.Row="0" Grid.Column="0" FontWeight="Bold" Text="{Binding LeftHeader}"
23+
HorizontalAlignment="Center" Margin="0,5,0,5" />
24+
<TextBlock Grid.Row="0" Grid.Column="1" FontWeight="Bold" Text="{Binding RightHeader}"
25+
HorizontalAlignment="Center" Margin="0,5,0,5" />
26+
<ListBox Grid.Row="1" Grid.Column="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
27+
ItemsSource="{Binding LeftList, Mode=TwoWay}" DoubleTapped="Left_OnDoubleTapped" />
28+
<ListBox Grid.Row="1" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
29+
ItemsSource="{Binding RightList, Mode=TwoWay}" DoubleTapped="Right_OnDoubleTapped" />
30+
</Grid>
31+
</UserControl>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
using Avalonia.Controls;
2+
using Avalonia.Interactivity;
3+
using Avalonia.Markup.Xaml;
4+
5+
using TwitchStreamingTools.Controls.ViewModels;
6+
7+
namespace TwitchStreamingTools.Controls;
8+
9+
/// <summary>
10+
/// A control that handles maintaining two lists and moving items between them.
11+
/// </summary>
12+
public partial class TwoListView : UserControl {
13+
/// <summary>
14+
/// Initializes a new instance of the <see cref="TwoListView" /> class.
15+
/// </summary>
16+
public TwoListView() {
17+
InitializeComponent();
18+
}
19+
20+
/// <summary>
21+
/// Initializes the GUI components.
22+
/// </summary>
23+
private void InitializeComponent() {
24+
AvaloniaXamlLoader.Load(this);
25+
}
26+
27+
/// <summary>
28+
/// Raised when an item in the left list is double clicked.
29+
/// </summary>
30+
/// <param name="sender">The list view.</param>
31+
/// <param name="e">The event arguments.</param>
32+
private void Left_OnDoubleTapped(object? sender, RoutedEventArgs e) {
33+
(DataContext as TwoListViewModel)?.OnLeftDoubleClick?.Invoke((sender as ListBox)?.SelectedItem as string);
34+
}
35+
36+
/// <summary>
37+
/// Raised when an item in the right list is double clicked.
38+
/// </summary>
39+
/// <param name="sender">The list view.</param>
40+
/// <param name="e">The event arguments.</param>
41+
private void Right_OnDoubleTapped(object? sender, RoutedEventArgs e) {
42+
(DataContext as TwoListViewModel)?.OnRightDoubleClick?.Invoke((sender as ListBox)?.SelectedItem as string);
43+
}
44+
}

0 commit comments

Comments
 (0)