mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-05-13 17:26:08 +03:00
Resolve conversations
Signed-off-by: Macintosh II <mctaylxrs@outlook.com>
This commit is contained in:
parent
07a123349c
commit
5794b67e4c
1 changed files with 6 additions and 6 deletions
|
@ -169,7 +169,7 @@ public class RemindCommandGroup : CommandGroup
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A slash command that deletes a reminder using its list position.
|
/// A slash command that deletes a reminder using its list position.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="position">The position in list of the reminder to delete.</param>
|
/// <param name="position">The list position of the reminder to delete.</param>
|
||||||
/// <returns>A feedback sending result which may or may not have succeeded.</returns>
|
/// <returns>A feedback sending result which may or may not have succeeded.</returns>
|
||||||
[Command("delremind")]
|
[Command("delremind")]
|
||||||
[Description("Delete one of your reminders")]
|
[Description("Delete one of your reminders")]
|
||||||
|
@ -177,7 +177,7 @@ public class RemindCommandGroup : CommandGroup
|
||||||
[RequireContext(ChannelContext.Guild)]
|
[RequireContext(ChannelContext.Guild)]
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public async Task<Result> ExecuteDeleteReminderAsync(
|
public async Task<Result> ExecuteDeleteReminderAsync(
|
||||||
[Description("Position in list of reminder to delete")] [MinValue(1)]
|
[Description("Position in list")] [MinValue(1)]
|
||||||
int position)
|
int position)
|
||||||
{
|
{
|
||||||
if (!_context.TryGetContextIDs(out var guildId, out _, out var executorId))
|
if (!_context.TryGetContextIDs(out var guildId, out _, out var executorId))
|
||||||
|
@ -194,13 +194,13 @@ public class RemindCommandGroup : CommandGroup
|
||||||
var data = await _guildData.GetData(guildId, CancellationToken);
|
var data = await _guildData.GetData(guildId, CancellationToken);
|
||||||
Messages.Culture = GuildSettings.Language.Get(data.Settings);
|
Messages.Culture = GuildSettings.Language.Get(data.Settings);
|
||||||
|
|
||||||
return await DeleteReminderAsync(data.GetOrCreateMemberData(executorId), position, bot, CancellationToken);
|
return await DeleteReminderAsync(data.GetOrCreateMemberData(executorId), position - 1, bot, CancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<Result> DeleteReminderAsync(MemberData data, int position, IUser bot,
|
private async Task<Result> DeleteReminderAsync(MemberData data, int index, IUser bot,
|
||||||
CancellationToken ct)
|
CancellationToken ct)
|
||||||
{
|
{
|
||||||
if (position > data.Reminders.Count)
|
if (index >= data.Reminders.Count)
|
||||||
{
|
{
|
||||||
var failedEmbed = new EmbedBuilder().WithSmallTitle(Messages.InvalidReminderPosition, bot)
|
var failedEmbed = new EmbedBuilder().WithSmallTitle(Messages.InvalidReminderPosition, bot)
|
||||||
.WithColour(ColorsList.Red)
|
.WithColour(ColorsList.Red)
|
||||||
|
@ -209,7 +209,7 @@ public class RemindCommandGroup : CommandGroup
|
||||||
return await _feedback.SendContextualEmbedResultAsync(failedEmbed, ct);
|
return await _feedback.SendContextualEmbedResultAsync(failedEmbed, ct);
|
||||||
}
|
}
|
||||||
|
|
||||||
data.Reminders.RemoveAt(position - 1);
|
data.Reminders.RemoveAt(index);
|
||||||
|
|
||||||
var embed = new EmbedBuilder().WithSmallTitle(Messages.ReminderDeleted, bot)
|
var embed = new EmbedBuilder().WithSmallTitle(Messages.ReminderDeleted, bot)
|
||||||
.WithColour(ColorsList.Green)
|
.WithColour(ColorsList.Green)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue