Slight change to how cash works
This commit is contained in:
parent
23b0571f62
commit
2c4eb8e104
@ -9,6 +9,7 @@ using NadekoBot.Services;
|
|||||||
using Discord.WebSocket;
|
using Discord.WebSocket;
|
||||||
using NadekoBot.Services.Database.Models;
|
using NadekoBot.Services.Database.Models;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using NadekoBot.Services.Database;
|
||||||
|
|
||||||
namespace NadekoBot.Modules.Gambling
|
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]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
public async Task Raffle(IUserMessage umsg, [Remainder] IRole role = null)
|
public async Task Raffle(IUserMessage umsg, [Remainder] IRole role = null)
|
||||||
@ -52,15 +61,8 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
var channel = umsg.Channel;
|
var channel = umsg.Channel;
|
||||||
|
|
||||||
user = user ?? umsg.Author;
|
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]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
@ -69,15 +71,7 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
{
|
{
|
||||||
var channel = umsg.Channel;
|
var channel = umsg.Channel;
|
||||||
|
|
||||||
long amount;
|
await channel.SendMessageAsync($"`{userId}` has {GetCurrency(userId)} {CurrencySign}").ConfigureAwait(false);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
|
@ -47,7 +47,8 @@
|
|||||||
"System.Xml.XPath": "4.3.0"
|
"System.Xml.XPath": "4.3.0"
|
||||||
},
|
},
|
||||||
"tools": {
|
"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": {
|
"frameworks": {
|
||||||
"netcoreapp1.0": {
|
"netcoreapp1.0": {
|
||||||
|
Loading…
Reference in New Issue
Block a user