Merge pull request #10 from Kwoth/dev

update
This commit is contained in:
samvaio 2016-11-26 22:05:07 +05:30 committed by GitHub
commit a02ace3165
2 changed files with 13 additions and 18 deletions

View File

@ -9,6 +9,7 @@ using NadekoBot.Services;
using Discord.WebSocket;
using NadekoBot.Services.Database.Models;
using System.Collections.Generic;
using NadekoBot.Services.Database;
namespace NadekoBot.Modules.Gambling
{
@ -31,6 +32,14 @@ namespace NadekoBot.Modules.Gambling
}
}
public static long GetCurrency(ulong id)
{
using (var uow = DbHandler.UnitOfWork())
{
return uow.Currency.GetUserCurrency(id);
}
}
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
public async Task Raffle(IUserMessage umsg, [Remainder] IRole role = null)
@ -52,15 +61,8 @@ namespace NadekoBot.Modules.Gambling
var channel = umsg.Channel;
user = user ?? umsg.Author;
long amount;
BotConfig config;
using (var uow = DbHandler.UnitOfWork())
{
amount = uow.Currency.GetUserCurrency(user.Id);
config = uow.BotConfig.GetOrCreate();
}
await channel.SendMessageAsync($"{user.Username} has {amount} {config.CurrencySign}").ConfigureAwait(false);
await channel.SendMessageAsync($"{user.Username} has {GetCurrency(user.Id)} {CurrencySign}").ConfigureAwait(false);
}
[NadekoCommand, Usage, Description, Aliases]
@ -69,15 +71,7 @@ namespace NadekoBot.Modules.Gambling
{
var channel = umsg.Channel;
long amount;
BotConfig config;
using (var uow = DbHandler.UnitOfWork())
{
amount = uow.Currency.GetUserCurrency(userId);
config = uow.BotConfig.GetOrCreate();
}
await channel.SendMessageAsync($"`{userId}` has {amount} {config.CurrencySign}").ConfigureAwait(false);
await channel.SendMessageAsync($"`{userId}` has {GetCurrency(userId)} {CurrencySign}").ConfigureAwait(false);
}
[NadekoCommand, Usage, Description, Aliases]

View File

@ -47,7 +47,8 @@
"System.Xml.XPath": "4.3.0"
},
"tools": {
"Microsoft.EntityFrameworkCore.Tools.DotNet": "1.1.0-preview4-final"
"Microsoft.EntityFrameworkCore.Tools.DotNet": "1.1.0-preview4-final",
"Microsoft.DotNet.Watcher.Tools": "1.1.0-preview4-final"
},
"frameworks": {
"netcoreapp1.0": {