1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-04-29 02:29:55 +03:00

Bugfixes:

- Do not call RemoveUnbanAsync in guild tick loop if the user is not banned
- Fix !clear message logs being reversed
- Do not process MessageReceivedEvents by webhooks

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
Octol1ttle 2023-02-14 23:17:20 +05:00
parent f6f5543972
commit 4cc00e01da
Signed by: Octol1ttle
GPG key ID: B77C34313AEE1FFF
4 changed files with 11 additions and 16 deletions

View file

@ -8,7 +8,6 @@ using Discord.WebSocket;
namespace Boyfriend;
public sealed class CommandProcessor {
private static readonly string Mention = $"<@{Boyfriend.Client.CurrentUser.Id}>";
private static readonly TimeSpan Infinity = TimeSpan.FromMilliseconds(-1);
public static readonly ICommand[] Commands = {
@ -58,9 +57,10 @@ public sealed class CommandProcessor {
private async Task RunCommandOnLine(string line, string cleanLine, string prefix) {
var prefixed = line.StartsWith(prefix);
if (!prefixed && !line.StartsWith(Mention)) return;
var mention = Boyfriend.Client.CurrentUser.Mention;
if (!prefixed && !line.StartsWith(mention)) return;
foreach (var command in Commands) {
var lineNoMention = line.Remove(0, prefixed ? prefix.Length : Mention.Length);
var lineNoMention = line.Remove(0, prefixed ? prefix.Length : mention.Length);
if (!command.Aliases.Contains(lineNoMention.Trim().Split()[0])) continue;
var args = lineNoMention.Trim().Split().Skip(1).ToArray();