Fixed raffle
This commit is contained in:
parent
e7b6f110a3
commit
57a2caef84
@ -30,7 +30,7 @@ namespace NadekoBot.Modules.Administration
|
||||
{
|
||||
var channel = imsg.Channel as ITextChannel;
|
||||
|
||||
if (channel == null || await imsg.IsAuthor(_client))
|
||||
if (channel == null || await imsg.IsAuthor())
|
||||
return;
|
||||
ConcurrentDictionary<ulong, DateTime> userTimePair;
|
||||
if (!RatelimitingChannels.TryGetValue(channel.Id, out userTimePair)) return;
|
||||
|
@ -196,7 +196,7 @@ namespace NadekoBot.Modules.Gambling
|
||||
|
||||
private async Task Client_MessageReceived(IMessage imsg)
|
||||
{
|
||||
if (await imsg.IsAuthor(NadekoBot.Client) || !(imsg.Channel is ITextChannel) || imsg.Channel != raceChannel)
|
||||
if (await imsg.IsAuthor() || !(imsg.Channel is ITextChannel) || imsg.Channel != raceChannel)
|
||||
return;
|
||||
messagesSinceGameStarted++;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ namespace NadekoBot.Modules.Gambling
|
||||
|
||||
role = role ?? channel.Guild.EveryoneRole;
|
||||
|
||||
var members = (await role.Members()).Where(u => u.Status == UserStatus.Online);
|
||||
var members = role.Members().Where(u => u.Status == UserStatus.Online);
|
||||
var membersArray = members as IUser[] ?? members.ToArray();
|
||||
var usr = membersArray[new Random().Next(0, membersArray.Length)];
|
||||
await channel.SendMessageAsync($"**Raffled user:** {usr.Username} (id: {usr.Id})").ConfigureAwait(false);
|
||||
|
@ -26,11 +26,11 @@ namespace NadekoBot.Extensions
|
||||
public static async Task<IMessage> Reply(this IMessage msg, string content) =>
|
||||
await msg.Channel.SendMessageAsync(content).ConfigureAwait(false);
|
||||
|
||||
public static Task<bool> IsAuthor(this IMessage msg, DiscordSocketClient client) =>
|
||||
Task.FromResult(client.GetCurrentUser().Id == msg.Author.Id);
|
||||
public static Task<bool> IsAuthor(this IMessage msg) =>
|
||||
Task.FromResult(NadekoBot.Client.GetCurrentUser().Id == msg.Author.Id);
|
||||
|
||||
public static async Task<IEnumerable<IUser>> Members(this IRole role) =>
|
||||
await role.Members();
|
||||
public static IEnumerable<IUser> Members(this IRole role) =>
|
||||
NadekoBot.Client.GetGuilds().Where(g => g.Id == role.GuildId).FirstOrDefault()?.GetUsers().Where(u => u.Roles.Contains(role)) ?? Enumerable.Empty<IUser>();
|
||||
|
||||
public static async Task<IMessage[]> ReplyLong(this IMessage msg, string content, string breakOn = "\n", string addToEnd = "", string addToStart = "")
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user