mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-11 00:07:55 +00:00
feat(bot): don't query db message context when running commands
This commit is contained in:
parent
7cb3a3ea0f
commit
9848b88d5b
9 changed files with 67 additions and 65 deletions
|
|
@ -17,10 +17,12 @@ public class Config
|
|||
{
|
||||
var items = new List<PaginatedConfigItem>();
|
||||
|
||||
var allowAutoproxy = await ctx.Repository.GetAutoproxyEnabled(ctx.Author.Id);
|
||||
|
||||
items.Add(new(
|
||||
"autoproxy account",
|
||||
"Whether autoproxy is enabled for the current account",
|
||||
EnabledDisabled(ctx.MessageContext.AllowAutoproxy),
|
||||
EnabledDisabled(allowAutoproxy),
|
||||
"enabled"
|
||||
));
|
||||
|
||||
|
|
@ -122,16 +124,18 @@ public class Config
|
|||
|
||||
public async Task AutoproxyAccount(Context ctx)
|
||||
{
|
||||
var allowAutoproxy = await ctx.Repository.GetAutoproxyEnabled(ctx.Author.Id);
|
||||
|
||||
if (!ctx.HasNext())
|
||||
{
|
||||
await ctx.Reply($"Autoproxy is currently **{EnabledDisabled(ctx.MessageContext.AllowAutoproxy)}** for account <@{ctx.Author.Id}>.");
|
||||
await ctx.Reply($"Autoproxy is currently **{EnabledDisabled(allowAutoproxy)}** for account <@{ctx.Author.Id}>.");
|
||||
return;
|
||||
}
|
||||
|
||||
var allow = ctx.MatchToggle(true);
|
||||
|
||||
var statusString = EnabledDisabled(allow);
|
||||
if (ctx.MessageContext.AllowAutoproxy == allow)
|
||||
if (allowAutoproxy == allow)
|
||||
{
|
||||
await ctx.Reply($"{Emojis.Note} Autoproxy is already {statusString} for account <@{ctx.Author.Id}>.");
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue