Fixed $jr sucking money into the ether
This commit is contained in:
parent
7941dec165
commit
24dcbfb007
@ -46,13 +46,6 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
if (amount < 0)
|
if (amount < 0)
|
||||||
amount = 0;
|
amount = 0;
|
||||||
|
|
||||||
if (amount > 0)
|
|
||||||
if (!await CurrencyHandler.RemoveCurrencyAsync((IGuildUser)umsg.Author, "BetRace", amount, true).ConfigureAwait(false))
|
|
||||||
{
|
|
||||||
try { await channel.SendMessageAsync($"{umsg.Author.Mention} You don't have enough {Gambling.CurrencyName}s.").ConfigureAwait(false); } catch { }
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
AnimalRace ar;
|
AnimalRace ar;
|
||||||
if (!AnimalRaces.TryGetValue(channel.Guild.Id, out ar))
|
if (!AnimalRaces.TryGetValue(channel.Guild.Id, out ar))
|
||||||
@ -225,28 +218,33 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> JoinRace(IGuildUser u, int amount = 0)
|
public async Task JoinRace(IGuildUser u, int amount = 0)
|
||||||
{
|
{
|
||||||
var animal = "";
|
var animal = "";
|
||||||
if (!animals.TryDequeue(out animal))
|
if (!animals.TryDequeue(out animal))
|
||||||
{
|
{
|
||||||
await raceChannel.SendMessageAsync($"{u.Mention} `There is no running race on this server.`");
|
await raceChannel.SendMessageAsync($"{u.Mention} `There is no running race on this server.`");
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
var p = new Participant(u, animal, amount);
|
var p = new Participant(u, animal, amount);
|
||||||
if (participants.Contains(p))
|
if (participants.Contains(p))
|
||||||
{
|
{
|
||||||
await raceChannel.SendMessageAsync($"{u.Mention} `You already joined this race.`");
|
await raceChannel.SendMessageAsync($"{u.Mention} `You already joined this race.`");
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
if (Started)
|
if (Started)
|
||||||
{
|
{
|
||||||
await raceChannel.SendMessageAsync($"{u.Mention} `Race is already started`");
|
await raceChannel.SendMessageAsync($"{u.Mention} `Race is already started`");
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
if (amount > 0)
|
||||||
|
if (!await CurrencyHandler.RemoveCurrencyAsync((IGuildUser)u, "BetRace", amount, true).ConfigureAwait(false))
|
||||||
|
{
|
||||||
|
try { await raceChannel.SendMessageAsync($"{u.Mention} You don't have enough {Gambling.CurrencyName}s.").ConfigureAwait(false); } catch { }
|
||||||
|
return;
|
||||||
|
}
|
||||||
participants.Add(p);
|
participants.Add(p);
|
||||||
await raceChannel.SendMessageAsync($"{u.Mention} **joined the race as a {p.Animal}" + (amount > 0 ? $" and bet {amount} {(amount == 1? CurrencyName : CurrencyPluralName)}!**" : "**"));
|
await raceChannel.SendMessageAsync($"{u.Mention} **joined the race as a {p.Animal}" + (amount > 0 ? $" and bet {amount} {CurrencySign}!**" : "**"));
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user