feat(bot): Case insensitive proxy tags matching (#490)
This commit is contained in:
@@ -243,7 +243,7 @@ public class Checks
|
||||
try
|
||||
{
|
||||
_proxy.ShouldProxy(channel, msg, context);
|
||||
_matcher.TryMatch(context, autoproxySettings, members, out var match, msg.Content, msg.Attachments.Length > 0, true);
|
||||
_matcher.TryMatch(context, autoproxySettings, members, out var match, msg.Content, msg.Attachments.Length > 0, true, ctx.Config.CaseSensitiveProxyTags);
|
||||
|
||||
await ctx.Reply("I'm not sure why this message was not proxied, sorry.");
|
||||
}
|
||||
|
@@ -88,6 +88,13 @@ public class Config
|
||||
Limits.MaxGroupCount.ToString()
|
||||
));
|
||||
|
||||
items.Add(new(
|
||||
"Case sensitive proxy tags",
|
||||
"If proxy tags should be case sensitive",
|
||||
EnabledDisabled(ctx.Config.CaseSensitiveProxyTags),
|
||||
"enabled"
|
||||
));
|
||||
|
||||
await ctx.Paginate<PaginatedConfigItem>(
|
||||
items.ToAsyncEnumerable(),
|
||||
items.Count,
|
||||
@@ -383,4 +390,27 @@ public class Config
|
||||
await ctx.Reply("Private information will now be **hidden** when looking up your own info. Use the `-private` flag to show it.");
|
||||
}
|
||||
}
|
||||
|
||||
public async Task CaseSensitiveProxyTags(Context ctx)
|
||||
{
|
||||
if (!ctx.HasNext())
|
||||
{
|
||||
if (ctx.Config.CaseSensitiveProxyTags) { await ctx.Reply("Proxy tags are currently case sensitive"); }
|
||||
else { await ctx.Reply("Proxy tags are currently case insensitive"); }
|
||||
return;
|
||||
}
|
||||
|
||||
if (ctx.MatchToggle(true))
|
||||
{
|
||||
await ctx.Repository.UpdateSystemConfig(ctx.System.Id, new() { CaseSensitiveProxyTags = true });
|
||||
|
||||
await ctx.Reply("Proxy tags are now case sensitive");
|
||||
}
|
||||
else
|
||||
{
|
||||
await ctx.Repository.UpdateSystemConfig(ctx.System.Id, new() { CaseSensitiveProxyTags = false });
|
||||
|
||||
await ctx.Reply("Proxy tags are now case insensitive");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user