Ejemplo n.º 1
0
                public async Task AddConditionAsync(AutoroleConfiguration autorole, IRole role)
                {
                    var condition = _autoroles.CreateConditionProxy <RoleCondition>
                                    (
                        role
                                    );

                    if (condition is null)
                    {
                        await _feedback.SendErrorAsync(this.Context, "Failed to create a condition object. Yikes!");

                        return;
                    }

                    var addCondition = await _autoroles.AddConditionAsync(autorole, condition);

                    if (!addCondition.IsSuccess)
                    {
                        await _feedback.SendErrorAsync(this.Context, addCondition.ErrorReason);

                        return;
                    }

                    await _feedback.SendConfirmationAsync(this.Context, "Condition added.");
                }
                public async Task SetDedicatedRoleplayChannelCategory(ICategoryChannel category)
                {
                    var getServerResult = await _servers.GetOrRegisterServerAsync(this.Context.Guild);

                    if (!getServerResult.IsSuccess)
                    {
                        await _feedback.SendErrorAsync(this.Context, getServerResult.ErrorReason);

                        return;
                    }

                    var server = getServerResult.Entity;

                    var result = await _roleplaying.SetDedicatedRoleplayChannelCategoryAsync
                                 (
                        server,
                        category
                                 );

                    if (!result.IsSuccess)
                    {
                        await _feedback.SendErrorAsync(this.Context, result.ErrorReason);

                        return;
                    }

                    await _feedback.SendConfirmationAsync(this.Context, "Dedicated channel category set.");
                }
Ejemplo n.º 3
0
        public async Task DroneAsync(IGuildUser user)
        {
            if (!(this.Context.User is IGuildUser target))
            {
                await _feedback.SendErrorAsync(this.Context, "The target user wasn't a guild user.");

                return;
            }

            var droneMessage = user == target
                ? _content.GetRandomSelfDroneMessage()
                : _content.GetRandomTurnTheTablesMessage();

            await _feedback.SendConfirmationAsync(this.Context, droneMessage);

            var droneResult = await _drone.DroneUserAsync(target);

            if (!droneResult.IsSuccess)
            {
                await _feedback.SendErrorAsync(this.Context, droneResult.ErrorReason);

                return;
            }

            await _feedback.SendConfirmationAsync(this.Context, _content.GetRandomConfirmationMessage());
        }
Ejemplo n.º 4
0
            public async Task SetRoleplayNameAsync
            (
                string newRoleplayName,
                [RequireEntityOwnerOrPermission(typeof(EditRoleplay), PermissionTarget.Other)]
                Roleplay roleplay
            )
            {
                var result = await _discordRoleplays.SetRoleplayNameAsync
                             (
                    roleplay,
                    newRoleplayName
                             );

                if (!result.IsSuccess)
                {
                    await _feedback.SendErrorAsync(this.Context, result.ErrorReason);

                    return;
                }

                var getDedicatedChannelResult = await _dedicatedChannels.GetDedicatedChannelAsync
                                                (
                    this.Context.Guild,
                    roleplay
                                                );

                if (getDedicatedChannelResult.IsSuccess)
                {
                    var dedicatedChannel = getDedicatedChannelResult.Entity;

                    await dedicatedChannel.ModifyAsync(p => p.Name = $"{roleplay.Name}-rp");
                }

                await _feedback.SendConfirmationAsync(this.Context, "Roleplay name set.");
            }
Ejemplo n.º 5
0
        public static async Task <IUserMessage> SendPrivateInteractiveMessageAsync
        (
            this InteractiveService @this,
            [NotNull] SocketCommandContext context,
            [NotNull] UserFeedbackService feedback,
            [NotNull] IInteractiveMessage interactiveMessage
        )
        {
            if (!(await context.User.GetOrCreateDMChannelAsync() is ISocketMessageChannel userChannel))
            {
                throw new InvalidOperationException("Could not create DM channel for target user.");
            }

            try
            {
                await feedback.SendConfirmationAsync(context, "Loading...");
            }
            catch (HttpException hex) when(hex.WasCausedByDMsNotAccepted())
            {
                await feedback.SendWarningAsync(context, "You don't accept DMs from non-friends on this server, so I'm unable to do that.");

                throw new InvalidOperationException("User does not accept DMs from non-friends.");
            }
            finally
            {
                await((IDMChannel)userChannel).CloseAsync();
            }

            if (!context.IsPrivate)
            {
                await feedback.SendConfirmationAsync(context, "Please check your private messages.");
            }

            return(await SendInteractiveMessageAsync(@this, context, interactiveMessage, userChannel));
        }
Ejemplo n.º 6
0
        public async Task SetKinkPreferenceAsync
        (
            string kinkName,
            [OverrideTypeReader(typeof(HumanizerEnumTypeReader <KinkPreference>))]
            KinkPreference preference
        )
        {
            var getUserKinkResult = await _kinks.GetUserKinkByNameAsync(this.Context.User, kinkName);

            if (!getUserKinkResult.IsSuccess)
            {
                await _feedback.SendErrorAsync(this.Context, getUserKinkResult.ErrorReason);

                return;
            }

            var userKink = getUserKinkResult.Entity;
            var setKinkPreferenceResult = await _kinks.SetKinkPreferenceAsync(userKink, preference);

            if (!setKinkPreferenceResult.IsSuccess)
            {
                await _feedback.SendErrorAsync(this.Context, setKinkPreferenceResult.ErrorReason);

                return;
            }

            await _feedback.SendConfirmationAsync(this.Context, "Preference set.");
        }
Ejemplo n.º 7
0
        public async Task AddBanAsync
        (
            [NotNull] IGuildUser user,
            [NotNull] string reason,
            TimeSpan?expiresAfter = null
        )
        {
            DateTime?expiresOn = null;

            if (!(expiresAfter is null))
            {
                expiresOn = DateTime.Now.Add(expiresAfter.Value);
            }

            var addBan = await _bans.CreateBanAsync(this.Context.User, user, reason, expiresOn : expiresOn);

            if (!addBan.IsSuccess)
            {
                await _feedback.SendErrorAsync(this.Context, addBan.ErrorReason);

                return;
            }

            var ban = addBan.Entity;

            await this.Context.Guild.AddBanAsync((ulong)ban.User.DiscordID, reason : reason);

            await _feedback.SendConfirmationAsync(this.Context, $"User banned (ban ID {ban.ID}).");

            await _logging.NotifyUserBanned(ban);
        }
Ejemplo n.º 8
0
        public async Task <RuntimeResult> BoopAsync(IUser target)
        {
            if (!target.IsMe(this.Context.Client))
            {
                return(RuntimeCommandResult.FromSuccess($"*boops {target.Mention}*"));
            }

            await _feedback.SendConfirmationAsync(this.Context, "...seriously?");

            return(RuntimeCommandResult.FromSuccess($"*boops {this.Context.User.Mention}*"));
        }
        public async Task ShiftAsync
        (
            [NotNull]
            IUser target,
            [OverrideTypeReader(typeof(HumanizerEnumTypeReader <Chirality>))]
            Chirality chirality,
            [OverrideTypeReader(typeof(HumanizerEnumTypeReader <Bodypart>))]
            Bodypart bodyPart,
            [NotNull] string species
        )
        {
            var getTargetUserResult = await _users.GetOrRegisterUserAsync(target);

            if (!getTargetUserResult.IsSuccess)
            {
                await _feedback.SendErrorAsync(this.Context, getTargetUserResult.ErrorReason);

                return;
            }

            var targetUser = getTargetUserResult.Entity;

            var getCurrentCharacterResult = await _characters.GetCurrentCharacterAsync(this.Context, targetUser);

            if (!getCurrentCharacterResult.IsSuccess)
            {
                await _feedback.SendErrorAsync(this.Context, getCurrentCharacterResult.ErrorReason);

                return;
            }

            var character = getCurrentCharacterResult.Entity;

            ShiftBodypartResult result;

            if (species.Equals("remove", StringComparison.OrdinalIgnoreCase))
            {
                result = await _transformation.RemoveBodypartAsync(this.Context, character, bodyPart, chirality);
            }
            else
            {
                result = await _transformation.ShiftBodypartAsync(this.Context, character, bodyPart, species, chirality);
            }

            if (!result.IsSuccess)
            {
                await _feedback.SendErrorAsync(this.Context, result.ErrorReason);

                return;
            }

            await _feedback.SendConfirmationAsync(this.Context, result.ShiftMessage);
        }
                public async Task SetModerationLogChannelAsync(ITextChannel channel)
                {
                    var setChannel = await _moderation.SetModerationLogChannelAsync(this.Context.Guild, channel);

                    if (!setChannel.IsSuccess)
                    {
                        await _feedback.SendErrorAsync(this.Context, setChannel.ErrorReason);

                        return;
                    }

                    await _feedback.SendConfirmationAsync(this.Context, "Channel set.");
                }
Ejemplo n.º 11
0
        public async Task AddNoteAsync([NotNull] IGuildUser user, [NotNull] string content)
        {
            var addNote = await _notes.CreateNoteAsync(this.Context.User, user, content);

            if (!addNote.IsSuccess)
            {
                await _feedback.SendErrorAsync(this.Context, addNote.ErrorReason);

                return;
            }

            var note = addNote.Entity;
            await _feedback.SendConfirmationAsync(this.Context, $"Note added (ID {note.ID}).");

            await _logging.NotifyUserNoteAdded(note);
        }
Ejemplo n.º 12
0
        /// <inheritdoc />
        protected override async Task OnCommandSucceededAsync
        (
            SocketCommandContext context,
            int commandStart,
            IResult result
        )
        {
            if (!(result is RuntimeCommandResult runtimeCommandResult))
            {
                return;
            }

            if (!result.IsSuccess)
            {
                this.Log.LogWarning("An unsuccessful message bubbled up to the successful command handling. Bug?");
                return;
            }

            if (runtimeCommandResult.SuccessMessage is null)
            {
                return;
            }

            await _feedback.SendConfirmationAsync(context, runtimeCommandResult.SuccessMessage);
        }
Ejemplo n.º 13
0
        public async Task AddWarningAsync
        (
            [NotNull] IGuildUser user,
            [NotNull] string content,
            TimeSpan?expiresAfter = null
        )
        {
            DateTime?expiresOn = null;

            if (!(expiresAfter is null))
            {
                expiresOn = DateTime.Now.Add(expiresAfter.Value);
            }

            var addWarning = await _warnings.CreateWarningAsync(this.Context.User, user, content, expiresOn : expiresOn);

            if (!addWarning.IsSuccess)
            {
                await _feedback.SendErrorAsync(this.Context, addWarning.ErrorReason);

                return;
            }

            var warning = addWarning.Entity;
            await _feedback.SendConfirmationAsync(this.Context, $"Warning added (ID {warning.ID}).");

            await _logging.NotifyUserWarningAdded(warning);

            var getSettings = await _moderation.GetOrCreateServerSettingsAsync(this.Context.Guild);

            if (!getSettings.IsSuccess)
            {
                return;
            }

            var settings = getSettings.Entity;

            var warningCount = await _warnings.GetWarnings(user).CountAsync();

            if (warningCount >= settings.WarningThreshold)
            {
                await _feedback.SendWarningAsync
                (
                    this.Context, $"The warned user now has {warningCount} warnings. Consider further action."
                );
            }
        }
Ejemplo n.º 14
0
        public async Task CreateAutoroleAsync(IRole discordRole)
        {
            var create = await _autoroles.CreateAutoroleAsync(discordRole);

            if (!create.IsSuccess)
            {
                await _feedback.SendErrorAsync(this.Context, create.ErrorReason);
            }

            await _feedback.SendConfirmationAsync(this.Context, "Autorole configuration created.");
        }
Ejemplo n.º 15
0
        public async Task <RuntimeResult> UpdateKinkDatabaseAsync()
        {
            await _feedback.SendConfirmationAsync(this.Context, "Updating kinks...");

            var updatedKinkCount = 0;

            // Get the latest JSON from F-list
            string json;

            using (var web = new HttpClient())
            {
                web.Timeout = TimeSpan.FromSeconds(3);

                var cts = new CancellationTokenSource();
                cts.CancelAfter(web.Timeout);

                try
                {
                    using var response = await web.GetAsync
                                         (
                              new Uri ("https://www.f-list.net/json/api/kink-list.php"),
                              cts.Token
                                         );

                    json = await response.Content.ReadAsStringAsync();
                }
                catch (OperationCanceledException)
                {
                    return(RuntimeCommandResult.FromError("Could not connect to F-list: Operation timed out."));
                }
            }

            var kinkCollection = JsonConvert.DeserializeObject <KinkCollection>(json);

            if (kinkCollection.KinkCategories is null)
            {
                return(RuntimeCommandResult.FromError($"Received an error from F-List: {kinkCollection.Error}"));
            }

            foreach (var kinkSection in kinkCollection.KinkCategories)
            {
                if (!Enum.TryParse <KinkCategory>(kinkSection.Key, out var kinkCategory))
                {
                    return(RuntimeCommandResult.FromError("Failed to parse kink category."));
                }

                updatedKinkCount += await _kinks.UpdateKinksAsync(kinkSection.Value.Kinks.Select
                                                                  (
                                                                      k => new Kink(k.Name, k.Description, k.KinkId, kinkCategory)
                                                                  ));
            }

            return(RuntimeCommandResult.FromSuccess($"Done. {updatedKinkCount} kinks updated."));
        }
            public async Task CreateCharacterRoleAsync
            (
                IRole discordRole,
                RoleAccess access = RoleAccess.Open
            )
            {
                var createRoleResult = await _characterRoles.CreateCharacterRoleAsync
                                       (
                    discordRole,
                    access
                                       );

                if (!createRoleResult.IsSuccess)
                {
                    await _feedback.SendErrorAsync(this.Context, createRoleResult.ErrorReason);

                    return;
                }

                await _feedback.SendConfirmationAsync(this.Context, "Character role created.");
            }
Ejemplo n.º 17
0
        public async Task ContactUserAsync([NotNull] IUser discordUser)
        {
            if (discordUser.Id == this.Context.Client.CurrentUser.Id)
            {
                await _feedback.SendErrorAsync(this.Context, "That's a splendid idea - at least then, I'd get an intelligent reply.");

                return;
            }

            if (discordUser.IsBot)
            {
                await _feedback.SendErrorAsync(this.Context, "I could do that, but I doubt I'd get a reply.");

                return;
            }

            var eb = _feedback.CreateFeedbackEmbed
                     (
                discordUser,
                Color.DarkPurple,
                $"Hello there, {discordUser.Mention}. I've been instructed to initiate... negotiations... with you. \nA good place to start would be the \"!help <topic>\" command."
                     );

            var userDMChannel = await discordUser.GetOrCreateDMChannelAsync();

            try
            {
                await userDMChannel.SendMessageAsync(string.Empty, false, eb);
            }
            catch (HttpException hex) when(hex.WasCausedByDMsNotAccepted())
            {
                return;
            }
            finally
            {
                await userDMChannel.CloseAsync();
            }

            await _feedback.SendConfirmationAsync(this.Context, "User contacted.");
        }
Ejemplo n.º 18
0
            public async Task SetCharacterNameAsync
            (
                [RequireEntityOwnerOrPermission(typeof(EditCharacter), PermissionTarget.Other)]
                Character character,
                string newCharacterName
            )
            {
                var setNameResult = await _characters.SetCharacterNameAsync(character, newCharacterName);

                if (!setNameResult.IsSuccess)
                {
                    await _feedback.SendErrorAsync(this.Context, setNameResult.ErrorReason);

                    return;
                }

                await _feedback.SendConfirmationAsync(this.Context, "Character name set.");
            }
            public async Task Default
            (
                [NotNull] IUser discordUser,
                string permissionName,
                [OverrideTypeReader(typeof(HumanizerEnumTypeReader <PermissionTarget>))]
                PermissionTarget revokedTarget = PermissionTarget.Self
            )
            {
                var getPermissionResult = _permissionRegistry.GetPermission(permissionName);

                if (!getPermissionResult.IsSuccess)
                {
                    await _feedback.SendErrorAsync(this.Context, getPermissionResult.ErrorReason);

                    return;
                }

                var permission             = getPermissionResult.Entity;
                var revokePermissionResult = await _permissions.RevokePermissionAsync
                                             (
                    this.Context.Guild,
                    discordUser,
                    permission,
                    revokedTarget
                                             );

                if (!revokePermissionResult.IsSuccess)
                {
                    await _feedback.SendErrorAsync(this.Context, revokePermissionResult.ErrorReason);

                    return;
                }

                await _feedback.SendConfirmationAsync
                (
                    this.Context,
                    $"{permission.FriendlyName} revoked from {discordUser.Mention}."
                );
            }
Ejemplo n.º 20
0
        public static async Task <IUserMessage> SendPrivatePaginatedMessageAsync <T1, T2>
        (
            this InteractiveService @this,
            [NotNull] SocketCommandContext context,
            [NotNull] UserFeedbackService feedback,
            [NotNull] IPager <T1, T2> pager,
            [CanBeNull] ICriterion <SocketReaction> criterion = null
        )
            where T2 : IPager <T1, T2>
        {
            var userChannel = await context.User.GetOrCreateDMChannelAsync();

            try
            {
                await feedback.SendConfirmationAsync(context, "Loading...");
            }
            catch (HttpException hex)
            {
                if (hex.WasCausedByDMsNotAccepted())
                {
                    await feedback.SendWarningAsync(context, "You don't accept DMs from non-friends on this server, so I'm unable to do that.");

                    throw new InvalidOperationException("User does not accept DMs from non-friends.");
                }
            }
            finally
            {
                await userChannel.CloseAsync();
            }

            if (!context.IsPrivate)
            {
                await feedback.SendConfirmationAsync(context, "Please check your private messages.");
            }

            return(await SendPaginatedMessageAsync(@this, context, feedback, pager, userChannel, criterion));
        }
Ejemplo n.º 21
0
            public async Task SetWarningReasonAsync(long warningID, string newReason)
            {
                var getWarning = await _warnings.GetWarningAsync(this.Context.Guild, warningID);

                if (!getWarning.IsSuccess)
                {
                    await _feedback.SendErrorAsync(this.Context, getWarning.ErrorReason);

                    return;
                }

                var warning = getWarning.Entity;

                var setContents = await _warnings.SetWarningReasonAsync(warning, newReason);

                if (!setContents.IsSuccess)
                {
                    await _feedback.SendErrorAsync(this.Context, setContents.ErrorReason);

                    return;
                }

                await _feedback.SendConfirmationAsync(this.Context, "Warning reason updated.");
            }
Ejemplo n.º 22
0
            public async Task SetBanReasonAsync(long banID, string newReason)
            {
                var getBan = await _bans.GetBanAsync(this.Context.Guild, banID);

                if (!getBan.IsSuccess)
                {
                    await _feedback.SendErrorAsync(this.Context, getBan.ErrorReason);

                    return;
                }

                var ban = getBan.Entity;

                var setContents = await _bans.SetBanReasonAsync(ban, newReason);

                if (!setContents.IsSuccess)
                {
                    await _feedback.SendErrorAsync(this.Context, setContents.ErrorReason);

                    return;
                }

                await _feedback.SendConfirmationAsync(this.Context, "Ban reason updated.");
            }
Ejemplo n.º 23
0
            public async Task SetTitleAsync(string title, string newTitle)
            {
                var getDossierResult = await _dossiers.GetDossierByTitleAsync(title);

                if (!getDossierResult.IsSuccess)
                {
                    await _feedback.SendErrorAsync(this.Context, getDossierResult.ErrorReason);

                    return;
                }

                var dossier = getDossierResult.Entity;

                var modifyResult = await _dossiers.SetDossierTitleAsync(dossier, newTitle);

                if (!modifyResult.IsSuccess)
                {
                    await _feedback.SendErrorAsync(this.Context, modifyResult.ErrorReason);

                    return;
                }

                await _feedback.SendConfirmationAsync(this.Context, "New dossier title set.");
            }
            public async Task ClearAffirmationNotificationChannel()
            {
                var clearResult = await _autoroles.ClearAffirmationNotificationChannelAsync
                                  (
                    this.Context.Guild
                                  );

                if (!clearResult.IsSuccess)
                {
                    await _feedback.SendErrorAsync(this.Context, clearResult.ErrorReason);

                    return;
                }

                await _feedback.SendConfirmationAsync(this.Context, "Channel cleared.");
            }
            public async Task RemoveConditionAsync
            (
                AutoroleConfiguration autorole,
                long conditionID
            )
            {
                var removeCondition = await _autoroles.RemoveConditionAsync(autorole, conditionID);

                if (!removeCondition.IsSuccess)
                {
                    await _feedback.SendErrorAsync(this.Context, removeCondition.ErrorReason);

                    return;
                }

                await _feedback.SendConfirmationAsync(this.Context, "Condition removed.");
            }
Ejemplo n.º 26
0
        public async Task <RuntimeResult> SetAffirmationRequirementAsync
        (
            AutoroleConfiguration autorole,
            bool requireAffirmation = true
        )
        {
            var setRequirementResult = await _autoroles.SetAffirmationRequiredAsync(autorole, requireAffirmation);

            if (!setRequirementResult.IsSuccess)
            {
                return(setRequirementResult.ToRuntimeResult());
            }

            await _feedback.SendConfirmationAsync
            (
                this.Context,
                requireAffirmation? "Affirmation is now required." : "Affirmation is no longer required."
            );

            return(RuntimeCommandResult.FromSuccess());
        }
Ejemplo n.º 27
0
        public async Task <RuntimeResult> DroneAsync(IGuildUser user)
        {
            if (!(this.Context.User is IGuildUser target))
            {
                return(RuntimeCommandResult.FromError("The target user wasn't a guild user."));
            }

            var droneMessage = user == target
                ? _content.GetRandomSelfDroneMessage()
                : _content.GetRandomTurnTheTablesMessage();

            await _feedback.SendConfirmationAsync(this.Context, droneMessage);

            var droneResult = await _drone.DroneUserAsync(target);

            if (!droneResult.IsSuccess)
            {
                return(droneResult.ToRuntimeResult());
            }

            return(RuntimeCommandResult.FromSuccess(_content.GetRandomConfirmationMessage()));
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Sends a paginated message to the context user's direct messaging channel, alerting them if they are
        /// not already in it, and deletes it after a certain timeout. Defaults to 5 minutes.
        /// </summary>
        /// <param name="this">The interactive service.</param>
        /// <param name="context">The command context.</param>
        /// <param name="feedback">The feedback service to use.</param>
        /// <param name="message">The message to send.</param>
        /// <param name="timeout">The timeout after which the embed will be deleted. Defaults to 5 minutes.</param>
        /// <returns>The message that was sent.</returns>
        public static async Task SendPrivateInteractiveMessageAndDeleteAsync
        (
            [NotNull] this InteractivityService @this,
            [NotNull] ICommandContext context,
            [NotNull] UserFeedbackService feedback,
            [NotNull] InteractiveMessage message,
            [CanBeNull] TimeSpan?timeout = null
        )
        {
            timeout = timeout ?? TimeSpan.FromMinutes(5.0);

            var userChannel = await context.User.GetOrCreateDMChannelAsync();

            try
            {
                var eb = feedback.CreateFeedbackEmbed(context.User, Color.DarkPurple, "Loading...");
                await feedback.SendEmbedAndDeleteAsync(userChannel, eb, TimeSpan.FromSeconds(1));

                if (!(context.Channel is IDMChannel))
                {
                    await feedback.SendConfirmationAsync(context, "Please check your private messages.");
                }

                await @this.SendInteractiveMessageAndDeleteAsync(userChannel, message, timeout);
            }
            catch (HttpException hex)
            {
                if (hex.WasCausedByDMsNotAccepted())
                {
                    await feedback.SendWarningAsync
                    (
                        context,
                        "You don't accept DMs from non-friends on this server, so I'm unable to do that."
                    );
                }

                throw;
            }
        }
Ejemplo n.º 29
0
                public async Task SetAffirmationNotificationChannel(IChannel channel)
                {
                    if (!(channel is ITextChannel textChannel))
                    {
                        await _feedback.SendErrorAsync(this.Context, "That's not a text channel.");

                        return;
                    }

                    var setResult = await _autoroles.SetAffirmationNotificationChannelAsync
                                    (
                        this.Context.Guild,
                        textChannel
                                    );

                    if (!setResult.IsSuccess)
                    {
                        await _feedback.SendErrorAsync(this.Context, setResult.ErrorReason);

                        return;
                    }

                    await _feedback.SendConfirmationAsync(this.Context, "Channel set.");
                }
Ejemplo n.º 30
0
            public async Task SetNoteContentsAsync(long noteID, string newContents)
            {
                var getNote = await _notes.GetNoteAsync(this.Context.Guild, noteID);

                if (!getNote.IsSuccess)
                {
                    await _feedback.SendErrorAsync(this.Context, getNote.ErrorReason);

                    return;
                }

                var note = getNote.Entity;

                var setContents = await _notes.SetNoteContentsAsync(note, newContents);

                if (!setContents.IsSuccess)
                {
                    await _feedback.SendErrorAsync(this.Context, setContents.ErrorReason);

                    return;
                }

                await _feedback.SendConfirmationAsync(this.Context, "Note contents updated.");
            }