public async Task Buy([Summary("Название контента")] string activeName) { IUser autor = Context.Message.Author; if (Core.It.UserList.All(x => x.Id != autor.Mention)) { User newUser = new User { Id = autor.Mention, Rating = 1, Money = 10000 }; Core.It.AddUser(newUser); } User currentUser = Core.It.UserList.First(x => x.Id == autor.Mention); Active active = Core.It.ActiveList.FirstOrDefault(x => x.Name == activeName); if (active == null) { await Context.Channel.SendMessageAsync(@"Контент с таким наименованием не найден"); return; } if (currentUser.Money < Common.Common.GetActiveRating(active)) { await Context.Channel.SendMessageAsync(@"На вашем счету недостаточно средств"); return; } await Context.Channel.SendMessageAsync(@"Контент был выслан личным сообщением"); double activeRating = Common.Common.GetActiveRating(active); Buy buy = new Buy { Id = Guid.NewGuid(), Active = active, Price = activeRating, Stamp = DateTime.Now, User = currentUser }; Core.It.AddBuy(buy); currentUser.Money -= activeRating; active.User.Money += activeRating; Core.It.Save(); IUserMessage message = await Context.User .SendMessageAsync($@"Текущий баланс - {currentUser.Money.ToString(@"C0")}"); await Context.User .SendMessageAsync($@"{active.Name} {active.Url}"); ReactInterface react = new ReactInterface(message, Context.User.Id, new [] { @"🔺", @"🔻" }); Action <bool> voteAction = async vote => { Note newNote = new Note { Active = active, Id = Guid.NewGuid(), User = currentUser, Value = vote ? 1 : -1 }; Core.It.AddNote(newNote); await Context.User.SendMessageAsync( $@"Спасибо за оценку! Контент был оценён {(vote ? "положительно" : "отрицательно") }. Текущий рейтинг контента {active.Name} - {Common.Common.GetActiveRating(active)}"); react.Dispose(); }; react.VotedEvent += voteAction; }