Restructured the project structure back to the way it was, there's no reasonable way to split the modules

This commit is contained in:
Kwoth
2024-04-26 22:26:24 +00:00
parent 6c9c8bf63e
commit e0819f760c
768 changed files with 192 additions and 1047 deletions

View File

@@ -0,0 +1,34 @@
using NadekoBot.Common;
using NadekoBot.Common.ModuleBehaviors;
namespace NadekoBot.Modules.Help.Services;
public class HelpService(BotConfigService bss, IReplacementService repSvc) : IExecNoCommand, INService
{
public async Task ExecOnNoCommandAsync(IGuild? guild, IUserMessage msg)
{
var settings = bss.Data;
if (guild is null)
{
if (string.IsNullOrWhiteSpace(settings.DmHelpText) || settings.DmHelpText == "-")
return;
// only send dm help text if it contains one of the keywords, if they're specified
// if they're not, then reply to every DM
if (settings.DmHelpTextKeywords is not null &&
!settings.DmHelpTextKeywords.Any(k => msg.Content.Contains(k)))
{
return;
}
var repCtx = new ReplacementContext(guild: guild, channel: msg.Channel, users: msg.Author)
.WithOverride("%prefix%", () => bss.Data.Prefix)
.WithOverride("%bot.prefix%", () => bss.Data.Prefix);
var text = SmartText.CreateFrom(settings.DmHelpText);
text = await repSvc.ReplaceAsync(text, repCtx);
await msg.Channel.SendAsync(text);
}
}
}