Esempio n. 1
0
        /// <summary>
        ///     Starts setup process where guild admins can easily setup their specific guild settings.
        /// </summary>
        public async Task SetupAsync(SocketCommandContext context)
        {
            //Delete the message that invoked this command
            await context.Message.DeleteAsync();

            //Selection builder used to know which settings the admin wants to change
            var selection = new ReactionSelectionBuilder <string>()
                            .WithTitle("Cobra Setup")
                            .WithSelectables(new Dictionary <IEmote, string>
            {
                [new Emoji("1️⃣")] = "Welcome Channel",
                [new Emoji("2️⃣")] = "Moderation Channel",
                [new Emoji("3️⃣")] = "Role on Join",
                [new Emoji("4️⃣")] = "Custom Prefix",
                [new Emoji("5️⃣")] = "Private Chats"
            })
                            .WithUsers(context.User)
                            .WithAllowCancel(true)
                            .WithDeletion(DeletionOptions.AfterCapturedContext | DeletionOptions.Invalids);

            //Send the selection builder and save the result
            var result =
                await _interactivityService.SendSelectionAsync(selection.Build(), context.Channel,
                                                               TimeSpan.FromMinutes(3));

            //We switch through every result
            switch (result.Value)
            {
            //If user wants to setup Welcome Channel
            case "Welcome Channel":
                await WelcomeChannelSetup(context);

                break;

            //If user wants to setup Moderation Channel
            case "Moderation Channel":
                await ModerationSetup(context);

                break;

            //If user wants to setup Role on Join
            case "Role on Join":
                await RoleOnJoinSetup(context);

                break;

            //If user wants to setup Custom Prefix
            case "Custom Prefix":
                await PrefixSetup(context);

                break;

            //If user wants to setup Private Chats
            case "Private Chats":
                await PrivateChatSetup(context);

                break;
            }
        }