Exemplo n.º 1
0
    static void TimerChange(int index, TimeSpan delta, ITriggerMsg e, Timers timers)
    {
        // Return if invalid or 0 delta.
        if (delta == TimeSpan.Zero)
        {
            return;
        }

        if (timers.Change(index, delta, out TimerDescription desc))
        {
            if (string.IsNullOrEmpty(desc.Message))
            {
                e.Reply("Changed timer {0} to {1} ({2}).",
                        index, desc.Duration.Str(), desc.Remaining.Str());
            }
            else
            {
                e.Reply("Changed \"{0}\" to {1} ({2}).",
                        desc.Message, desc.Duration.Str(), desc.Remaining.Str());
            }
        }
        else
        {
            e.Reply("No such timer.");
        }
    }