You can .award to a role now, closes #681
This commit is contained in:
parent
2cafd17de9
commit
29b06567bd
@ -102,24 +102,46 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
public Task Award(IUserMessage umsg, long amount, [Remainder] IGuildUser usr) =>
|
[Priority(2)]
|
||||||
|
public Task Award(IUserMessage umsg, int amount, [Remainder] IGuildUser usr) =>
|
||||||
Award(umsg, amount, usr.Id);
|
Award(umsg, amount, usr.Id);
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
public async Task Award(IUserMessage umsg, long amount, [Remainder] ulong usrId)
|
[Priority(1)]
|
||||||
|
public async Task Award(IUserMessage umsg, int amount, ulong usrId)
|
||||||
{
|
{
|
||||||
var channel = (ITextChannel)umsg.Channel;
|
var channel = (ITextChannel)umsg.Channel;
|
||||||
|
|
||||||
if (amount <= 0)
|
if (amount <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
await CurrencyHandler.AddCurrencyAsync(usrId, $"Awarded by bot owner. ({umsg.Author.Username}/{umsg.Author.Id})", (int)amount).ConfigureAwait(false);
|
await CurrencyHandler.AddCurrencyAsync(usrId, $"Awarded by bot owner. ({umsg.Author.Username}/{umsg.Author.Id})", amount).ConfigureAwait(false);
|
||||||
|
|
||||||
await channel.SendMessageAsync($"{umsg.Author.Mention} successfully awarded {amount} {(amount == 1 ? Gambling.CurrencyName : Gambling.CurrencyPluralName)} to <@{usrId}>!").ConfigureAwait(false);
|
await channel.SendMessageAsync($"{umsg.Author.Mention} successfully awarded {amount} {(amount == 1 ? Gambling.CurrencyName : Gambling.CurrencyPluralName)} to <@{usrId}>!").ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
|
[RequireContext(ContextType.Guild)]
|
||||||
|
[OwnerOnly]
|
||||||
|
[Priority(0)]
|
||||||
|
public async Task Award(IUserMessage umsg, int amount, [Remainder] IRole role)
|
||||||
|
{
|
||||||
|
var channel = (ITextChannel)umsg.Channel;
|
||||||
|
var users = channel.Guild.GetUsers()
|
||||||
|
.Where(u => u.Roles.Contains(role))
|
||||||
|
.ToList();
|
||||||
|
await Task.WhenAll(users.Select(u => CurrencyHandler.AddCurrencyAsync(u.Id,
|
||||||
|
$"Awarded by bot owner to **{role.Name}** role. ({umsg.Author.Username}/{umsg.Author.Id})",
|
||||||
|
amount)))
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
|
await channel.SendMessageAsync($"Awarded `{amount}` {Gambling.CurrencyPluralName} to `{users.Count}` users from `{role.Name}` role.")
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
|
@ -555,7 +555,7 @@ namespace NadekoBot.Resources {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Awards someone a certain amount of currency. .
|
/// Looks up a localized string similar to Awards someone a certain amount of currency. You can also specify a role name to award currency to all users in a role..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string award_desc {
|
public static string award_desc {
|
||||||
get {
|
get {
|
||||||
@ -564,7 +564,7 @@ namespace NadekoBot.Resources {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to `{0}award 100 @person`.
|
/// Looks up a localized string similar to `{0}award 100 @person` or `{0}award 5 Role Of Gamblers`.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string award_usage {
|
public static string award_usage {
|
||||||
get {
|
get {
|
||||||
|
@ -1246,10 +1246,10 @@
|
|||||||
<value>award</value>
|
<value>award</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="award_desc" xml:space="preserve">
|
<data name="award_desc" xml:space="preserve">
|
||||||
<value>Awards someone a certain amount of currency. </value>
|
<value>Awards someone a certain amount of currency. You can also specify a role name to award currency to all users in a role.</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="award_usage" xml:space="preserve">
|
<data name="award_usage" xml:space="preserve">
|
||||||
<value>`{0}award 100 @person`</value>
|
<value>`{0}award 100 @person` or `{0}award 5 Role Of Gamblers`</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="take_cmd" xml:space="preserve">
|
<data name="take_cmd" xml:space="preserve">
|
||||||
<value>take</value>
|
<value>take</value>
|
||||||
|
Loading…
Reference in New Issue
Block a user