Flowerreaction renamed to reaction. It will use your CurrencySign, instead of flower.
This commit is contained in:
parent
acccfbd960
commit
64523b95e6
@ -6,7 +6,7 @@ namespace NadekoBot.Common.Attributes
|
|||||||
{
|
{
|
||||||
public class NadekoCommand : CommandAttribute
|
public class NadekoCommand : CommandAttribute
|
||||||
{
|
{
|
||||||
public NadekoCommand([CallerMemberName] string memberName="") : base(Localization.LoadCommand(memberName.ToLowerInvariant()).Cmd)
|
public NadekoCommand([CallerMemberName] string memberName="") : base(Localization.LoadCommand(memberName.ToLowerInvariant()).Cmd.Split(' ')[0])
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ using NadekoBot.Common.Collections;
|
|||||||
using NLog;
|
using NLog;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using NadekoBot.Services.Database.Models;
|
||||||
|
|
||||||
namespace NadekoBot.Modules.Gambling
|
namespace NadekoBot.Modules.Gambling
|
||||||
{
|
{
|
||||||
@ -23,7 +24,7 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
{
|
{
|
||||||
public enum CurrencyEvent
|
public enum CurrencyEvent
|
||||||
{
|
{
|
||||||
FlowerReaction,
|
Reaction,
|
||||||
SneakyGameStatus
|
SneakyGameStatus
|
||||||
}
|
}
|
||||||
//flower reaction event
|
//flower reaction event
|
||||||
@ -54,8 +55,8 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
{
|
{
|
||||||
switch (e)
|
switch (e)
|
||||||
{
|
{
|
||||||
case CurrencyEvent.FlowerReaction:
|
case CurrencyEvent.Reaction:
|
||||||
await FlowerReactionEvent(Context, arg).ConfigureAwait(false);
|
await reactionEvent(Context, arg).ConfigureAwait(false);
|
||||||
break;
|
break;
|
||||||
case CurrencyEvent.SneakyGameStatus:
|
case CurrencyEvent.SneakyGameStatus:
|
||||||
await SneakyGameStatusEvent(Context, arg).ConfigureAwait(false);
|
await SneakyGameStatusEvent(Context, arg).ConfigureAwait(false);
|
||||||
@ -127,19 +128,19 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task FlowerReactionEvent(ICommandContext context, int amount)
|
public async Task reactionEvent(ICommandContext context, int amount)
|
||||||
{
|
{
|
||||||
if (amount <= 0)
|
if (amount <= 0)
|
||||||
amount = 100;
|
amount = 100;
|
||||||
|
|
||||||
var title = GetText("flowerreaction_title");
|
var title = GetText("reaction_title");
|
||||||
var desc = GetText("flowerreaction_desc", "🌸", Format.Bold(amount.ToString()) + _bc.BotConfig.CurrencySign);
|
var desc = GetText("reaction_desc", _bc.BotConfig.CurrencySign, Format.Bold(amount.ToString()) + _bc.BotConfig.CurrencySign);
|
||||||
var footer = GetText("flowerreaction_footer", 24);
|
var footer = GetText("reaction_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(_client, _cs, amount).Start(msg, context);
|
await new ReactionEvent(_bc.BotConfig, _client, _cs, amount).Start(msg, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -149,9 +150,10 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
public abstract Task Start(IUserMessage msg, ICommandContext channel);
|
public abstract Task Start(IUserMessage msg, ICommandContext channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class FlowerReactionEvent : CurrencyEvent
|
public class ReactionEvent : CurrencyEvent
|
||||||
{
|
{
|
||||||
private readonly ConcurrentHashSet<ulong> _flowerReactionAwardedUsers = new ConcurrentHashSet<ulong>();
|
private readonly ConcurrentHashSet<ulong> _reactionAwardedUsers = new ConcurrentHashSet<ulong>();
|
||||||
|
private readonly BotConfig _bc;
|
||||||
private readonly Logger _log;
|
private readonly Logger _log;
|
||||||
private readonly DiscordSocketClient _client;
|
private readonly DiscordSocketClient _client;
|
||||||
private readonly CurrencyService _cs;
|
private readonly CurrencyService _cs;
|
||||||
@ -165,8 +167,9 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
private readonly ConcurrentQueue<ulong> _toGiveTo = new ConcurrentQueue<ulong>();
|
private readonly ConcurrentQueue<ulong> _toGiveTo = new ConcurrentQueue<ulong>();
|
||||||
private readonly int _amount;
|
private readonly int _amount;
|
||||||
|
|
||||||
public FlowerReactionEvent(DiscordSocketClient client, CurrencyService cs, int amount)
|
public ReactionEvent(BotConfig bc, DiscordSocketClient client, CurrencyService cs, int amount)
|
||||||
{
|
{
|
||||||
|
_bc = bc;
|
||||||
_log = LogManager.GetCurrentClassLogger();
|
_log = LogManager.GetCurrentClassLogger();
|
||||||
_client = client;
|
_client = client;
|
||||||
_cs = cs;
|
_cs = cs;
|
||||||
@ -223,10 +226,17 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
StartingMessage = umsg;
|
StartingMessage = umsg;
|
||||||
_client.MessageDeleted += MessageDeletedEventHandler;
|
_client.MessageDeleted += MessageDeletedEventHandler;
|
||||||
|
|
||||||
try { await StartingMessage.AddReactionAsync(new Emoji("🌸")).ConfigureAwait(false); }
|
IEmote iemote;
|
||||||
|
if (Emote.TryParse(_bc.CurrencySign, out var emote))
|
||||||
|
{
|
||||||
|
iemote = emote;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
iemote = new Emoji(_bc.CurrencySign);
|
||||||
|
try { await StartingMessage.AddReactionAsync(iemote).ConfigureAwait(false); }
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
try { await StartingMessage.AddReactionAsync(new Emoji("🌸")).ConfigureAwait(false); }
|
try { await StartingMessage.AddReactionAsync(iemote).ConfigureAwait(false); }
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
try { await StartingMessage.DeleteAsync().ConfigureAwait(false); }
|
try { await StartingMessage.DeleteAsync().ConfigureAwait(false); }
|
||||||
@ -240,7 +250,7 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
if (r.UserId == _botUser.Id)
|
if (r.UserId == _botUser.Id)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (r.Emote.Name == "🌸" && r.User.IsSpecified && ((DateTime.UtcNow - r.User.Value.CreatedAt).TotalDays > 5) && _flowerReactionAwardedUsers.Add(r.User.Value.Id))
|
if (r.Emote.Name == iemote.Name && r.User.IsSpecified && ((DateTime.UtcNow - r.User.Value.CreatedAt).TotalDays > 5) && _reactionAwardedUsers.Add(r.User.Value.Id))
|
||||||
{
|
{
|
||||||
_toGiveTo.Enqueue(r.UserId);
|
_toGiveTo.Enqueue(r.UserId);
|
||||||
}
|
}
|
||||||
|
@ -240,9 +240,9 @@
|
|||||||
"gambling_flipped": "flipped {0}.",
|
"gambling_flipped": "flipped {0}.",
|
||||||
"gambling_flip_guess": "You guessed it! You won {0}",
|
"gambling_flip_guess": "You guessed it! You won {0}",
|
||||||
"gambling_flip_invalid": "Invalid number specified. You can flip 1 to {0} coins.",
|
"gambling_flip_invalid": "Invalid number specified. You can flip 1 to {0} coins.",
|
||||||
"gambling_flowerreaction_desc": "Add {0} reaction to this message to get {1} ",
|
"gambling_reaction_desc": "Add {0} reaction to this message to get {1} ",
|
||||||
"gambling_flowerreaction_footer": "This event is active for up to {0} hours.",
|
"gambling_reaction_footer": "This event is active for up to {0} hours.",
|
||||||
"gambling_flowerreaction_title": "Flower reaction event started!",
|
"gambling_reaction_title": "Reaction event started!",
|
||||||
"gambling_gifted": "has gifted {0} to {1}",
|
"gambling_gifted": "has gifted {0} to {1}",
|
||||||
"gambling_has": "{0} has {1}",
|
"gambling_has": "{0} has {1}",
|
||||||
"gambling_heads": "Head",
|
"gambling_heads": "Head",
|
||||||
|
@ -1431,7 +1431,7 @@
|
|||||||
},
|
},
|
||||||
"heal": {
|
"heal": {
|
||||||
"Cmd": "heal",
|
"Cmd": "heal",
|
||||||
"Desc": "Heals someone. Revives those who fainted. Costs a NadekoFlower. ",
|
"Desc": "Heals someone. Revives those who fainted. Costs one Currency. ",
|
||||||
"Usage": "`{0}heal @someone`"
|
"Usage": "`{0}heal @someone`"
|
||||||
},
|
},
|
||||||
"movelist": {
|
"movelist": {
|
||||||
@ -1441,7 +1441,7 @@
|
|||||||
},
|
},
|
||||||
"settype": {
|
"settype": {
|
||||||
"Cmd": "settype",
|
"Cmd": "settype",
|
||||||
"Desc": "Set your poketype. Costs a NadekoFlower. Provide no arguments to see a list of available types.",
|
"Desc": "Set your poketype. Costs one Currency. Provide no arguments to see a list of available types.",
|
||||||
"Usage": "`{0}settype fire` or `{0}settype`"
|
"Usage": "`{0}settype fire` or `{0}settype`"
|
||||||
},
|
},
|
||||||
"type": {
|
"type": {
|
||||||
@ -1576,8 +1576,8 @@
|
|||||||
},
|
},
|
||||||
"startevent": {
|
"startevent": {
|
||||||
"Cmd": "startevent",
|
"Cmd": "startevent",
|
||||||
"Desc": "Starts one of the events seen on public nadeko.",
|
"Desc": "Starts one of the events seen on public nadeko. `reaction` and `sneakygamestatus` are the only 2 available now.",
|
||||||
"Usage": "`{0}startevent flowerreaction`"
|
"Usage": "`{0}startevent reaction`"
|
||||||
},
|
},
|
||||||
"slotstats": {
|
"slotstats": {
|
||||||
"Cmd": "slotstats",
|
"Cmd": "slotstats",
|
||||||
|
Loading…
Reference in New Issue
Block a user