mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-12 02:08:27 -04:00
fix: Fixed .h not working on some commands
add: Added select menu for the .mdls command dev: Reworked the way interactions are created and sent. It is much better but far from perfect
This commit is contained in:
@@ -4,6 +4,7 @@ using NadekoBot.Modules.Help.Services;
|
||||
using Newtonsoft.Json;
|
||||
using System.Text;
|
||||
using Nadeko.Common.Medusa;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.Mapping;
|
||||
|
||||
namespace NadekoBot.Modules.Help;
|
||||
|
||||
@@ -86,11 +87,31 @@ public sealed partial class Help : NadekoModule<HelpService>
|
||||
topLevelModules.Add(m);
|
||||
}
|
||||
|
||||
var menu = new SelectMenuBuilder()
|
||||
.WithPlaceholder("Select a module to see its commands")
|
||||
.WithCustomId("modules");
|
||||
|
||||
foreach (var m in topLevelModules)
|
||||
menu.AddOption(m.Name, m.Name, GetModuleEmoji(m.Name));
|
||||
|
||||
var inter = _inter.Create(ctx.User.Id,
|
||||
menu,
|
||||
async (smc) =>
|
||||
{
|
||||
await smc.DeferAsync();
|
||||
var val = smc.Data.Values.FirstOrDefault();
|
||||
if (val is null)
|
||||
return;
|
||||
|
||||
await Commands(val);
|
||||
});
|
||||
|
||||
await Response()
|
||||
.Paginated()
|
||||
.Items(topLevelModules)
|
||||
.PageSize(12)
|
||||
.CurrentPage(page)
|
||||
.Interaction(inter)
|
||||
.AddFooter(false)
|
||||
.Page((items, _) =>
|
||||
{
|
||||
@@ -442,7 +463,7 @@ public sealed partial class Help : NadekoModule<HelpService>
|
||||
.SendAsync();
|
||||
|
||||
|
||||
private Task SelfhostAction(SocketMessageComponent smc, object _)
|
||||
private Task SelfhostAction(SocketMessageComponent smc)
|
||||
=> smc.RespondConfirmAsync(_sender,
|
||||
"""
|
||||
- In case you don't want or cannot Donate to NadekoBot project, but you
|
||||
@@ -460,11 +481,11 @@ public sealed partial class Help : NadekoModule<HelpService>
|
||||
public async Task Donate()
|
||||
{
|
||||
var selfhostInter = _inter.Create(ctx.User.Id,
|
||||
new SimpleInteraction<object>(new ButtonBuilder(
|
||||
emote: new Emoji("🖥️"),
|
||||
customId: "donate:selfhosting",
|
||||
label: "Selfhosting"),
|
||||
SelfhostAction));
|
||||
new ButtonBuilder(
|
||||
emote: new Emoji("🖥️"),
|
||||
customId: "donate:selfhosting",
|
||||
label: "Selfhosting"),
|
||||
SelfhostAction);
|
||||
|
||||
var eb = _sender.CreateEmbed()
|
||||
.WithOkColor()
|
||||
|
Reference in New Issue
Block a user