示例#1
0
        public async Task <Result <FeedbackMessage> > SetBanContextMessageAsync(long banID, IMessage newMessage)
        {
            var getBan = await _bans.GetBanAsync(_context.GuildID.Value, banID);

            if (!getBan.IsSuccess)
            {
                return(Result <FeedbackMessage> .FromError(getBan));
            }

            var ban = getBan.Entity;

            var setMessage = await _bans.SetBanContextMessageAsync(ban, newMessage.ID);

            return(setMessage.IsSuccess
                ? new FeedbackMessage("Ban context message updated.", _feedback.Theme.Secondary)
                : Result <FeedbackMessage> .FromError(setMessage));
        }
            public async Task <RuntimeResult> SetBanContextMessageAsync(long banID, IMessage newMessage)
            {
                var getBan = await _bans.GetBanAsync(this.Context.Guild, banID);

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

                var ban = getBan.Entity;

                var setMessage = await _bans.SetBanContextMessageAsync(ban, (long)newMessage.Id);

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

                return(RuntimeCommandResult.FromSuccess("Ban context message updated."));
            }
示例#3
0
            public async Task SetBanContextMessageAsync(long banID, IMessage newMessage)
            {
                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 setMessage = await _bans.SetBanContextMessageAsync(ban, (long)newMessage.Id);

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

                    return;
                }

                await _feedback.SendConfirmationAsync(this.Context, "Ban context message updated.");
            }