mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-01-31 00:19:00 +03:00
Fix inspection warnings (#208)
Signed-off-by: neroduckale <100025711+neroduckale@users.noreply.github.com>
This commit is contained in:
parent
4c50bdaff7
commit
bcd1db8c8e
6 changed files with 22 additions and 25 deletions
|
@ -75,7 +75,7 @@ public class RemindCommandGroup : CommandGroup
|
|||
return await ListRemindersAsync(data.GetOrCreateMemberData(executorId), executor, bot, CancellationToken);
|
||||
}
|
||||
|
||||
private async Task<Result> ListRemindersAsync(MemberData data, IUser executor, IUser bot, CancellationToken ct)
|
||||
private Task<Result> ListRemindersAsync(MemberData data, IUser executor, IUser bot, CancellationToken ct)
|
||||
{
|
||||
if (data.Reminders.Count == 0)
|
||||
{
|
||||
|
@ -83,7 +83,7 @@ public class RemindCommandGroup : CommandGroup
|
|||
.WithColour(ColorsList.Red)
|
||||
.Build();
|
||||
|
||||
return await _feedback.SendContextualEmbedResultAsync(failedEmbed, ct);
|
||||
return _feedback.SendContextualEmbedResultAsync(failedEmbed, ct);
|
||||
}
|
||||
|
||||
var builder = new StringBuilder();
|
||||
|
@ -101,7 +101,7 @@ public class RemindCommandGroup : CommandGroup
|
|||
.WithColour(ColorsList.Cyan)
|
||||
.Build();
|
||||
|
||||
return await _feedback.SendContextualEmbedResultAsync(
|
||||
return _feedback.SendContextualEmbedResultAsync(
|
||||
embed, ct);
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ public class RemindCommandGroup : CommandGroup
|
|||
return await AddReminderAsync(@in, text, data, channelId, executor, CancellationToken);
|
||||
}
|
||||
|
||||
private async Task<Result> AddReminderAsync(
|
||||
private Task<Result> AddReminderAsync(
|
||||
TimeSpan @in, string text, GuildData data,
|
||||
Snowflake channelId, IUser executor, CancellationToken ct = default)
|
||||
{
|
||||
|
@ -165,7 +165,7 @@ public class RemindCommandGroup : CommandGroup
|
|||
.WithFooter(string.Format(Messages.ReminderPosition, memberData.Reminders.Count))
|
||||
.Build();
|
||||
|
||||
return await _feedback.SendContextualEmbedResultAsync(embed, ct);
|
||||
return _feedback.SendContextualEmbedResultAsync(embed, ct);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -199,7 +199,7 @@ public class RemindCommandGroup : CommandGroup
|
|||
return await DeleteReminderAsync(data.GetOrCreateMemberData(executorId), position - 1, bot, CancellationToken);
|
||||
}
|
||||
|
||||
private async Task<Result> DeleteReminderAsync(MemberData data, int index, IUser bot,
|
||||
private Task<Result> DeleteReminderAsync(MemberData data, int index, IUser bot,
|
||||
CancellationToken ct)
|
||||
{
|
||||
if (index >= data.Reminders.Count)
|
||||
|
@ -208,7 +208,7 @@ public class RemindCommandGroup : CommandGroup
|
|||
.WithColour(ColorsList.Red)
|
||||
.Build();
|
||||
|
||||
return await _feedback.SendContextualEmbedResultAsync(failedEmbed, ct);
|
||||
return _feedback.SendContextualEmbedResultAsync(failedEmbed, ct);
|
||||
}
|
||||
|
||||
var reminder = data.Reminders[index];
|
||||
|
@ -224,7 +224,7 @@ public class RemindCommandGroup : CommandGroup
|
|||
.WithColour(ColorsList.Green)
|
||||
.Build();
|
||||
|
||||
return await _feedback.SendContextualEmbedResultAsync(
|
||||
return _feedback.SendContextualEmbedResultAsync(
|
||||
embed, ct);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ public class SettingsCommandGroup : CommandGroup
|
|||
return await SendSettingsListAsync(cfg, bot, page, CancellationToken);
|
||||
}
|
||||
|
||||
private async Task<Result> SendSettingsListAsync(JsonNode cfg, IUser bot, int page,
|
||||
private Task<Result> SendSettingsListAsync(JsonNode cfg, IUser bot, int page,
|
||||
CancellationToken ct = default)
|
||||
{
|
||||
var description = new StringBuilder();
|
||||
|
@ -124,7 +124,7 @@ public class SettingsCommandGroup : CommandGroup
|
|||
.WithColour(ColorsList.Red)
|
||||
.Build();
|
||||
|
||||
return await _feedback.SendContextualEmbedResultAsync(errorEmbed, ct);
|
||||
return _feedback.SendContextualEmbedResultAsync(errorEmbed, ct);
|
||||
}
|
||||
|
||||
footer.Append($"{Messages.Page} {page}/{totalPages} ");
|
||||
|
@ -149,7 +149,7 @@ public class SettingsCommandGroup : CommandGroup
|
|||
.WithFooter(footer.ToString())
|
||||
.Build();
|
||||
|
||||
return await _feedback.SendContextualEmbedResultAsync(embed, ct);
|
||||
return _feedback.SendContextualEmbedResultAsync(embed, ct);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -276,7 +276,7 @@ public class ToolsCommandGroup : CommandGroup
|
|||
return await ShowGuildInfoAsync(bot, guild, CancellationToken);
|
||||
}
|
||||
|
||||
private async Task<Result> ShowGuildInfoAsync(IUser bot, IGuild guild, CancellationToken ct)
|
||||
private Task<Result> ShowGuildInfoAsync(IUser bot, IGuild guild, CancellationToken ct)
|
||||
{
|
||||
var description = new StringBuilder().AppendLine($"## {guild.Name}");
|
||||
|
||||
|
@ -312,7 +312,7 @@ public class ToolsCommandGroup : CommandGroup
|
|||
.WithFooter($"ID: {guild.ID.ToString()}")
|
||||
.Build();
|
||||
|
||||
return await _feedback.SendContextualEmbedResultAsync(embed, ct);
|
||||
return _feedback.SendContextualEmbedResultAsync(embed, ct);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -349,7 +349,7 @@ public class ToolsCommandGroup : CommandGroup
|
|||
return await SendRandomNumberAsync(first, second, executor, CancellationToken);
|
||||
}
|
||||
|
||||
private async Task<Result> SendRandomNumberAsync(long first, long? secondNullable,
|
||||
private Task<Result> SendRandomNumberAsync(long first, long? secondNullable,
|
||||
IUser executor, CancellationToken ct)
|
||||
{
|
||||
const long secondDefault = 0;
|
||||
|
@ -389,7 +389,7 @@ public class ToolsCommandGroup : CommandGroup
|
|||
.WithColour(embedColor)
|
||||
.Build();
|
||||
|
||||
return await _feedback.SendContextualEmbedResultAsync(embed, ct);
|
||||
return _feedback.SendContextualEmbedResultAsync(embed, ct);
|
||||
}
|
||||
|
||||
private static readonly TimestampStyle[] AllStyles =
|
||||
|
@ -435,7 +435,7 @@ public class ToolsCommandGroup : CommandGroup
|
|||
return await SendTimestampAsync(offset, executor, CancellationToken);
|
||||
}
|
||||
|
||||
private async Task<Result> SendTimestampAsync(TimeSpan? offset, IUser executor, CancellationToken ct)
|
||||
private Task<Result> SendTimestampAsync(TimeSpan? offset, IUser executor, CancellationToken ct)
|
||||
{
|
||||
var timestamp = DateTimeOffset.UtcNow.Add(offset ?? TimeSpan.Zero).ToUnixTimeSeconds();
|
||||
|
||||
|
@ -459,6 +459,6 @@ public class ToolsCommandGroup : CommandGroup
|
|||
.WithColour(ColorsList.Blue)
|
||||
.Build();
|
||||
|
||||
return await _feedback.SendContextualEmbedResultAsync(embed, ct);
|
||||
return _feedback.SendContextualEmbedResultAsync(embed, ct);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,6 @@ public sealed class MemberData
|
|||
public ulong Id { get; }
|
||||
public DateTimeOffset? BannedUntil { get; set; }
|
||||
public DateTimeOffset? MutedUntil { get; set; }
|
||||
public List<ulong> Roles { get; set; } = new();
|
||||
public List<Reminder> Reminders { get; } = new();
|
||||
public List<ulong> Roles { get; set; } = [];
|
||||
public List<Reminder> Reminders { get; } = [];
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public sealed class GuildDataService : IHostedService
|
|||
SaveAsync(CancellationToken.None).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public async Task SaveAsync(CancellationToken ct)
|
||||
public Task SaveAsync(CancellationToken ct)
|
||||
{
|
||||
var tasks = new List<Task>();
|
||||
var datas = _datas.Values.ToArray();
|
||||
|
@ -53,7 +53,7 @@ public sealed class GuildDataService : IHostedService
|
|||
SerializeObjectSafelyAsync(memberData, $"{data.MemberDataPath}/{memberData.Id}.json", ct)));
|
||||
}
|
||||
|
||||
await Task.WhenAll(tasks);
|
||||
return Task.WhenAll(tasks);
|
||||
}
|
||||
|
||||
private static async Task SerializeObjectSafelyAsync<T>(T obj, string path, CancellationToken ct)
|
||||
|
|
|
@ -26,10 +26,7 @@ public sealed class SongUpdateService : BackgroundService
|
|||
("Squid Sisters", "Ink Me Up", new TimeSpan(0, 2, 13))
|
||||
};
|
||||
|
||||
private readonly List<Activity> _activityList = new(1)
|
||||
{
|
||||
new Activity("with Remora.Discord", ActivityType.Game)
|
||||
};
|
||||
private readonly List<Activity> _activityList = [new Activity("with Remora.Discord", ActivityType.Game)];
|
||||
|
||||
private readonly DiscordGatewayClient _client;
|
||||
private readonly GuildDataService _guildData;
|
||||
|
|
Loading…
Reference in a new issue