<commit_before>using System;
using System.Threading.Tasks;
using Discord;
using Mitternacht.Extensions;
using Mitternacht.Services.Database;
using Mitternacht.Services.Database.Models;

namespace Mitternacht.Services {
	public class CurrencyService : IMService {
		private readonly IBotConfigProvider _config;
		private readonly DbService          _db;

		public CurrencyService(IBotConfigProvider config, DbService db) {
			_config = config;
			_db     = db;
		}

		public Task<bool> RemoveAsync(IGuildUser author, string reason, long amount)
			=> RemoveAsync(author.GuildId, author.Id, reason, amount);

		public async Task<bool> RemoveAsync(ulong guildId, ulong authorId, string reason, long amount, IUnitOfWork uow = null) {
			if(amount < 0)
				throw new ArgumentNullException(nameof(amount));

			if(uow == null) {
				using var _uow = _db.UnitOfWork;
				var toReturn = InternalRemoveCurrency(guildId, authorId, reason, amount, _uow);
				await _uow.SaveChangesAsync().ConfigureAwait(false);

				return toReturn;
			} else {
				return InternalRemoveCurrency(guildId, authorId, reason, amount, uow);
			}
		}

		private bool InternalRemoveCurrency(ulong guildId, ulong authorId, string reason, long amount, IUnitOfWork uow) {
			var success = uow.Currency.TryAddCurrencyValue(guildId, authorId, -amount);
			
			if(success) {
				uow.CurrencyTransactions.Add(new CurrencyTransaction {
					GuildId = guildId,
					UserId  = authorId,<commit_msg>Remove unused field.<commit_after>using System;
using System.Threading.Tasks;
using Discord;
using Mitternacht.Services.Database;
using Mitternacht.Services.Database.Models;

namespace Mitternacht.Services {
	public class CurrencyService : IMService {
		private readonly DbService _db;

		public CurrencyService(DbService db) {
			_db = db;
		}

		public Task<bool> RemoveAsync(IGuildUser author, string reason, long amount)
			=> RemoveAsync(author.GuildId, author.Id, reason, amount);

		public async Task<bool> RemoveAsync(ulong guildId, ulong authorId, string reason, long amount, IUnitOfWork uow = null) {
			if(amount < 0)
				throw new ArgumentNullException(nameof(amount));

			if(uow == null) {
				using var _uow = _db.UnitOfWork;
				var toReturn = InternalRemoveCurrency(guildId, authorId, reason, amount, _uow);
				await _uow.SaveChangesAsync().ConfigureAwait(false);

				return toReturn;
			} else {
				return InternalRemoveCurrency(guildId, authorId, reason, amount, uow);
			}
		}

		private bool InternalRemoveCurrency(ulong guildId, ulong authorId, string reason, long amount, IUnitOfWork uow) {
			var success = uow.Currency.TryAddCurrencyValue(guildId, authorId, -amount);
			
			if(success) {
				uow.CurrencyTransactions.Add(new CurrencyTransaction {
					GuildId = guildId,
					UserId  = authorId,
{'fraction_non_alphanumeric': 0.09032025908600216, 'fraction_numerical': 0.0007196833393306944, 'mean_word_length': 4.53784860557769, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5892148', 'n_tokens_mistral': 973, 'n_tokens_neox': 856, 'n_words': 219}