Added .raffleany - it will include users who are not online, too

This commit is contained in:
Master Kwoth 2017-11-09 08:49:24 +01:00
parent f6fccc5348
commit a39d136826
2 changed files with 25 additions and 1 deletions

View File

@ -107,6 +107,22 @@ namespace NadekoBot.Modules.Gambling
await Context.Channel.SendConfirmAsync("🎟 "+ GetText("raffled_user"), $"**{usr.Username}#{usr.Discriminator}**", footer: $"ID: {usr.Id}").ConfigureAwait(false);
}
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
public async Task RaffleAny([Remainder] IRole role = null)
{
role = role ?? Context.Guild.EveryoneRole;
var members = (await role.GetMembersAsync());
var membersArray = members as IUser[] ?? members.ToArray();
if (membersArray.Length == 0)
{
return;
}
var usr = membersArray[new NadekoRandom().Next(0, membersArray.Length)];
await Context.Channel.SendConfirmAsync("🎟 " + GetText("raffled_user"), $"**{usr.Username}#{usr.Discriminator}**", footer: $"ID: {usr.Id}").ConfigureAwait(false);
}
[NadekoCommand, Usage, Description, Aliases]
[Priority(1)]
public async Task Cash([Remainder] IUser user = null)

View File

@ -940,12 +940,20 @@
},
"raffle": {
"Cmd": "raffle",
"Desc": "Prints a name and ID of a random user from the online list from the (optional) role.",
"Desc": "Prints a name and ID of a random online user from the server, or from the online user in the specified role.",
"Usage": [
"{0}raffle",
"{0}raffle RoleName"
]
},
"raffleany": {
"Cmd": "raffleany",
"Desc": "Prints a name and ID of a random user from the server, or from the specified role.",
"Usage": [
"{0}raffleany",
"{0}raffleany RoleName"
]
},
"give": {
"Cmd": "give",
"Desc": "Give someone a certain amount of currency.",