mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 09:48:26 -04:00
NadekoBot.Extensions should now be fully annotated with nullable reference types as well as many classes from NadekoBot.Common
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
namespace NadekoBot.Modules.Music;
|
||||
#nullable disable
|
||||
namespace NadekoBot.Modules.Music;
|
||||
|
||||
public interface ICachableTrackData
|
||||
{
|
||||
@@ -8,4 +9,4 @@ public interface ICachableTrackData
|
||||
public TimeSpan Duration { get; }
|
||||
MusicPlatform Platform { get; set; }
|
||||
string Title { get; set; }
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
namespace NadekoBot.Modules.Music;
|
||||
#nullable disable
|
||||
namespace NadekoBot.Modules.Music;
|
||||
|
||||
public interface ILocalTrackResolver : IPlatformQueryResolver
|
||||
{
|
||||
IAsyncEnumerable<ITrackInfo> ResolveDirectoryAsync(string dirPath);
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,5 @@
|
||||
using NadekoBot.Services.Database.Models;
|
||||
|
||||
#nullable enable
|
||||
namespace NadekoBot.Modules.Music;
|
||||
|
||||
public interface IMusicPlayer : IDisposable
|
||||
@@ -32,4 +31,4 @@ public interface IMusicPlayer : IDisposable
|
||||
void EnqueueTracks(IEnumerable<ITrackInfo> tracks, string queuer);
|
||||
void SetRepeat(PlayerRepeatType type);
|
||||
void ShuffleQueue();
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
namespace NadekoBot.Modules.Music;
|
||||
namespace NadekoBot.Modules.Music;
|
||||
|
||||
public interface IMusicQueue
|
||||
{
|
||||
@@ -20,4 +19,4 @@ public interface IMusicQueue
|
||||
IQueuedTrackInfo? MoveTrack(int from, int to);
|
||||
void Shuffle(Random rng);
|
||||
bool IsLast();
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,6 @@
|
||||
#nullable enable
|
||||
namespace NadekoBot.Modules.Music;
|
||||
namespace NadekoBot.Modules.Music;
|
||||
|
||||
public interface IPlatformQueryResolver
|
||||
{
|
||||
Task<ITrackInfo?> ResolveByQueryAsync(string query);
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,9 @@
|
||||
namespace NadekoBot.Modules.Music;
|
||||
#nullable disable
|
||||
namespace NadekoBot.Modules.Music;
|
||||
|
||||
public interface IQueuedTrackInfo : ITrackInfo
|
||||
{
|
||||
public ITrackInfo TrackInfo { get; }
|
||||
|
||||
public string Queuer { get; }
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
namespace NadekoBot.Modules.Music;
|
||||
#nullable disable
|
||||
namespace NadekoBot.Modules.Music;
|
||||
|
||||
public interface IRadioResolver : IPlatformQueryResolver
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,8 @@
|
||||
namespace NadekoBot.Modules.Music;
|
||||
#nullable disable
|
||||
namespace NadekoBot.Modules.Music;
|
||||
|
||||
public interface ISoundcloudResolver : IPlatformQueryResolver
|
||||
{
|
||||
bool IsSoundCloudLink(string url);
|
||||
IAsyncEnumerable<ITrackInfo> ResolvePlaylistAsync(string playlist);
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
namespace NadekoBot.Modules.Music;
|
||||
namespace NadekoBot.Modules.Music;
|
||||
|
||||
public interface ITrackCacher
|
||||
{
|
||||
@@ -18,4 +17,4 @@ public interface ITrackCacher
|
||||
Task CachePlaylistTrackIdsAsync(string playlistId, MusicPlatform platform, IEnumerable<string> ids);
|
||||
Task CachePlaylistIdByQueryAsync(string query, MusicPlatform platform, string playlistId);
|
||||
Task<string?> GetPlaylistIdByQueryAsync(string query, MusicPlatform platform);
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
namespace NadekoBot.Modules.Music;
|
||||
namespace NadekoBot.Modules.Music;
|
||||
|
||||
public interface ITrackInfo
|
||||
{
|
||||
@@ -9,4 +8,4 @@ public interface ITrackInfo
|
||||
public TimeSpan Duration { get; }
|
||||
public MusicPlatform Platform { get; }
|
||||
public ValueTask<string?> GetStreamUrl();
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,6 @@
|
||||
#nullable enable
|
||||
namespace NadekoBot.Modules.Music;
|
||||
namespace NadekoBot.Modules.Music;
|
||||
|
||||
public interface ITrackResolveProvider
|
||||
{
|
||||
Task<ITrackInfo?> QuerySongAsync(string query, MusicPlatform? forcePlatform);
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using Ayu.Discord.Voice;
|
||||
#nullable disable
|
||||
using Ayu.Discord.Voice;
|
||||
|
||||
namespace NadekoBot.Modules.Music;
|
||||
|
||||
@@ -11,4 +12,4 @@ public interface IVoiceProxy
|
||||
Task StopSpeakingAsync();
|
||||
public Task StartGateway();
|
||||
Task StopGateway();
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace NadekoBot.Modules.Music;
|
||||
|
||||
@@ -9,4 +8,4 @@ public interface IYoutubeResolver : IPlatformQueryResolver
|
||||
public Task<ITrackInfo?> ResolveByIdAsync(string id);
|
||||
IAsyncEnumerable<ITrackInfo> ResolveTracksFromPlaylistAsync(string query);
|
||||
Task<ITrackInfo?> ResolveByQueryAsync(string query, bool tryExtractingId);
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using System.Text.Json.Serialization;
|
||||
#nullable disable
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace NadekoBot.Modules.Music;
|
||||
|
||||
@@ -12,4 +13,4 @@ public sealed class CachableTrackData : ICachableTrackData
|
||||
[JsonIgnore]
|
||||
public TimeSpan Duration => TimeSpan.FromMilliseconds(TotalDurationMs);
|
||||
public MusicPlatform Platform { get; set; }
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using System.Runtime.InteropServices;
|
||||
#nullable disable
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace NadekoBot.Modules.Music.Common;
|
||||
|
||||
@@ -84,4 +85,4 @@ public sealed class MultimediaTimer : IDisposable
|
||||
_lpTimeProc = default;
|
||||
timeKillEvent(_eventId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
namespace NadekoBot.Modules.Music;
|
||||
#nullable disable
|
||||
namespace NadekoBot.Modules.Music;
|
||||
|
||||
public static class MusicExtensions
|
||||
{
|
||||
@@ -53,4 +54,4 @@ public static class MusicExtensions
|
||||
Platform = trackInfo.Platform,
|
||||
Title = trackInfo.Title
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
namespace NadekoBot.Modules.Music;
|
||||
#nullable disable
|
||||
namespace NadekoBot.Modules.Music;
|
||||
|
||||
public enum MusicPlatform
|
||||
{
|
||||
@@ -6,4 +7,4 @@ public enum MusicPlatform
|
||||
Youtube,
|
||||
Local,
|
||||
SoundCloud,
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,3 @@
|
||||
#nullable enable
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
@@ -369,7 +368,7 @@ public sealed class MusicPlayer : IMusicPlayer
|
||||
for (var i = 0; i < samples.Length; i++)
|
||||
{
|
||||
ref var sample = ref samples[i];
|
||||
sample = sample * volume;
|
||||
sample *= volume;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -516,4 +515,4 @@ public sealed class MusicPlayer : IMusicPlayer
|
||||
public event Func<IMusicPlayer, IQueuedTrackInfo, Task>? OnCompleted;
|
||||
public event Func<IMusicPlayer, IQueuedTrackInfo, int, Task>? OnStarted;
|
||||
public event Func<IMusicPlayer, Task>? OnQueueStopped;
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
namespace NadekoBot.Modules.Music;
|
||||
namespace NadekoBot.Modules.Music;
|
||||
|
||||
public sealed partial class MusicQueue
|
||||
{
|
||||
@@ -314,4 +313,4 @@ public sealed partial class MusicQueue : IMusicQueue
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json;
|
||||
using StackExchange.Redis;
|
||||
|
||||
@@ -202,4 +201,4 @@ public sealed class RedisTrackCacher : ITrackCacher
|
||||
|
||||
return val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
namespace NadekoBot.Modules.Music;
|
||||
namespace NadekoBot.Modules.Music;
|
||||
|
||||
public sealed class RemoteTrackInfo : ITrackInfo
|
||||
{
|
||||
@@ -23,4 +22,4 @@ public sealed class RemoteTrackInfo : ITrackInfo
|
||||
}
|
||||
|
||||
public async ValueTask<string?> GetStreamUrl() => await _streamFactory();
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
namespace NadekoBot.Modules.Music;
|
||||
namespace NadekoBot.Modules.Music;
|
||||
|
||||
public sealed class SimpleTrackInfo : ITrackInfo
|
||||
{
|
||||
@@ -21,4 +20,4 @@ public sealed class SimpleTrackInfo : ITrackInfo
|
||||
Platform = platform;
|
||||
StreamUrl = streamUrl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using Ayu.Discord.Voice;
|
||||
#nullable disable
|
||||
using Ayu.Discord.Voice;
|
||||
using Ayu.Discord.Voice.Models;
|
||||
|
||||
namespace NadekoBot.Modules.Music;
|
||||
@@ -102,4 +103,4 @@ public sealed class VoiceProxy : IVoiceProxy
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,6 @@
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
|
||||
#nullable enable
|
||||
namespace NadekoBot.Modules.Music.Resolvers;
|
||||
|
||||
public sealed class LocalTrackResolver : ILocalTrackResolver
|
||||
@@ -121,4 +120,4 @@ public static class Ffprobe
|
||||
|
||||
return TimeSpan.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using System.Text.RegularExpressions;
|
||||
#nullable disable
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace NadekoBot.Modules.Music.Resolvers;
|
||||
|
||||
@@ -123,4 +124,4 @@ public class RadioResolver : IRadioResolver
|
||||
|
||||
return query;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,6 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
#nullable enable
|
||||
namespace NadekoBot.Modules.Music.Resolvers;
|
||||
|
||||
public sealed class SoundcloudResolver : ISoundcloudResolver
|
||||
@@ -89,4 +88,4 @@ public sealed class SoundcloudResolver : ISoundcloudResolver
|
||||
|
||||
return CachableDataToTrackInfo(cachableData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
namespace NadekoBot.Modules.Music;
|
||||
namespace NadekoBot.Modules.Music;
|
||||
|
||||
public sealed class TrackResolveProvider : ITrackResolveProvider
|
||||
{
|
||||
@@ -55,4 +54,4 @@ public sealed class TrackResolveProvider : ITrackResolveProvider
|
||||
query.Contains(".m3u") ||
|
||||
query.Contains(".asx") ||
|
||||
query.Contains(".xspf"));
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using System.Globalization;
|
||||
using System.Globalization;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace NadekoBot.Modules.Music;
|
||||
@@ -341,4 +340,4 @@ public sealed class YtdlYoutubeResolver : IYoutubeResolver
|
||||
cachedData.Duration
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using NadekoBot.Services.Database.Models;
|
||||
#nullable disable
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using NadekoBot.Modules.Administration.Services;
|
||||
using NadekoBot.Modules.Music.Services;
|
||||
|
||||
@@ -758,4 +759,4 @@ public sealed partial class Music : NadekoModule<IMusicService>
|
||||
await _service.SetMusicQualityAsync(ctx.Guild.Id, preset);
|
||||
await ReplyConfirmLocalizedAsync(strs.music_quality_set(Format.Bold(preset.ToString())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using NadekoBot.Services.Database.Models;
|
||||
#nullable disable
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using NadekoBot.Db;
|
||||
using NadekoBot.Modules.Music.Services;
|
||||
|
||||
@@ -232,4 +233,4 @@ public sealed partial class Music
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using System.Reflection;
|
||||
#nullable disable
|
||||
using System.Reflection;
|
||||
using Ayu.Discord.Voice;
|
||||
|
||||
namespace NadekoBot.Modules.Music.Services;
|
||||
@@ -211,4 +212,4 @@ public sealed class AyuVoiceStateService : INService
|
||||
|
||||
public bool TryGetProxy(ulong guildId, out IVoiceProxy proxy)
|
||||
=> _voiceProxies.TryGetValue(guildId, out proxy);
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
|
||||
namespace NadekoBot.Modules.Music.Services;
|
||||
@@ -33,4 +32,4 @@ public interface IMusicService : IPlaceholderProvider
|
||||
Task<bool> ToggleAutoDisconnectAsync(ulong guildId);
|
||||
Task<QualityPreset> GetMusicQualityAsync(ulong guildId);
|
||||
Task SetMusicQualityAsync(ulong guildId, QualityPreset preset);
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using NadekoBot.Db;
|
||||
|
||||
@@ -444,4 +443,4 @@ public sealed class MusicService : IMusicService
|
||||
}, preset);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
namespace NadekoBot.Modules.Music.Services;
|
||||
#nullable disable
|
||||
namespace NadekoBot.Modules.Music.Services;
|
||||
|
||||
public sealed partial class YtLoader
|
||||
{
|
||||
@@ -68,4 +69,4 @@ public sealed partial class YtLoader
|
||||
_videoId = videoId;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using System.Globalization;
|
||||
#nullable disable
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
@@ -126,4 +127,4 @@ public sealed partial class YtLoader
|
||||
endIndex - startIndex
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user