示例#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.");
                }
示例#2
0
                public async Task <RuntimeResult> AddConditionAsync
                (
                    AutoroleConfiguration autorole,
                    [OverrideTypeReader(typeof(UncachedMessageTypeReader <IMessage>))]
                    IMessage message,
                    IEmote emote
                )
                {
                    var condition = _autoroles.CreateConditionProxy <ReactionCondition>
                                    (
                        message,
                        emote
                                    );

                    if (condition is null)
                    {
                        return(RuntimeCommandResult.FromError("Failed to create a condition object. Yikes!"));
                    }

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

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

                    return(RuntimeCommandResult.FromSuccess("Condition added."));
                }
                public async Task <RuntimeResult> AddConditionAsync(AutoroleConfiguration autorole, ITextChannel channel, long count)
                {
                    var condition = _autoroles.CreateConditionProxy <MessageCountInChannelCondition>(channel, count);

                    if (condition is null)
                    {
                        return(RuntimeCommandResult.FromError("Failed to create a condition object. Yikes!"));
                    }

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

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

                    return(RuntimeCommandResult.FromSuccess("Condition added."));
                }
                public async Task <RuntimeResult> AddConditionAsync(AutoroleConfiguration autorole, TimeSpan time)
                {
                    var condition = _autoroles.CreateConditionProxy <TimeSinceLastActivityCondition>
                                    (
                        time
                                    );

                    if (condition is null)
                    {
                        return(RuntimeCommandResult.FromError("Failed to create a condition object. Yikes!"));
                    }

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

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

                    return(RuntimeCommandResult.FromSuccess("Condition added."));
                }