Ejemplo n.º 1
0
		public void JoinLotteryCommand(CommandEvent info)
		{
			if (CurrentLottery == null)
			{
				info.User.Whisper(info.Channel, $"There is no lottery right now :(");
			}
			else
			{
				if (!CurrentLottery.Participants.Contains(info.User))
				{
					try
					{
						CurrentLottery.Join(info.User);
					}
					catch (LotteryException ex)
					{
						Console.WriteLine(ex.ToString());
						return;
					}
					info.Channel.Announce($"New lottery participant: (@{info.User.Name})");
				}
			}
		}
Ejemplo n.º 2
0
		public void RunCommand(CommandEvent command)
		{
			Verify.NotNull(command, "command");
			if (!_handlers.ContainsKey(command.CommandName))
			{
				return;
			}
			foreach (KeyValuePair<object, MethodInfo> handler in _handlers[command.CommandName])
			{
				var owner = handler.Key;
				var function = handler.Value;
				function.Invoke(owner, new object[] { command });
			}
		}
Ejemplo n.º 3
0
		public void StartLotteryCommand(CommandEvent info)
		{
			if (CurrentLottery == null)
			{
				CreateLottery();
				CurrentLottery.Pot = 1000;
				CurrentLottery.Duration = TimeSpan.FromMinutes(1);
				CurrentLottery.Start(info.Channel);
				info.Channel.Announce("A new lottery has been started. You have 1 minute to type !joinlottery to participate :D");
			}
			else
			{
				info.User.Whisper(info.Channel, "A lottery is already running");
			}
		}