mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-04-19 16:33:36 +03:00
Merge remote-tracking branch 'origin/master' into 200-add-link-to-original-message-in-listremind
# Conflicts: # src/Commands/RemindCommandGroup.cs
This commit is contained in:
commit
53f2a63e71
6 changed files with 20 additions and 23 deletions
|
@ -75,7 +75,7 @@ public class RemindCommandGroup : CommandGroup
|
|||
return await ListRemindersAsync(data.GetOrCreateMemberData(executorId), guildId, executor, bot, CancellationToken);
|
||||
}
|
||||
|
||||
private async Task<Result> ListRemindersAsync(MemberData data, Snowflake guildId, IUser executor, IUser bot, CancellationToken ct)
|
||||
private Task<Result> ListRemindersAsync(MemberData data, Snowflake guildId, 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();
|
||||
|
@ -102,7 +102,7 @@ public class RemindCommandGroup : CommandGroup
|
|||
.WithColour(ColorsList.Cyan)
|
||||
.Build();
|
||||
|
||||
return await _feedback.SendContextualEmbedResultAsync(
|
||||
return _feedback.SendContextualEmbedResultAsync(
|
||||
embed, ct);
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,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)
|
||||
|
@ -214,7 +214,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];
|
||||
|
@ -230,7 +230,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…
Add table
Reference in a new issue