Default music volume command added

This commit is contained in:
Kwoth 2016-08-30 03:22:15 +02:00
parent 7647f71020
commit 598865609e

View File

@ -182,23 +182,25 @@ namespace NadekoBot.Modules.Music
var volume = musicPlayer.SetVolume(val); var volume = musicPlayer.SetVolume(val);
await channel.SendMessageAsync($"🎵 `Volume set to {volume}%`").ConfigureAwait(false); await channel.SendMessageAsync($"🎵 `Volume set to {volume}%`").ConfigureAwait(false);
} }
////todo DB
//[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]
//[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
//public async Task Defvol(IUserMessage umsg, [Remainder] int val) public async Task Defvol(IUserMessage umsg, [Remainder] int val)
//{ {
// var channel = (ITextChannel)umsg.Channel; var channel = (ITextChannel)umsg.Channel;
// var arg = val;
// float volume; if (val < 0 || val > 100)
// if (!float.TryParse(arg, out volume) || volume < 0 || volume > 100) {
// { await channel.SendMessageAsync("Volume number invalid. Must be between 0 and 100").ConfigureAwait(false);
// await channel.SendMessageAsync("Volume number invalid.").ConfigureAwait(false); return;
// return; }
// } using (var uow = DbHandler.UnitOfWork())
// var conf = SpecificConfigurations.Default.Of(channel.Guild.Id); {
// conf.DefaultMusicVolume = volume / 100; uow.GuildConfigs.For(channel.Guild.Id).DefaultMusicVolume = val / 100.0f;
// await channel.SendMessageAsync($"🎵 `Default volume set to {volume}%`").ConfigureAwait(false); uow.Complete();
//} }
await channel.SendMessageAsync($"🎵 `Default volume set to {val}%`").ConfigureAwait(false);
}
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]