public async Task <Result <FeedbackMessage> > SetAffirmationNotificationChannel(IChannel channel)
        {
            if (channel.Type is not ChannelType.GuildText)
            {
                return(new UserError("That's not a text channel."));
            }

            var setResult = await _autoroles.SetAffirmationNotificationChannelAsync
                            (
                _context.GuildID.Value,
                channel.ID
                            );

            return(!setResult.IsSuccess
                ? Result <FeedbackMessage> .FromError(setResult)
                : new FeedbackMessage("Channel set.", _feedback.Theme.Secondary));
        }
示例#2
0
                public async Task <RuntimeResult> SetAffirmationNotificationChannel(IChannel channel)
                {
                    if (!(channel is ITextChannel textChannel))
                    {
                        return(RuntimeCommandResult.FromError("That's not a text channel."));
                    }

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

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

                    return(RuntimeCommandResult.FromSuccess("Channel set."));
                }
示例#3
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.");
                }