private void OnTimePass(MessageAliasTimer item) { if (messagesCount > 0) { sendMessage(string.IsNullOrEmpty(item.value) ? item.command.Value : item.value); } }
private void agregarTimer(ChatCommandRequest cmd) { MessageAlias timer = new MessageAlias(); timer.Time = int.Parse(cmd.argumentos[0]); if (cmd.argumentos[1].StartsWith('!')) { timer.command = listaComandos.Find(x => x.Key.Equals(cmd.argumentos[1])); } else { timer.value = cmd.Value.Substring(cmd.argumentos[0].Length + 1); } MessageAliasTimer timerT = new MessageAliasTimer(); timerT.Time = int.Parse(cmd.argumentos[0]); if (cmd.argumentos[1].StartsWith('!')) { timerT.command = listaComandos.Find(x => x.Key.Equals(cmd.argumentos[1])); } else { timerT.value = cmd.Value.Substring(cmd.argumentos[0].Length + 1); } timerT.aTimer.Interval = timerT.Time * 60000; timerT.aTimer.Elapsed += (sender, e) => { OnTimePass(timerT); }; timerT.aTimer.Enabled = true; timerT.Channel = Channel; listaTimers.Add(timerT); List <MessageAlias> mensages = obternetTimers <MessageAlias>(); mensages.Add(timer); escribirListaTimers(mensages); }