Updated Administration module

This commit is contained in:
Toastie (DCS Team) 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) if (!enabled)
await Response().Pending(strs.greetdmmsg_enable($"`{prefix}greetdm`")).SendAsync(); 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, guild: channel.Guild,
channel: channel, channel: channel,
users: users.ToArray()); users: users.ToArray());
var text = SmartText.CreateFrom(conf.ChannelGreetMessageText); var text = SmartText.CreateFrom(conf.ChannelGreetMessageText);
text = await _repSvc.ReplaceAsync(text, repCtx); text = await _repSvc.ReplaceAsync(text, repCtx);
try try
@ -630,6 +630,13 @@ public class GreetService : IEService, IReadyExecutor
return conf.SendChannelByeMessage; return conf.SendChannelByeMessage;
} }
public bool GetBoostEnabled(ulong guildId)
{
using var uow = _db.GetDbContext();
var conf = uow.GuildConfigsForId(guildId, set => set);
return conf.SendBoostMessage;
}
#endregion #endregion
#region Test Messages #region Test Messages