default volume persists restarts
This commit is contained in:
parent
a6d35aa6c2
commit
112cf972ac
@ -66,6 +66,7 @@ namespace NadekoBot.Classes
|
||||
get { return voicePlusTextEnabled; }
|
||||
set {
|
||||
voicePlusTextEnabled = value;
|
||||
if (!SpecificConfigurations.Instantiated) return;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
@ -76,6 +77,7 @@ namespace NadekoBot.Classes
|
||||
get { return sendPrivateMessageOnMention; }
|
||||
set {
|
||||
sendPrivateMessageOnMention = value;
|
||||
if (!SpecificConfigurations.Instantiated) return;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
@ -133,6 +135,17 @@ namespace NadekoBot.Classes
|
||||
}
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
private float defaultMusicVolume = 1f;
|
||||
public float DefaultMusicVolume {
|
||||
get { return defaultMusicVolume; }
|
||||
set {
|
||||
defaultMusicVolume = value;
|
||||
if (!SpecificConfigurations.Instantiated) return;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public ServerSpecificConfig()
|
||||
{
|
||||
ListOfSelfAssignableRoles = new ObservableCollection<ulong>();
|
||||
|
@ -19,7 +19,6 @@ namespace NadekoBot.Modules.Music
|
||||
{
|
||||
|
||||
public static ConcurrentDictionary<Server, MusicPlayer> MusicPlayers = new ConcurrentDictionary<Server, MusicPlayer>();
|
||||
public static ConcurrentDictionary<ulong, float> DefaultMusicVolumes = new ConcurrentDictionary<ulong, float>();
|
||||
|
||||
public MusicModule()
|
||||
{
|
||||
@ -200,7 +199,8 @@ namespace NadekoBot.Modules.Music
|
||||
await e.Channel.SendMessage("Volume number invalid.").ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
DefaultMusicVolumes.AddOrUpdate(e.Server.Id, volume / 100, (key, newval) => volume / 100);
|
||||
var conf = SpecificConfigurations.Default.Of(e.Server.Id);
|
||||
conf.DefaultMusicVolume = volume / 100;
|
||||
await e.Channel.SendMessage($"🎵 `Default volume set to {volume}%`").ConfigureAwait(false);
|
||||
});
|
||||
|
||||
@ -709,10 +709,7 @@ namespace NadekoBot.Modules.Music
|
||||
|
||||
var musicPlayer = MusicPlayers.GetOrAdd(textCh.Server, server =>
|
||||
{
|
||||
float? vol = null;
|
||||
float throwAway;
|
||||
if (DefaultMusicVolumes.TryGetValue(server.Id, out throwAway))
|
||||
vol = throwAway;
|
||||
float vol = SpecificConfigurations.Default.Of(server.Id).DefaultMusicVolume;
|
||||
var mp = new MusicPlayer(voiceCh, vol);
|
||||
|
||||
|
||||
|
@ -136,7 +136,7 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="Modules\Administration\Commands\AutoAssignRole.cs" />
|
||||
<Compile Include="Modules\Administration\Commands\CustomReactionsCommands.cs" />
|
||||
<Compile Include="Modules\Administration\Commands\SelfAssignedRolesCommand - Copy.cs" />
|
||||
<Compile Include="Modules\Administration\Commands\SelfAssignedRolesCommand.cs" />
|
||||
<Compile Include="Modules\Administration\Commands\SelfCommands.cs" />
|
||||
<Compile Include="Modules\ClashOfClans\ClashOfClans.cs" />
|
||||
<Compile Include="Classes\DBHandler.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user