diff --git a/NadekoBot.Core/Modules/Gambling/Gambling.cs b/NadekoBot.Core/Modules/Gambling/Gambling.cs index 11e79fef..9defa74f 100644 --- a/NadekoBot.Core/Modules/Gambling/Gambling.cs +++ b/NadekoBot.Core/Modules/Gambling/Gambling.cs @@ -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) diff --git a/src/NadekoBot/data/command_strings.json b/src/NadekoBot/data/command_strings.json index eff19a26..3b44ba3c 100644 --- a/src/NadekoBot/data/command_strings.json +++ b/src/NadekoBot/data/command_strings.json @@ -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.",