mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 01:38:27 -04:00
Medusa modules (sneks) should now inherit medusa description when listed in .mdls command
This commit is contained in:
@@ -92,7 +92,7 @@ public partial class Help : NadekoModule<HelpService>
|
|||||||
localModules.OrderBy(module => module.Name)
|
localModules.OrderBy(module => module.Name)
|
||||||
.ToList()
|
.ToList()
|
||||||
.ForEach(module => embed.AddField($"{GetModuleEmoji(module.Name)} {module.Name}",
|
.ForEach(module => embed.AddField($"{GetModuleEmoji(module.Name)} {module.Name}",
|
||||||
GetText(GetModuleLocStr(module.Name))
|
GetModuleDescription(module.Name)
|
||||||
+ "\n"
|
+ "\n"
|
||||||
+ Format.Code(GetText(strs.module_footer(prefix, module.Name.ToLowerInvariant()))),
|
+ Format.Code(GetText(strs.module_footer(prefix, module.Name.ToLowerInvariant()))),
|
||||||
true));
|
true));
|
||||||
@@ -104,6 +104,25 @@ public partial class Help : NadekoModule<HelpService>
|
|||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string GetModuleDescription(string moduleName)
|
||||||
|
{
|
||||||
|
var key = GetModuleLocStr(moduleName);
|
||||||
|
|
||||||
|
if (key.Key == strs.module_description_missing.Key)
|
||||||
|
{
|
||||||
|
var desc = _medusae
|
||||||
|
.GetLoadedMedusae(Culture)
|
||||||
|
.FirstOrDefault(m => m.Sneks
|
||||||
|
.Any(x => x.Name.Equals(moduleName, StringComparison.InvariantCultureIgnoreCase)))
|
||||||
|
?.Description;
|
||||||
|
|
||||||
|
if (desc is not null)
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetText(key);
|
||||||
|
}
|
||||||
|
|
||||||
private LocStr GetModuleLocStr(string moduleName)
|
private LocStr GetModuleLocStr(string moduleName)
|
||||||
{
|
{
|
||||||
switch (moduleName.ToLowerInvariant())
|
switch (moduleName.ToLowerInvariant())
|
||||||
|
Reference in New Issue
Block a user