public static bool HasPins(this ISocketMessageChannel channel, out IReadOnlyCollection <RestMessage> pins) { pins = channel.GetPinnedMessagesAsync().Result; if (!pins.Funct()) { return(false); } return(true); }
public async Task ScrapeAsync(ISocketMessageChannel channel) { //TODO Rate limiting is a thing and f**k Discord IReadOnlyCollection <RestMessage> pinnedMessages = await channel.GetPinnedMessagesAsync(); await Program.Log( new LogMessage( LogSeverity.Debug, "Scrape", $"Number of pins: {pinnedMessages.Count}")); IEnumerable <Task <RestUserMessage> > sendMessageTasks = pinnedMessages .Select(message => Context.Message.Channel.SendMessageAsync(embed: GetEmbedFromMessage(message))); await Task.WhenAll(sendMessageTasks); }