mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-04-20 00:43:36 +03:00
Fix rebase errors
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
parent
34186c22b5
commit
84469816d2
3 changed files with 28 additions and 17 deletions
|
@ -10,7 +10,6 @@ using Octobot.Services.Profiler;
|
||||||
using Octobot.Services.Update;
|
using Octobot.Services.Update;
|
||||||
using Remora.Commands.Attributes;
|
using Remora.Commands.Attributes;
|
||||||
using Remora.Commands.Groups;
|
using Remora.Commands.Groups;
|
||||||
using Remora.Commands.Parsers;
|
|
||||||
using Remora.Discord.API.Abstractions.Objects;
|
using Remora.Discord.API.Abstractions.Objects;
|
||||||
using Remora.Discord.API.Abstractions.Rest;
|
using Remora.Discord.API.Abstractions.Rest;
|
||||||
using Remora.Discord.Commands.Attributes;
|
using Remora.Discord.Commands.Attributes;
|
||||||
|
@ -123,22 +122,28 @@ public class BanCommandGroup : CommandGroup
|
||||||
|
|
||||||
if (stringDuration is null)
|
if (stringDuration is null)
|
||||||
{
|
{
|
||||||
return await BanUserAsync(executor, target, reason, null, guild, data, channelId, bot,
|
_profiler.Pop();
|
||||||
CancellationToken);
|
return _profiler.ReportWithResult(await BanUserAsync(executor, target, reason, null, guild, data, channelId,
|
||||||
|
bot,
|
||||||
|
CancellationToken));
|
||||||
}
|
}
|
||||||
|
|
||||||
var parseResult = TimeSpanParser.TryParse(stringDuration);
|
var parseResult = TimeSpanParser.TryParse(stringDuration);
|
||||||
if (!parseResult.IsDefined(out var duration))
|
if (!parseResult.IsDefined(out var duration))
|
||||||
{
|
{
|
||||||
|
_profiler.Push("invalid_timespan_send");
|
||||||
var failedEmbed = new EmbedBuilder()
|
var failedEmbed = new EmbedBuilder()
|
||||||
.WithSmallTitle(Messages.InvalidTimeSpan, bot)
|
.WithSmallTitle(Messages.InvalidTimeSpan, bot)
|
||||||
.WithColour(ColorsList.Red)
|
.WithColour(ColorsList.Red)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
return await _feedback.SendContextualEmbedResultAsync(failedEmbed, ct: CancellationToken);
|
return _profiler.ReportWithResult(
|
||||||
|
await _feedback.SendContextualEmbedResultAsync(failedEmbed, ct: CancellationToken));
|
||||||
}
|
}
|
||||||
|
|
||||||
return await BanUserAsync(executor, target, reason, duration, guild, data, channelId, bot, CancellationToken);
|
_profiler.Pop();
|
||||||
|
return _profiler.ReportWithResult(await BanUserAsync(executor, target, reason, duration, guild, data, channelId,
|
||||||
|
bot, CancellationToken));
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<Result> BanUserAsync(
|
private async Task<Result> BanUserAsync(
|
||||||
|
|
|
@ -122,18 +122,23 @@ public class MuteCommandGroup : CommandGroup
|
||||||
await _feedback.SendContextualEmbedResultAsync(embed, ct: CancellationToken));
|
await _feedback.SendContextualEmbedResultAsync(embed, ct: CancellationToken));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_profiler.Pop();
|
||||||
var parseResult = TimeSpanParser.TryParse(stringDuration);
|
var parseResult = TimeSpanParser.TryParse(stringDuration);
|
||||||
if (!parseResult.IsDefined(out var duration))
|
if (!parseResult.IsDefined(out var duration))
|
||||||
{
|
{
|
||||||
|
_profiler.Push("invalid_timespan_send");
|
||||||
var failedEmbed = new EmbedBuilder()
|
var failedEmbed = new EmbedBuilder()
|
||||||
.WithSmallTitle(Messages.InvalidTimeSpan, bot)
|
.WithSmallTitle(Messages.InvalidTimeSpan, bot)
|
||||||
.WithColour(ColorsList.Red)
|
.WithColour(ColorsList.Red)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
return await _feedback.SendContextualEmbedResultAsync(failedEmbed, ct: CancellationToken);
|
return _profiler.ReportWithResult(
|
||||||
|
await _feedback.SendContextualEmbedResultAsync(failedEmbed, ct: CancellationToken));
|
||||||
}
|
}
|
||||||
|
|
||||||
return await MuteUserAsync(executor, target, reason, duration, guildId, data, channelId, bot, CancellationToken);
|
_profiler.Pop();
|
||||||
|
return _profiler.ReportWithResult(await MuteUserAsync(executor, target, reason, duration, guildId, data,
|
||||||
|
channelId, bot, CancellationToken));
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<Result> MuteUserAsync(
|
private async Task<Result> MuteUserAsync(
|
||||||
|
|
|
@ -4,6 +4,7 @@ using System.Text;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Octobot.Data;
|
using Octobot.Data;
|
||||||
using Octobot.Extensions;
|
using Octobot.Extensions;
|
||||||
|
using Octobot.Parsers;
|
||||||
using Octobot.Services;
|
using Octobot.Services;
|
||||||
using Octobot.Services.Profiler;
|
using Octobot.Services.Profiler;
|
||||||
using Remora.Commands.Attributes;
|
using Remora.Commands.Attributes;
|
||||||
|
@ -18,7 +19,6 @@ using Remora.Discord.Extensions.Embeds;
|
||||||
using Remora.Discord.Extensions.Formatting;
|
using Remora.Discord.Extensions.Formatting;
|
||||||
using Remora.Rest.Core;
|
using Remora.Rest.Core;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
using Octobot.Parsers;
|
|
||||||
|
|
||||||
namespace Octobot.Commands;
|
namespace Octobot.Commands;
|
||||||
|
|
||||||
|
@ -143,8 +143,7 @@ public class RemindCommandGroup : CommandGroup
|
||||||
[RequireContext(ChannelContext.Guild)]
|
[RequireContext(ChannelContext.Guild)]
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public async Task<Result> ExecuteReminderAsync(
|
public async Task<Result> ExecuteReminderAsync(
|
||||||
[Description("After what period of time mention the reminder")]
|
[Description("After what period of time mention the reminder")] [Option("in")]
|
||||||
[Option("in")]
|
|
||||||
string timeSpanString,
|
string timeSpanString,
|
||||||
[Description("Reminder text")] [MaxLength(512)]
|
[Description("Reminder text")] [MaxLength(512)]
|
||||||
string text)
|
string text)
|
||||||
|
@ -157,12 +156,14 @@ public class RemindCommandGroup : CommandGroup
|
||||||
"Unable to retrieve necessary IDs from command context"));
|
"Unable to retrieve necessary IDs from command context"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_profiler.Push("current_get");
|
||||||
var botResult = await _userApi.GetCurrentUserAsync(CancellationToken);
|
var botResult = await _userApi.GetCurrentUserAsync(CancellationToken);
|
||||||
if (!botResult.IsDefined(out var bot))
|
if (!botResult.IsDefined(out var bot))
|
||||||
{
|
{
|
||||||
return Result.FromError(botResult);
|
return Result.FromError(botResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_profiler.Pop();
|
||||||
_profiler.Push("executor_get");
|
_profiler.Push("executor_get");
|
||||||
var executorResult = await _userApi.GetUserAsync(executorId, CancellationToken);
|
var executorResult = await _userApi.GetUserAsync(executorId, CancellationToken);
|
||||||
if (!executorResult.IsDefined(out var executor))
|
if (!executorResult.IsDefined(out var executor))
|
||||||
|
@ -179,19 +180,19 @@ public class RemindCommandGroup : CommandGroup
|
||||||
var parseResult = TimeSpanParser.TryParse(timeSpanString);
|
var parseResult = TimeSpanParser.TryParse(timeSpanString);
|
||||||
if (!parseResult.IsDefined(out var timeSpan))
|
if (!parseResult.IsDefined(out var timeSpan))
|
||||||
{
|
{
|
||||||
|
_profiler.Push("invalid_timespan_send");
|
||||||
var failedEmbed = new EmbedBuilder()
|
var failedEmbed = new EmbedBuilder()
|
||||||
.WithSmallTitle(Messages.InvalidTimeSpan, bot)
|
.WithSmallTitle(Messages.InvalidTimeSpan, bot)
|
||||||
.WithColour(ColorsList.Red)
|
.WithColour(ColorsList.Red)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
return await _feedback.SendContextualEmbedResultAsync(failedEmbed, ct: CancellationToken);
|
return _profiler.ReportWithResult(
|
||||||
}
|
await _feedback.SendContextualEmbedResultAsync(failedEmbed, ct: CancellationToken));
|
||||||
_profiler.Pop();
|
|
||||||
return _profiler.ReportWithResult(await AddReminderAsync(@in, text, data, channelId, executor,
|
|
||||||
CancellationToken));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return await AddReminderAsync(timeSpan, text, data, channelId, executor, CancellationToken);
|
_profiler.Pop();
|
||||||
|
return _profiler.ReportWithResult(await AddReminderAsync(timeSpan, text, data, channelId, executor,
|
||||||
|
CancellationToken));
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<Result> AddReminderAsync(TimeSpan timeSpan, string text, GuildData data,
|
private async Task<Result> AddReminderAsync(TimeSpan timeSpan, string text, GuildData data,
|
||||||
|
@ -199,7 +200,7 @@ public class RemindCommandGroup : CommandGroup
|
||||||
{
|
{
|
||||||
_profiler.Push("main");
|
_profiler.Push("main");
|
||||||
var memberData = data.GetOrCreateMemberData(executor.ID);
|
var memberData = data.GetOrCreateMemberData(executor.ID);
|
||||||
var remindAt = DateTimeOffset.UtcNow.Add(@in);
|
var remindAt = DateTimeOffset.UtcNow.Add(timeSpan);
|
||||||
|
|
||||||
_profiler.Push("original_response_get");
|
_profiler.Push("original_response_get");
|
||||||
var responseResult =
|
var responseResult =
|
||||||
|
|
Loading…
Add table
Reference in a new issue