From 93118f69f8dd86a33b11d417597eb77383cc1262 Mon Sep 17 00:00:00 2001 From: Lan <50151341+Lannnnnnnnn@users.noreply.github.com> Date: Thu, 9 Apr 2020 22:21:56 +0300 Subject: [PATCH] added stats command --- Kehyeedra3/Commands/Economy.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Kehyeedra3/Commands/Economy.cs b/Kehyeedra3/Commands/Economy.cs index 1701455..eadabc7 100644 --- a/Kehyeedra3/Commands/Economy.cs +++ b/Kehyeedra3/Commands/Economy.cs @@ -2,6 +2,7 @@ using Discord.Addons.Interactive; using Discord.Commands; using Kehyeedra3.Services.Models; +using Microsoft.EntityFrameworkCore.Storage; using System; using System.Collections.Generic; using System.Linq; @@ -968,5 +969,24 @@ namespace Kehyeedra3.Commands } } + [Command("stats"),Summary("View a user's stats")] + public async Task FishProfile(IUser otherUser = null) + { + using (var database = new ApplicationDbContextFactory().CreateDbContext()) + { + if (otherUser == null) + { + var user = database.Fishing.FirstOrDefault(x => x.Id == Context.User.Id); + var muser = database.Users.FirstOrDefault(x => x.Id == Context.User.Id); + await Context.Channel.SendMessageAsync($"{Context.User.Mention}'s stats\nFishing level: **{user.Lvl}**\nFishing xp: **{user.TXp}**\nBalance: **{muser.Money/10000d}%**"); + } + else + { + var user = database.Fishing.FirstOrDefault(x => x.Id == otherUser.Id); + var muser = database.Users.FirstOrDefault(x => x.Id == otherUser.Id); + await Context.Channel.SendMessageAsync($"{otherUser.Mention}'s stats\nFishing level: **{user.Lvl}**\nFishing xp: **{user.TXp}**\nBalance: **{muser.Money/10000d}%**"); + } + } + } } }