mirror of
				https://gitlab.com/Kwoth/nadekobot.git
				synced 2025-11-03 16:24:27 -05:00 
			
		
		
		
	Added .youtubeuploadnotif / .yun as a shortcut to a subscribing channel's rss feed
This commit is contained in:
		@@ -7,6 +7,7 @@ Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.
 | 
			
		||||
### Added
 | 
			
		||||
 | 
			
		||||
- Added `.massban` to ban multiple people at once. 30 second cooldown
 | 
			
		||||
- Added `.youtubeuploadnotif` / `.yun` as a shortcut to a subscribing channel's rss feed
 | 
			
		||||
 | 
			
		||||
### Changed
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -5,6 +5,7 @@ using NadekoBot.Extensions;
 | 
			
		||||
using NadekoBot.Modules.Searches.Services;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text.RegularExpressions;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Serilog;
 | 
			
		||||
 | 
			
		||||
@@ -15,6 +16,25 @@ namespace NadekoBot.Modules.Searches
 | 
			
		||||
        [Group]
 | 
			
		||||
        public class FeedCommands : NadekoSubmodule<FeedsService>
 | 
			
		||||
        {
 | 
			
		||||
            private static readonly Regex YtChannelRegex =
 | 
			
		||||
                new Regex(@"youtube\.com\/(?:c\/|channel\/|user\/)?(?<channelid>[a-zA-Z0-9\-]{1,})");
 | 
			
		||||
            
 | 
			
		||||
            [NadekoCommand, Aliases]
 | 
			
		||||
            [RequireContext(ContextType.Guild)]
 | 
			
		||||
            [UserPerm(GuildPerm.ManageMessages)]
 | 
			
		||||
            public Task YtUploadNotif(string url, [Leftover] ITextChannel channel = null)
 | 
			
		||||
            {
 | 
			
		||||
                var m = YtChannelRegex.Match(url);
 | 
			
		||||
                if (!m.Success)
 | 
			
		||||
                {
 | 
			
		||||
                    return ReplyErrorLocalizedAsync(strs.invalid_input);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                var channelId = m.Groups["channelid"].Value;
 | 
			
		||||
 | 
			
		||||
                return Feed("https://www.youtube.com/feeds/videos.xml?channel_id=" + channelId, channel);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            [NadekoCommand, Aliases]
 | 
			
		||||
            [RequireContext(ContextType.Guild)]
 | 
			
		||||
            [UserPerm(GuildPerm.ManageMessages)]
 | 
			
		||||
 
 | 
			
		||||
@@ -1140,6 +1140,9 @@ autobutts:
 | 
			
		||||
eightball:
 | 
			
		||||
- eightball
 | 
			
		||||
- 8ball
 | 
			
		||||
ytuploadnotif:
 | 
			
		||||
- ytuploadnotif
 | 
			
		||||
- yun
 | 
			
		||||
feed:
 | 
			
		||||
- feed
 | 
			
		||||
- feedadd
 | 
			
		||||
 
 | 
			
		||||
@@ -1912,6 +1912,12 @@ eightball:
 | 
			
		||||
  desc: "Ask the 8ball a yes/no question."
 | 
			
		||||
  args:
 | 
			
		||||
    - "Is b1nzy a nice guy?"
 | 
			
		||||
youtubeuploadnotif:
 | 
			
		||||
  desc: |-
 | 
			
		||||
    Subscribe to a youtube channel's upload rss feed.
 | 
			
		||||
    Shortcut for `.feed https://www.youtube.com/feeds/videos.xml?channel_id=%3Cyoutube_channel_id`
 | 
			
		||||
  args:
 | 
			
		||||
    - "https://www.youtube.com/channel/UCSJ4gkVC6NrvII8umztf0Ow"
 | 
			
		||||
feed:
 | 
			
		||||
  desc: "Subscribes to a feed. Bot will post an update up to once every 10 seconds. You can have up to 10 feeds on one server. All feeds must have unique URLs. Set a channel as a second optional parameter to specify where to send the updates."
 | 
			
		||||
  args:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user