1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-04-30 19:19:54 +03:00

Guild blacklist implementation

This commit is contained in:
Octol1ttle 2022-10-18 22:55:16 +05:00
parent e767205c1a
commit c0ae850fb8
Signed by: Octol1ttle
GPG key ID: B77C34313AEE1FFF
9 changed files with 843 additions and 789 deletions

View file

@ -29,6 +29,7 @@ public sealed class CommandProcessor {
private readonly List<Task> _tasks = new();
public readonly SocketCommandContext Context;
private bool _serverBlacklisted;
public bool ConfigWriteScheduled = false;
@ -56,6 +57,11 @@ public sealed class CommandProcessor {
var cleanList = Context.Message.CleanContent.Split("\n");
for (var i = 0; i < list.Length; i++) {
RunCommandOnLine(list[i], cleanList[i], regex);
if (_serverBlacklisted) {
await Context.Message.ReplyAsync(Messages.ServerBlacklisted);
return;
}
if (_stackedReplyMessage.Length > 0) _ = Context.Channel.TriggerTypingAsync();
var member = Boyfriend.Client.GetGuild(Context.Guild.Id)
.GetUser(Context.User.Id); // Getting an up-to-date copy
@ -79,6 +85,10 @@ public sealed class CommandProcessor {
if (lineNoMention == line
|| !command.Aliases.Contains(lineNoMention.Trim().ToLower().Split()[0]))
continue;
if (Utils.IsServerBlacklisted(Context.Guild)) {
_serverBlacklisted = true;
return;
}
var args = line.Split().Skip(lineNoMention.StartsWith(" ") ? 2 : 1).ToArray();
var cleanArgs = cleanLine.Split().Skip(lineNoMention.StartsWith(" ") ? 2 : 1).ToArray();