mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-05-10 16:03:15 +03:00
Fixing bugs and other problems
This commit is contained in:
parent
905cf5619c
commit
f1bd54d6f6
16 changed files with 255 additions and 144 deletions
|
@ -35,6 +35,8 @@ public sealed class BanCommand : ICommand {
|
|||
= duration.TotalSeconds < 1 ? DateTimeOffset.MaxValue : DateTimeOffset.Now.Add(duration);
|
||||
memberData.Roles.Clear();
|
||||
|
||||
cmd.ConfigWriteScheduled = true;
|
||||
|
||||
var feedback = string.Format(Messages.FeedbackUserBanned, $"<@{toBan.Item1.ToString()}>",
|
||||
Utils.GetHumanizedTimeOffset(duration), Utils.Wrap(reason));
|
||||
cmd.Reply(feedback, ReplyEmojis.Banned);
|
||||
|
|
|
@ -19,7 +19,7 @@ public sealed class ClearCommand : ICommand {
|
|||
var user = (SocketGuildUser)cmd.Context.User;
|
||||
await channel.DeleteMessagesAsync(messages, Utils.GetRequestOptions(user.ToString()!));
|
||||
|
||||
cmd.Audit(string.Format(Messages.FeedbackMessagesCleared, (toDelete + 1).ToString()));
|
||||
cmd.Audit(string.Format(Messages.FeedbackMessagesCleared, (toDelete + 1).ToString(),
|
||||
Utils.MentionChannel(channel.Id)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ public sealed class KickCommand : ICommand {
|
|||
public string[] Aliases { get; } = { "kick", "кик", "выгнать" };
|
||||
|
||||
public async Task RunAsync(CommandProcessor cmd, string[] args, string[] cleanArgs) {
|
||||
var toKick = cmd.GetMember(args, cleanArgs, 0, "ToKick");
|
||||
var toKick = cmd.GetMember(args, 0, "ToKick");
|
||||
if (toKick is null || !cmd.HasPermission(GuildPermission.KickMembers)) return;
|
||||
|
||||
if (cmd.CanInteractWith(toKick, "Kick"))
|
||||
|
@ -24,6 +24,7 @@ public sealed class KickCommand : ICommand {
|
|||
Utils.Wrap(reason)));
|
||||
|
||||
GuildData.Get(cmd.Context.Guild).MemberData[toKick.Id].Roles.Clear();
|
||||
cmd.ConfigWriteScheduled = true;
|
||||
|
||||
await toKick.KickAsync(guildKickMessage);
|
||||
var format = string.Format(Messages.FeedbackMemberKicked, toKick.Mention, Utils.Wrap(reason));
|
||||
|
|
|
@ -8,7 +8,7 @@ public sealed class MuteCommand : ICommand {
|
|||
public string[] Aliases { get; } = { "mute", "timeout", "заглушить", "мут" };
|
||||
|
||||
public async Task RunAsync(CommandProcessor cmd, string[] args, string[] cleanArgs) {
|
||||
var toMute = cmd.GetMember(args, cleanArgs, 0, "ToMute");
|
||||
var toMute = cmd.GetMember(args, 0, "ToMute");
|
||||
if (toMute is null) return;
|
||||
|
||||
var duration = CommandProcessor.GetTimeSpan(args, 1);
|
||||
|
@ -40,8 +40,6 @@ public sealed class MuteCommand : ICommand {
|
|||
await toMute.RemoveRolesAsync(toMute.Roles, requestOptions);
|
||||
|
||||
await toMute.AddRoleAsync(role, requestOptions);
|
||||
|
||||
data.MemberData[toMute.Id].MutedUntil = DateTimeOffset.Now.Add(duration);
|
||||
} else {
|
||||
if (!hasDuration || duration.TotalDays > 28) {
|
||||
cmd.Reply(Messages.DurationRequiredForTimeOuts, ReplyEmojis.Error);
|
||||
|
@ -56,6 +54,9 @@ public sealed class MuteCommand : ICommand {
|
|||
await toMute.SetTimeOutAsync(duration, requestOptions);
|
||||
}
|
||||
|
||||
data.MemberData[toMute.Id].MutedUntil = DateTimeOffset.Now.Add(duration);
|
||||
cmd.ConfigWriteScheduled = true;
|
||||
|
||||
var feedback = string.Format(Messages.FeedbackMemberMuted, toMute.Mention,
|
||||
Utils.GetHumanizedTimeOffset(duration),
|
||||
Utils.Wrap(reason));
|
||||
|
|
|
@ -6,6 +6,7 @@ public sealed class RemindCommand : ICommand {
|
|||
public string[] Aliases { get; } = { "remind", "reminder", "remindme", "напомни", "напомнить", "напоминание" };
|
||||
|
||||
public Task RunAsync(CommandProcessor cmd, string[] args, string[] cleanArgs) {
|
||||
// TODO: actually make this good
|
||||
var remindIn = CommandProcessor.GetTimeSpan(args, 0);
|
||||
var reminderText = cmd.GetRemaining(cleanArgs, 1, "ReminderText");
|
||||
if (reminderText is not null)
|
||||
|
@ -15,6 +16,8 @@ public sealed class RemindCommand : ICommand {
|
|||
ReminderChannel = cmd.Context.Channel.Id
|
||||
});
|
||||
|
||||
cmd.ConfigWriteScheduled = true;
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ public sealed class UnmuteCommand : ICommand {
|
|||
public async Task RunAsync(CommandProcessor cmd, string[] args, string[] cleanArgs) {
|
||||
if (!cmd.HasPermission(GuildPermission.ModerateMembers)) return;
|
||||
|
||||
var toUnmute = cmd.GetMember(args, cleanArgs, 0, "ToUnmute");
|
||||
var toUnmute = cmd.GetMember(args, 0, "ToUnmute");
|
||||
if (toUnmute is null) return;
|
||||
var reason = cmd.GetRemaining(args, 1, "UnmuteReason");
|
||||
if (reason is not null && cmd.CanInteractWith(toUnmute, "Unmute"))
|
||||
|
@ -27,6 +27,8 @@ public sealed class UnmuteCommand : ICommand {
|
|||
return;
|
||||
}
|
||||
|
||||
cmd.ConfigWriteScheduled = true;
|
||||
|
||||
var feedback = string.Format(Messages.FeedbackMemberUnmuted, toUnmute.Mention, Utils.Wrap(reason));
|
||||
cmd.Reply(feedback, ReplyEmojis.Unmuted);
|
||||
cmd.Audit(feedback);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue