예제 #1
0
        public async Task Info()
        {
            var server = RssFeeds.FirstOrDefault(x => x.GuildId == Context.Guild.Id);

            if (server == null)
            {
                await Initialise();

                return;
            }

            await ReplyAsync("", false, new EmbedBuilder
            {
                Description = $"**RSS URL**\n" +
                              $"{server.RssUrl}\n" +
                              $"**RSS Channel**\n" +
                              $"{(await Context.Guild.GetChannelAsync(server.ChannelId))?.Name}\n" +
                              $"**RSS Formatting**\n" +
                              $"```\n" +
                              $"{server.Formatting}\n" +
                              $"```\n" +
                              $"**RSS Feed Status (running)**\n" +
                              $"{server.Running}",
                Color = Color.Blue
            });
        }
예제 #2
0
        public async Task Dupe()
        {
            var server = RssFeeds.FirstOrDefault(x => x.GuildId == Context.Guild.Id);

            if (server == null)
            {
                await Initialise();

                return;
            }

            server.RemoveDuplicates = !server.RemoveDuplicates;

            if (RssFeeds != null)
            {
                var feeds = JsonConvert.SerializeObject(RssFeeds, Newtonsoft.Json.Formatting.Indented);
                File.WriteAllText(Path.Combine(AppContext.BaseDirectory, "setup/RSS.json"), feeds);
            }

            await ReplyAsync("", false, new EmbedBuilder
            {
                Description = $"Duplicates are removed: {server.RemoveDuplicates}",
                Color       = Color.Blue
            });
        }
예제 #3
0
        public async Task Bdel(string input)
        {
            var server = RssFeeds.FirstOrDefault(x => x.GuildId == Context.Guild.Id);

            if (server == null)
            {
                await Initialise();

                return;
            }

            server.BlacklistedWords.Remove(input);

            if (RssFeeds != null)
            {
                var feeds = JsonConvert.SerializeObject(RssFeeds, Newtonsoft.Json.Formatting.Indented);
                File.WriteAllText(Path.Combine(AppContext.BaseDirectory, "setup/RSS.json"), feeds);
            }

            await ReplyAsync("", false, new EmbedBuilder
            {
                Description = $"**Blacklisted Words/Phrases:** \n" +
                              $"{string.Join(", ", server.BlacklistedWords)}",
                Color = Color.Blue
            });
        }
예제 #4
0
        public async Task Rss([Remainder] string url)
        {
            var server = RssFeeds.FirstOrDefault(x => x.GuildId == Context.Guild.Id);

            if (server == null)
            {
                await Initialise();

                return;
            }

            server.RssUrl = url;

            await ReplyAsync("", false, new EmbedBuilder
            {
                Description = $"RSS URL Will now be set to {url}",
                Color       = Color.Blue
            });

            if (RssFeeds != null)
            {
                var feeds = JsonConvert.SerializeObject(RssFeeds, Newtonsoft.Json.Formatting.Indented);
                File.WriteAllText(Path.Combine(AppContext.BaseDirectory, "setup/RSS.json"), feeds);
            }
        }
예제 #5
0
        public async Task RssChannel()
        {
            var server = RssFeeds.FirstOrDefault(x => x.GuildId == Context.Guild.Id);

            if (server == null)
            {
                await Initialise();

                return;
            }
            server.ChannelId = Context.Channel.Id;

            await ReplyAsync("", false, new EmbedBuilder
            {
                Description = $"RSS Updates will now be posted in {Context.Channel.Name}",
                Color       = Color.Blue
            });

            if (RssFeeds != null)
            {
                var feeds = JsonConvert.SerializeObject(RssFeeds, Newtonsoft.Json.Formatting.Indented);
                File.WriteAllText(Path.Combine(AppContext.BaseDirectory, "setup/RSS.json"), feeds);
            }
        }