Added many more braces for multiline if's, Improved .crypto command quite a bit and applied locale-specific format

This commit is contained in:
Kwoth
2022-02-04 06:00:17 +01:00
parent f77f2f433f
commit eda38e64d1
129 changed files with 635 additions and 233 deletions

View File

@@ -288,9 +288,7 @@ public sealed partial class Music : NadekoModule<IMusicService>
// if (mps > 0)
// add += Format.Bold(GetText(strs.song_skips_after(TimeSpan.FromSeconds(mps).ToString("HH\\:mm\\:ss")))) + "\n";
if (repeatType == PlayerRepeatType.Track)
{
add += "🔂 " + GetText(strs.repeating_track) + "\n";
}
else
{
// if (mp.Autoplay)

View File

@@ -69,12 +69,14 @@ public sealed partial class Music
var pl = uow.MusicPlaylists.FirstOrDefault(x => x.Id == id);
if (pl is not null)
{
if (_creds.IsOwner(ctx.User) || pl.AuthorId == ctx.User.Id)
{
uow.MusicPlaylists.Remove(pl);
await uow.SaveChangesAsync();
success = true;
}
}
}
catch (Exception ex)
{

View File

@@ -219,8 +219,10 @@ public sealed class MusicService : IMusicService
=> _ =>
{
if (_settings.TryGetValue(guildId, out var settings))
{
if (settings.AutoDisconnect)
return LeaveVoiceChannelAsync(guildId);
}
return Task.CompletedTask;
};
@@ -232,9 +234,11 @@ public sealed class MusicService : IMusicService
return false;
if (mp.IsStopped)
{
if (!_voiceStateService.TryGetProxy(guildId, out var proxy)
|| proxy.State == VoiceProxy.VoiceProxyState.Stopped)
await JoinVoiceChannelAsync(guildId, voiceChannelId);
}
mp.Next();
return true;

View File

@@ -44,6 +44,7 @@ public class RadioResolver : IRadioResolver
if (query.Contains(".pls"))
//File1=http://armitunes.com:8000/
//Regex.Match(query)
{
try
{
var m = _plsRegex.Match(file);
@@ -55,6 +56,7 @@ public class RadioResolver : IRadioResolver
Log.Warning("Failed reading .pls:\n{PlsFile}", file);
return null;
}
}
if (query.Contains(".m3u"))
/*
@@ -62,6 +64,7 @@ public class RadioResolver : IRadioResolver
C:\xxx4xx\xxxxxx3x\xx2xxxx\xx.mp3
C:\xxx5xx\x6xxxxxx\x7xxxxx\xx.mp3
*/
{
try
{
var m = _m3URegex.Match(file);
@@ -73,9 +76,11 @@ public class RadioResolver : IRadioResolver
Log.Warning("Failed reading .m3u:\n{M3uFile}", file);
return null;
}
}
if (query.Contains(".asx"))
//<ref href="http://armitunes.com:8000"/>
{
try
{
var m = _asxRegex.Match(file);
@@ -87,6 +92,7 @@ public class RadioResolver : IRadioResolver
Log.Warning("Failed reading .asx:\n{AsxFile}", file);
return null;
}
}
if (query.Contains(".xspf"))
/*
@@ -95,6 +101,7 @@ public class RadioResolver : IRadioResolver
<trackList>
<track><location>file:///mp3s/song_1.mp3</location></track>
*/
{
try
{
var m = _xspfRegex.Match(file);
@@ -106,6 +113,7 @@ public class RadioResolver : IRadioResolver
Log.Warning("Failed reading .xspf:\n{XspfFile}", file);
return null;
}
}
return query;
}

View File

@@ -205,9 +205,7 @@ public sealed class YtdlYoutubeResolver : IYoutubeResolver
yield return info;
}
else
{
data += Environment.NewLine;
}
}
await _trackCacher.CachePlaylistTrackIdsAsync(playlistId, MusicPlatform.Youtube, trackIds);