Пример #1
0
		private static void HandleUserXpLevel(UserAccount account, SocketCommandContext context, DateTime now)
		{
			if (!(now.Subtract(account.LastLevelUpTime).TotalSeconds >=
			      Config.bot.LevelUpCooldown)) return;

			//Give the user the XP
			LevelingSystem.GiveUserXp((SocketGuildUser) context.User,
				(SocketTextChannel) context.Channel, Config.bot.LevelUpAmount);

			//Set the user's last level up time to now
			account.LastLevelUpTime = now;
		}
Пример #2
0
		private static void HandleUserPointsLevel(UserAccountServerData account, ServerList server,
			SocketCommandContext context, DateTime now)
		{
			//Server points
			if (!(now.Subtract(account.LastServerPointsTime).TotalSeconds >=
			      server.PointsGiveCooldownTime)) return;

			LevelingSystem.GiveUserServerPoints((SocketGuildUser) context.User,
				(SocketTextChannel) context.Channel, server.PointGiveAmount);

			//No need to save since this variable has a JsonIgnore attribute
			account.LastServerPointsTime = now;
		}