Skip to content

Commit 8f455b3

Browse files
committed
Add special feature
1 parent f1d6674 commit 8f455b3

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

bot.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'''Telegram bot that (primarily) attempts to perform url hacks to get around paywalls'''
22

33

4-
__version__ = '2.5.2'
4+
__version__ = '2.5.2.lol'
55

66

77
import asyncio
@@ -14,6 +14,7 @@
1414
import traceback
1515
from io import BytesIO
1616
from urllib.parse import urlsplit
17+
from datetime import datetime, timezone, timedelta
1718

1819
import httpx
1920
from telegram import Update
@@ -269,7 +270,8 @@ async def add_bypasses(url: str) -> str:
269270
(txtify_it, 'txtify.it'),
270271
(twitter, 'Twitter Embed'),
271272
(nitter, 'Twiiit'),
272-
(lite_mode, 'Lite Mode')
273+
(lite_mode, 'Lite Mode'),
274+
(rick_roll, 'Experimental')
273275
)
274276

275277
async with httpx.AsyncClient(http2=True) as client:
@@ -285,6 +287,20 @@ async def add_bypasses(url: str) -> str:
285287

286288

287289
# bypasses
290+
@timer
291+
@snitch
292+
async def rick_roll(url: str, client: httpx.AsyncClient) -> str | None:
293+
'''Rickrolls people on April 1st'''
294+
def is_april_fools():
295+
utc_now = datetime.now(timezone.utc)
296+
start_time_utc = datetime(2025, 4, 1, 0, 0, tzinfo=timezone.utc) - timedelta(hours=-4) # EDT
297+
end_time_utc = datetime(2025, 4, 2, 0, 0, tzinfo=timezone.utc) - timedelta(hours=-7) # PDT
298+
return start_time_utc <= utc_now <= end_time_utc
299+
300+
if is_april_fools():
301+
return 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
302+
303+
288304
@timer
289305
@snitch
290306
async def wayback(url: str, client: httpx.AsyncClient) -> str | None:

0 commit comments

Comments
 (0)