Creating a Menu

Creating a menu is done either by returning the menu-related results from commands or by instantiating a DefaultMenu (or a MenuBase implementation) yourself and starting or running it using the methods on your client instance.

Make sure you've read views before proceeding.

Standalone Example

This example starts a menu from an OnMessageReceived() callback.

protected override async ValueTask OnMessageReceived(BotMessageReceivedEventArgs e)
{
    if (e.Message.Content == "standalone_menu")
    {
        var menu = new DefaultMenu(/* your view */)
        {
            // Limits the menu usage to just the specific user.
            // This is set automatically for View() results in commands.
            AuthorId = e.AuthorId
        };
        await Bot.StartMenuAsync(e.ChannelId, menu);
    }
}
Command Examples

This example starts a menu from a command.

[Command("command_menu")]
public DiscordCommandResult CommandMenu()
{
    return View(/* your view */);
}
Next up: Webhooks.