mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-12 02:08:27 -04:00
Removed redundant parenthesis
This commit is contained in:
@@ -13,6 +13,6 @@ public sealed class OwnerOnlyAttribute : PreconditionAttribute
|
||||
{
|
||||
var creds = services.GetRequiredService<IBotCredsProvider>().GetCreds();
|
||||
|
||||
return Task.FromResult((creds.IsOwner(context.User) || context.Client.CurrentUser.Id == context.User.Id ? PreconditionResult.FromSuccess() : PreconditionResult.FromError("Not owner")));
|
||||
return Task.FromResult(creds.IsOwner(context.User) || context.Client.CurrentUser.Id == context.User.Id ? PreconditionResult.FromSuccess() : PreconditionResult.FromError("Not owner"));
|
||||
}
|
||||
}
|
@@ -345,7 +345,7 @@ public sealed class ConcurrentHashSet<T> : IReadOnlyCollection<T>, ICollection<T
|
||||
Node previous = null;
|
||||
for (var current = tables.Buckets[bucketNo]; current != null; current = current.Next)
|
||||
{
|
||||
Debug.Assert((previous is null && current == tables.Buckets[bucketNo]) || previous.Next == current);
|
||||
Debug.Assert(previous is null && current == tables.Buckets[bucketNo] || previous.Next == current);
|
||||
|
||||
if (hashcode == current.Hashcode && _comparer.Equals(current.Item, item))
|
||||
{
|
||||
@@ -471,7 +471,7 @@ public sealed class ConcurrentHashSet<T> : IReadOnlyCollection<T>, ICollection<T
|
||||
Node previous = null;
|
||||
for (var current = tables.Buckets[bucketNo]; current != null; current = current.Next)
|
||||
{
|
||||
Debug.Assert((previous is null && current == tables.Buckets[bucketNo]) || previous.Next == current);
|
||||
Debug.Assert(previous is null && current == tables.Buckets[bucketNo] || previous.Next == current);
|
||||
if (hashcode == current.Hashcode && _comparer.Equals(current.Item, item))
|
||||
{
|
||||
return false;
|
||||
|
@@ -27,7 +27,7 @@ public class DownloadTracker : INService
|
||||
var added = LastDownloads.AddOrUpdate(
|
||||
guild.Id,
|
||||
now,
|
||||
(key, old) => (now - old) > TimeSpan.FromHours(1) ? now : old);
|
||||
(key, old) => now - old > TimeSpan.FromHours(1) ? now : old);
|
||||
|
||||
// means that this entry was just added - download the users
|
||||
if (added == now)
|
||||
|
@@ -99,7 +99,7 @@ public abstract class NadekoModule : ModuleBase
|
||||
{
|
||||
dsc.MessageReceived += MessageReceived;
|
||||
|
||||
if ((await Task.WhenAny(userInputTask.Task, Task.Delay(10000)).ConfigureAwait(false)) != userInputTask.Task)
|
||||
if (await Task.WhenAny(userInputTask.Task, Task.Delay(10000)).ConfigureAwait(false) != userInputTask.Task)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@@ -36,7 +36,7 @@ public class NadekoRandom : Random
|
||||
var bytes = new byte[sizeof(int)];
|
||||
_rng.GetBytes(bytes);
|
||||
var sign = Math.Sign(BitConverter.ToInt32(bytes, 0));
|
||||
return (sign * BitConverter.ToInt32(bytes, 0)) % (maxValue - minValue) + minValue;
|
||||
return sign * BitConverter.ToInt32(bytes, 0) % (maxValue - minValue) + minValue;
|
||||
}
|
||||
|
||||
public long NextLong(long minValue, long maxValue)
|
||||
@@ -48,7 +48,7 @@ public class NadekoRandom : Random
|
||||
var bytes = new byte[sizeof(long)];
|
||||
_rng.GetBytes(bytes);
|
||||
var sign = Math.Sign(BitConverter.ToInt64(bytes, 0));
|
||||
return (sign * BitConverter.ToInt64(bytes, 0)) % (maxValue - minValue) + minValue;
|
||||
return sign * BitConverter.ToInt64(bytes, 0) % (maxValue - minValue) + minValue;
|
||||
}
|
||||
|
||||
public override void NextBytes(byte[] buffer)
|
||||
|
@@ -10,7 +10,7 @@ public static class PlatformHelper
|
||||
public static int ProcessorCount {
|
||||
get {
|
||||
var now = Environment.TickCount;
|
||||
if (_processorCount == 0 || (now - _lastProcessorCountRefreshTicks) >= ProcessorCountRefreshIntervalMs)
|
||||
if (_processorCount == 0 || now - _lastProcessorCountRefreshTicks >= ProcessorCountRefreshIntervalMs)
|
||||
{
|
||||
_processorCount = Environment.ProcessorCount;
|
||||
_lastProcessorCountRefreshTicks = now;
|
||||
|
@@ -24,7 +24,7 @@ public sealed record SmartEmbedText : SmartText
|
||||
!string.IsNullOrWhiteSpace(Url) ||
|
||||
!string.IsNullOrWhiteSpace(Thumbnail) ||
|
||||
!string.IsNullOrWhiteSpace(Image) ||
|
||||
(Footer != null && (!string.IsNullOrWhiteSpace(Footer.Text) || !string.IsNullOrWhiteSpace(Footer.IconUrl))) ||
|
||||
Footer != null && (!string.IsNullOrWhiteSpace(Footer.Text) || !string.IsNullOrWhiteSpace(Footer.IconUrl)) ||
|
||||
Fields is { Length: > 0 };
|
||||
|
||||
public static SmartEmbedText FromEmbed(IEmbed eb, string plainText = null)
|
||||
|
@@ -37,7 +37,7 @@ public sealed class ShmartNumberTypeReader : NadekoTypeReader<ShmartNumber>
|
||||
{
|
||||
var expr = new NCalc.Expression(i, NCalc.EvaluateOptions.IgnoreCase);
|
||||
expr.EvaluateParameter += (str, ev) => EvaluateParam(str, ev, context);
|
||||
var lon = (long)(decimal.Parse(expr.Evaluate().ToString()));
|
||||
var lon = (long)decimal.Parse(expr.Evaluate().ToString());
|
||||
return TypeReaderResult.FromSuccess(new ShmartNumber(lon, input));
|
||||
}
|
||||
catch (Exception)
|
||||
|
Reference in New Issue
Block a user