mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 09:48:26 -04:00
Changed all == null to is null and all !(* == null) to * is not null
This commit is contained in:
@@ -64,7 +64,7 @@ namespace NadekoBot.Modules.Music.Resolvers
|
||||
yield break;
|
||||
|
||||
var firstData = await ResolveByQueryAsync(firstFile);
|
||||
if (!(firstData is null))
|
||||
if (firstData is not null)
|
||||
yield return firstData;
|
||||
|
||||
var fileChunks = files.Skip(1).Chunk(10);
|
||||
|
@@ -81,7 +81,7 @@ namespace NadekoBot.Modules.Music.Resolvers
|
||||
public async Task<ITrackInfo?> ResolveByQueryAsync(string query)
|
||||
{
|
||||
var cached = await _trackCacher.GetCachedDataByQueryAsync(query, MusicPlatform.SoundCloud);
|
||||
if (!(cached is null))
|
||||
if (cached is not null)
|
||||
return CachableDataToTrackInfo(cached);
|
||||
|
||||
var svideo = !IsSoundCloudLink(query)
|
||||
|
@@ -199,7 +199,7 @@
|
||||
// //Log.Information("Buffered. Getting audio client...");
|
||||
// var ac = await GetAudioClient().ConfigureAwait(false);
|
||||
// Log.Information("Got Audio client");
|
||||
// if (ac == null)
|
||||
// if (ac is null)
|
||||
// {
|
||||
// Log.Information("Can't join");
|
||||
// await Task.Delay(900, cancelToken).ConfigureAwait(false);
|
||||
@@ -371,7 +371,7 @@
|
||||
//
|
||||
// private async Task<IAudioClient> GetAudioClient(bool reconnect = false)
|
||||
// {
|
||||
// if (_audioClient == null ||
|
||||
// if (_audioClient is null ||
|
||||
// _audioClient.ConnectionState != ConnectionState.Connected ||
|
||||
// reconnect ||
|
||||
// newVoiceChannel)
|
||||
@@ -529,7 +529,7 @@
|
||||
// {
|
||||
// lock (locker)
|
||||
// {
|
||||
// if (PauseTaskSource == null)
|
||||
// if (PauseTaskSource is null)
|
||||
// PauseTaskSource = new TaskCompletionSource<bool>();
|
||||
// else
|
||||
// {
|
||||
|
@@ -86,7 +86,7 @@
|
||||
// if (MaxQueueSize != 0 && Songs.Count >= MaxQueueSize)
|
||||
// throw new QueueFullException();
|
||||
// var curSong = Current.Song;
|
||||
// if (curSong == null)
|
||||
// if (curSong is null)
|
||||
// {
|
||||
// Songs.AddLast(song);
|
||||
// return Songs.Count;
|
||||
|
@@ -285,7 +285,7 @@ namespace NadekoBot.Modules.Music
|
||||
{
|
||||
string desc = string.Empty;
|
||||
var current = mp.GetCurrentTrack(out var currentIndex);
|
||||
if (!(current is null))
|
||||
if (current is not null)
|
||||
{
|
||||
desc = $"`🔊` {current.PrettyFullName()}\n\n" + desc;
|
||||
}
|
||||
@@ -371,7 +371,7 @@ namespace NadekoBot.Modules.Music
|
||||
try
|
||||
{
|
||||
var input = await GetUserInputAsync(ctx.User.Id, ctx.Channel.Id).ConfigureAwait(false);
|
||||
if (input == null
|
||||
if (input is null
|
||||
|| !int.TryParse(input, out var index)
|
||||
|| (index -= 1) < 0
|
||||
|| index >= videos.Count)
|
||||
@@ -699,7 +699,7 @@ namespace NadekoBot.Modules.Music
|
||||
}
|
||||
|
||||
var currentTrack = mp.GetCurrentTrack(out _);
|
||||
if (currentTrack == null)
|
||||
if (currentTrack is null)
|
||||
return;
|
||||
|
||||
var embed = new EmbedBuilder().WithOkColor()
|
||||
|
@@ -213,7 +213,7 @@ namespace NadekoBot.Modules.Music
|
||||
mpl = uow.MusicPlaylists.GetWithSongs(id);
|
||||
}
|
||||
|
||||
if (mpl == null)
|
||||
if (mpl is null)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync("playlist_id_not_found").ConfigureAwait(false);
|
||||
return;
|
||||
|
@@ -313,7 +313,7 @@ namespace NadekoBot.Modules.Music.Services
|
||||
{
|
||||
var randomPlayingTrack = _players
|
||||
.Select(x => x.Value.GetCurrentTrack(out _))
|
||||
.Where(x => !(x is null))
|
||||
.Where(x => x is not null)
|
||||
.Shuffle()
|
||||
.FirstOrDefault();
|
||||
|
||||
@@ -328,7 +328,7 @@ namespace NadekoBot.Modules.Music.Services
|
||||
{
|
||||
var count = _players
|
||||
.Select(x => x.Value.GetCurrentTrack(out _))
|
||||
.Count(x => !(x is null));
|
||||
.Count(x => x is not null);
|
||||
|
||||
return count.ToString();
|
||||
});
|
||||
|
@@ -100,7 +100,7 @@
|
||||
// string GetText(string text, params object[] replacements) =>
|
||||
// _strings.GetText(text, textCh.Guild.Id, replacements);
|
||||
//
|
||||
// if (voiceCh == null || voiceCh.Guild != textCh.Guild)
|
||||
// if (voiceCh is null || voiceCh.Guild != textCh.Guild)
|
||||
// {
|
||||
// if (textCh != null)
|
||||
// {
|
||||
@@ -139,7 +139,7 @@
|
||||
// }
|
||||
//
|
||||
// var (Index, Current) = mp.Current;
|
||||
// if (Current == null
|
||||
// if (Current is null
|
||||
// && !mp.RepeatCurrentSong
|
||||
// && !mp.RepeatPlaylist
|
||||
// && !mp.FairPlay
|
||||
@@ -161,7 +161,7 @@
|
||||
// // // ignored
|
||||
// //}
|
||||
// var sender = player;
|
||||
// if (sender == null)
|
||||
// if (sender is null)
|
||||
// return;
|
||||
// try
|
||||
// {
|
||||
@@ -215,7 +215,7 @@
|
||||
// return;
|
||||
//
|
||||
// var si = await ResolveSong(related[new NadekoRandom().Next(related.Length)], _client.CurrentUser.ToString(), MusicType.YouTube).ConfigureAwait(false);
|
||||
// if (si == null)
|
||||
// if (si is null)
|
||||
// throw new SongNotFoundException();
|
||||
// var mp = await GetOrCreatePlayer(txtCh.GuildId, vch, txtCh).ConfigureAwait(false);
|
||||
// mp.Enqueue(si);
|
||||
@@ -229,7 +229,7 @@
|
||||
// var strategy = await resolverFactory.GetResolveStrategy(query, musicType).ConfigureAwait(false);
|
||||
// var sinfo = await strategy.ResolveSong(query).ConfigureAwait(false);
|
||||
//
|
||||
// if (sinfo == null)
|
||||
// if (sinfo is null)
|
||||
// return null;
|
||||
//
|
||||
// sinfo.QueuerName = queuerName;
|
||||
|
@@ -51,13 +51,13 @@
|
||||
// // var t = Task.Run(() =>
|
||||
// // {
|
||||
// // var usr = iusr as SocketGuildUser;
|
||||
// // if (usr == null ||
|
||||
// // if (usr is null ||
|
||||
// // oldState.VoiceChannel == newState.VoiceChannel)
|
||||
// // return;
|
||||
//
|
||||
// // var player = _music.GetPlayerOrDefault(usr.Guild.Id);
|
||||
//
|
||||
// // if (player == null)
|
||||
// // if (player is null)
|
||||
// // return;
|
||||
//
|
||||
// // try
|
||||
@@ -97,7 +97,7 @@
|
||||
//
|
||||
// private async Task InternalQueue(MusicPlayer mp, SongInfo songInfo, bool silent, bool queueFirst = false, bool forcePlay = false)
|
||||
// {
|
||||
// if (songInfo == null)
|
||||
// if (songInfo is null)
|
||||
// {
|
||||
// if (!silent)
|
||||
// await ReplyErrorLocalizedAsync("song_not_found").ConfigureAwait(false);
|
||||
@@ -216,7 +216,7 @@
|
||||
// try
|
||||
// {
|
||||
// var input = await GetUserInputAsync(ctx.User.Id, ctx.Channel.Id).ConfigureAwait(false);
|
||||
// if (input == null
|
||||
// if (input is null
|
||||
// || !int.TryParse(input, out var index)
|
||||
// || (index -= 1) < 0
|
||||
// || index >= videos.Length)
|
||||
@@ -436,7 +436,7 @@
|
||||
// public async Task SongRemove(All _)
|
||||
// {
|
||||
// var mp = _service.GetPlayerOrDefault(ctx.Guild.Id);
|
||||
// if (mp == null)
|
||||
// if (mp is null)
|
||||
// return;
|
||||
// mp.Stop(true);
|
||||
// await ReplyConfirmLocalizedAsync("queue_cleared").ConfigureAwait(false);
|
||||
@@ -576,7 +576,7 @@
|
||||
// mpl = uow.MusicPlaylists.GetWithSongs(id);
|
||||
// }
|
||||
//
|
||||
// if (mpl == null)
|
||||
// if (mpl is null)
|
||||
// {
|
||||
// await ReplyErrorLocalizedAsync("playlist_id_not_found").ConfigureAwait(false);
|
||||
// return;
|
||||
@@ -700,7 +700,7 @@
|
||||
// {
|
||||
// var mp = await _service.GetOrCreatePlayer(Context).ConfigureAwait(false);
|
||||
// var (_, currentSong) = mp.Current;
|
||||
// if (currentSong == null)
|
||||
// if (currentSong is null)
|
||||
// return;
|
||||
// try { await mp.UpdateSongDurationsAsync().ConfigureAwait(false); } catch { }
|
||||
//
|
||||
@@ -744,7 +744,7 @@
|
||||
// Log.Warning(ex.Message);
|
||||
// }
|
||||
//
|
||||
// if (plId == null)
|
||||
// if (plId is null)
|
||||
// {
|
||||
// await ReplyErrorLocalizedAsync("no_search_results").ConfigureAwait(false);
|
||||
// return;
|
||||
@@ -834,12 +834,12 @@
|
||||
// {
|
||||
// var vch = ((IGuildUser)ctx.User).VoiceChannel;
|
||||
//
|
||||
// if (vch == null)
|
||||
// if (vch is null)
|
||||
// return;
|
||||
//
|
||||
// var mp = _service.GetPlayerOrDefault(ctx.Guild.Id);
|
||||
//
|
||||
// if (mp == null)
|
||||
// if (mp is null)
|
||||
// return;
|
||||
//
|
||||
// await mp.SetVoiceChannel(vch).ConfigureAwait(false);
|
||||
@@ -853,7 +853,7 @@
|
||||
// return;
|
||||
//
|
||||
// MusicPlayer mp = _service.GetPlayerOrDefault(ctx.Guild.Id);
|
||||
// if (mp == null)
|
||||
// if (mp is null)
|
||||
// return;
|
||||
//
|
||||
// fromto = fromto?.Trim();
|
||||
@@ -862,7 +862,7 @@
|
||||
// SongInfo s;
|
||||
// if (fromtoArr.Length != 2 || !int.TryParse(fromtoArr[0], out var n1) ||
|
||||
// !int.TryParse(fromtoArr[1], out var n2) || n1 < 1 || n2 < 1 || n1 == n2
|
||||
// || (s = mp.MoveSong(--n1, --n2)) == null)
|
||||
// || (s = mp.MoveSong(--n1, --n2)) is null)
|
||||
// {
|
||||
// await ReplyConfirmLocalizedAsync("invalid_input").ConfigureAwait(false);
|
||||
// return;
|
||||
@@ -916,7 +916,7 @@
|
||||
// {
|
||||
// var mp = await _service.GetOrCreatePlayer(Context).ConfigureAwait(false);
|
||||
// var (_, currentSong) = mp.Current;
|
||||
// if (currentSong == null)
|
||||
// if (currentSong is null)
|
||||
// return;
|
||||
// var currentValue = mp.ToggleRepeatSong();
|
||||
//
|
||||
|
Reference in New Issue
Block a user