Updated Administration module

This commit is contained in:
Toastie 2024-07-15 15:43:33 +12:00
parent c3340a16ba
commit 32db627aef
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4
2 changed files with 22 additions and 1 deletions

View file

@ -225,5 +225,19 @@ public partial class Administration
if (!enabled)
await Response().Pending(strs.greetdmmsg_enable($"`{prefix}greetdm`")).SendAsync();
}
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.ManageGuild)]
[Ratelimit(5)]
public async Task BoostTest([Leftover] IGuildUser? user = null)
{
user ??= (IGuildUser)ctx.User;
await _service.BoostTest((ITextChannel)ctx.Channel, user);
var enabled = _service.GetBoostEnabled(ctx.Guild.Id);
if (!enabled)
await Response().Pending(strs.boostmsg_enable($"`{prefix}boost`")).SendAsync();
}
}
}

View file

@ -242,7 +242,7 @@ public class GreetService : IEService, IReadyExecutor
guild: channel.Guild,
channel: channel,
users: users.ToArray());
var text = SmartText.CreateFrom(conf.ChannelGreetMessageText);
text = await _repSvc.ReplaceAsync(text, repCtx);
try
@ -630,6 +630,13 @@ public class GreetService : IEService, IReadyExecutor
return conf.SendChannelByeMessage;
}
public bool GetBoostEnabled(ulong guildId)
{
using var uow = _db.GetDbContext();
var conf = uow.GuildConfigsForId(guildId, set => set);
return conf.SendBoostMessage;
}
#endregion
#region Test Messages