$$$ is smarter, $startevent flowerreaction X - x is number of flowers to award

This commit is contained in:
Kwoth 2017-02-17 14:53:13 +01:00
parent 9f69532d7b
commit eeb9ff9370
2 changed files with 14 additions and 9 deletions

View File

@ -43,7 +43,7 @@ namespace NadekoBot.Modules.Gambling
switch (e) switch (e)
{ {
case CurrencyEvent.FlowerReaction: case CurrencyEvent.FlowerReaction:
await FlowerReactionEvent(Context).ConfigureAwait(false); await FlowerReactionEvent(Context, arg).ConfigureAwait(false);
break; break;
case CurrencyEvent.SneakyGameStatus: case CurrencyEvent.SneakyGameStatus:
await SneakyGameStatusEvent(Context, arg).ConfigureAwait(false); await SneakyGameStatusEvent(Context, arg).ConfigureAwait(false);
@ -115,23 +115,26 @@ namespace NadekoBot.Modules.Gambling
return Task.Delay(0); return Task.Delay(0);
} }
public async Task FlowerReactionEvent(CommandContext context) public async Task FlowerReactionEvent(CommandContext context, int amount)
{ {
if (amount <= 0)
amount = 100;
var title = GetText("flowerreaction_title"); var title = GetText("flowerreaction_title");
var desc = GetText("flowerreaction_desc", "🌸", Format.Bold(100.ToString()) + CurrencySign); var desc = GetText("flowerreaction_desc", "🌸", Format.Bold(amount.ToString()) + CurrencySign);
var footer = GetText("flowerreaction_footer", 24); var footer = GetText("flowerreaction_footer", 24);
var msg = await context.Channel.SendConfirmAsync(title, var msg = await context.Channel.SendConfirmAsync(title,
desc, footer: footer) desc, footer: footer)
.ConfigureAwait(false); .ConfigureAwait(false);
await new FlowerReactionEvent().Start(msg, context); await new FlowerReactionEvent().Start(msg, context, amount);
} }
} }
} }
public abstract class CurrencyEvent public abstract class CurrencyEvent
{ {
public abstract Task Start(IUserMessage msg, CommandContext channel); public abstract Task Start(IUserMessage msg, CommandContext channel, int amount);
} }
public class FlowerReactionEvent : CurrencyEvent public class FlowerReactionEvent : CurrencyEvent
@ -172,7 +175,7 @@ namespace NadekoBot.Modules.Gambling
return Task.CompletedTask; return Task.CompletedTask;
} }
public override async Task Start(IUserMessage umsg, CommandContext context) public override async Task Start(IUserMessage umsg, CommandContext context, int amount)
{ {
msg = umsg; msg = umsg;
NadekoBot.Client.MessageDeleted += MessageDeletedEventHandler; NadekoBot.Client.MessageDeleted += MessageDeletedEventHandler;
@ -193,7 +196,7 @@ namespace NadekoBot.Modules.Gambling
{ {
if (r.Emoji.Name == "🌸" && r.User.IsSpecified && ((DateTime.UtcNow - r.User.Value.CreatedAt).TotalDays > 5) && _flowerReactionAwardedUsers.Add(r.User.Value.Id)) if (r.Emoji.Name == "🌸" && r.User.IsSpecified && ((DateTime.UtcNow - r.User.Value.CreatedAt).TotalDays > 5) && _flowerReactionAwardedUsers.Add(r.User.Value.Id))
{ {
await CurrencyHandler.AddCurrencyAsync(r.User.Value, "Flower Reaction Event", 100, false) await CurrencyHandler.AddCurrencyAsync(r.User.Value, "Flower Reaction Event", amount, false)
.ConfigureAwait(false); .ConfigureAwait(false);
} }
} }

View File

@ -49,8 +49,10 @@ namespace NadekoBot.Modules.Gambling
[Priority(0)] [Priority(0)]
public async Task Cash([Remainder] IUser user = null) public async Task Cash([Remainder] IUser user = null)
{ {
user = user ?? Context.User; if(user == null)
await ReplyConfirmLocalized("has", Format.Bold(user.ToString()), $"{GetCurrency(user.Id)} {CurrencySign}").ConfigureAwait(false); await ConfirmLocalized("has", Format.Bold(Context.User.ToString()), $"{GetCurrency(Context.User.Id)} {CurrencySign}").ConfigureAwait(false);
else
await ReplyConfirmLocalized("has", Format.Bold(user.ToString()), $"{GetCurrency(user.Id)} {CurrencySign}").ConfigureAwait(false);
} }
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]