public async Task <RuntimeResult> ModifyConditionAsync
                (
                    AutoroleConfiguration autorole,
                    long conditionID,
                    IRole role
                )
                {
                    var getCondition = _autoroles.GetCondition <RoleCondition>
                                       (
                        autorole,
                        conditionID
                                       );

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

                    var condition    = getCondition.Entity;
                    var modifyResult = await _autoroles.ModifyConditionAsync
                                       (
                        condition,
                        c =>
                    {
                        condition.RoleID = (long)role.Id;
                    }
                                       );

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

                    return(RuntimeCommandResult.FromSuccess("Condition updated."));
                }
                public async Task <RuntimeResult> ModifyConditionAsync
                (
                    AutoroleConfiguration autorole,
                    long conditionID,
                    TimeSpan time
                )
                {
                    var getCondition = _autoroles.GetCondition <TimeSinceLastActivityCondition>
                                       (
                        autorole,
                        conditionID
                                       );

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

                    var condition    = getCondition.Entity;
                    var modifyResult = await _autoroles.ModifyConditionAsync
                                       (
                        condition,
                        c =>
                    {
                        condition.RequiredTime = time;
                    }
                                       );

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

                    return(RuntimeCommandResult.FromSuccess("Condition updated."));
                }
Ejemplo n.º 3
0
                public async Task <RuntimeResult> ModifyConditionAsync
                (
                    AutoroleConfiguration autorole,
                    long conditionID,
                    [OverrideTypeReader(typeof(UncachedMessageTypeReader <IMessage>))]
                    IMessage message,
                    IEmote emote
                )
                {
                    var getCondition = _autoroles.GetCondition <ReactionCondition>
                                       (
                        autorole,
                        conditionID
                                       );

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

                    var condition    = getCondition.Entity;
                    var modifyResult = await _autoroles.ModifyConditionAsync
                                       (
                        condition,
                        c =>
                    {
                        condition.MessageID = (long)message.Id;
                        condition.EmoteName = emote.Name;
                    }
                                       );

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

                    return(RuntimeCommandResult.FromSuccess("Condition updated."));
                }
                public async Task <RuntimeResult> ModifyConditionAsync
                (
                    AutoroleConfiguration autorole,
                    long conditionID,
                    ITextChannel channel,
                    long count
                )
                {
                    var getCondition = _autoroles.GetCondition <MessageCountInChannelCondition>
                                       (
                        autorole,
                        conditionID
                                       );

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

                    var condition    = getCondition.Entity;
                    var modifyResult = await _autoroles.ModifyConditionAsync
                                       (
                        condition,
                        c =>
                    {
                        condition.RequiredCount = count;
                        condition.SourceID      = (long)channel.Id;
                    }
                                       );

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

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