1111import aiosqlite
1212
1313# Version number
14- VERSION = "1.0.8 "
14+ VERSION = "1.0.9 "
1515
1616# Initialize logging
1717logging .basicConfig (level = logging .INFO )
@@ -435,7 +435,7 @@ async def on_message(message):
435435 # Check if the feature is activated for the channel
436436 if channel_states .get (message .channel .id , True ):
437437 try :
438- link_pattern = r"https?://(?:www\.)?(twitter\.com/\w+/status/\d+|x\.com/\w+/status/\d+|tiktok\.com/@[^/]+/video/\d+|tiktok\.com/t/\w+|instagram\.com/(?:p|reel)/\w+|reddit\.com/r/\w+/comments/\w+/\w+)"
438+ link_pattern = r"https?://(?:www\.)?(twitter\.com/\w+/status/\d+|x\.com/\w+/status/\d+|tiktok\.com/@[^/]+/video/\d+|tiktok\.com/t/\w+|instagram\.com/(?:p|reel)/\w+|reddit\.com/r/\w+/comments/\w+/\w+|old\.reddit\.com/r/\w+/comments/\w+/\w+ )"
439439 matches = re .findall (link_pattern , message .content )
440440
441441 # Flag to check if a valid link is found
@@ -486,10 +486,10 @@ async def on_message(message):
486486 0 ] if user_match else "Unknown"
487487
488488 # Check and process Reddit links
489- elif 'reddit.com' in original_link :
489+ elif 'reddit.com' in original_link or 'old.reddit.com' in original_link :
490490 service = "Reddit"
491491 community_match = re .findall (
492- r"reddit\.com/r/(\w+)/comments" , original_link )
492+ r"(?: reddit\.com|old\.reddit\.com) /r/(\w+)/comments" , original_link )
493493 user_or_community = community_match [
494494 0 ] if community_match else "Unknown"
495495
@@ -500,8 +500,9 @@ async def on_message(message):
500500 modified_link = original_link .replace ("twitter.com" , "fxtwitter.com" )\
501501 .replace ("x.com" , "fixupx.com" )\
502502 .replace ("tiktok.com" , "vxtiktok.com" )\
503- .replace ("instagram.com" , "ddinstagram.com" )\
504- .replace ("reddit.com" , "rxddit.com" )
503+ .replace ("instagram.com" , "g.ddinstagram.com" )\
504+ .replace ("reddit.com" , "rxddit.com" )\
505+ .replace ("old.reddit.com" , "rxddit.com" )
505506 valid_link_found = True
506507
507508 # Send the formatted message and delete the original message if a valid link is found
@@ -516,6 +517,7 @@ async def on_message(message):
516517 # This line is necessary to process commands
517518 await client .process_commands (message )
518519
520+
519521# Loading the bot token from .env
520522load_dotenv ()
521523bot_token = os .getenv ('BOT_TOKEN' )
0 commit comments