public Task WmRssAsync(CommandContext ctx)
        {
            IReadOnlyList <SyndicationItem> res = RssService.GetFeedResults("http://worldmafia.net/forums/-/index.rss");

            if (res == null)
            {
                throw new CommandFailedException("An error occured while reaching WM forum. Possibly Pakistani didn't pay this month?");
            }

            return(RssService.SendFeedResultsAsync(ctx.Channel, res));
        }
Exemple #2
0
        public Task NewsRssAsync(CommandContext ctx)
        {
            IReadOnlyList <SyndicationItem> res = RssService.GetFeedResults("https://news.google.com/news/rss/headlines/section/topic/WORLD?ned=us&hl=en");

            if (res == null)
            {
                throw new CommandFailedException("Error getting world news.");
            }

            return(RssService.SendFeedResultsAsync(ctx.Channel, res));
        }
Exemple #3
0
        public Task NewsRssAsync(CommandContext ctx)
        {
            var res = RssService.GetFeedResults("");

            if (res is null)
            {
                throw new CommandFailedException("Error getting world news.");
            }

            return(RssService.SendFeedResultsAsync(ctx.Channel, res));
        }
Exemple #4
0
        public Task RssAsync(CommandContext ctx, [Description("RSS feed URL.")] Uri url)
        {
            if (!RssService.IsValidFeedUrl(url.AbsoluteUri))
            {
                throw new InvalidCommandUsageException("No results found for given URL (maybe forbidden?).");
            }

            var res = RssService.GetFeedResults(url.AbsoluteUri);

            if (res is null)
            {
                throw new CommandFailedException("Error getting feed from given URL.");
            }

            return(RssService.SendFeedResultsAsync(ctx.Channel, res));
        }
        public Task ExecuteGroupAsync(CommandContext ctx,
                                      [Description("RSS URL.")] Uri url)
        {
            if (!RssService.IsValidFeedURL(url.AbsoluteUri))
            {
                throw new InvalidCommandUsageException("No results found for given URL (maybe forbidden?).");
            }

            IReadOnlyList <SyndicationItem> res = RssService.GetFeedResults(url.AbsoluteUri);

            if (res == null)
            {
                throw new CommandFailedException("Error getting feed from given URL.");
            }

            return(RssService.SendFeedResultsAsync(ctx.Channel, res));
        }
Exemple #6
0
        private async Task SearchAndSendResultsAsync(CommandContext ctx, string sub, RedditCategory category)
        {
            string url = RedditService.GetFeedUrlForSubreddit(sub, category, out string rsub);

            if (url is null)
            {
                throw new CommandFailedException("That subreddit doesn't exist.");
            }

            var res = RssService.GetFeedResults(url);

            if (res is null)
            {
                throw new CommandFailedException($"Failed to get the data from that subreddit ({Formatter.Bold(rsub)}).");
            }

            await RssService.SendFeedResultsAsync(ctx.Channel, res);
        }
        public Task ExecuteGroupAsync(CommandContext ctx,
                                      [Description("Subreddit.")] string sub = "all")
        {
            string url = RssService.GetFeedURLForSubreddit(sub, out string rsub);

            if (url == null)
            {
                throw new CommandFailedException("That subreddit doesn't exist.");
            }

            IReadOnlyList <SyndicationItem> res = RssService.GetFeedResults(url);

            if (res == null)
            {
                throw new CommandFailedException($"Failed to get the data from that subreddit ({Formatter.Bold(rsub)}).");
            }

            return(RssService.SendFeedResultsAsync(ctx.Channel, res));
        }