FEAT: Added Stripe webhook to handle user subscriptions

UPDATE: Improved the chat look
This commit is contained in:
JustIceO7
2025-02-16 03:53:04 +00:00
parent 97067e1f87
commit 4ddcb3e139
7 changed files with 89 additions and 47 deletions

View File

@@ -52,21 +52,18 @@ def is_user_partner(user_id: int) -> bool:
return bool(data)
def is_subscribed(user_id: int, subscribed_to_id: int) -> bool:
"""
Returns True if user is subscribed to a streamer, else False
"""
"""Returns True if user is subscribed to a streamer, else False"""
with Database() as db:
result = db.fetchone("""
SELECT *
return bool(db.fetchone(
"""
SELECT 1
FROM subscribes
WHERE user_id = ?
AND subscribed_id = ?
AND subscribed_id = ?
AND expires > ?;
""", (user_id, subscribed_to_id, datetime.now()))
print(result)
if result:
return True
return False
""",
(user_id, subscribed_to_id, datetime.now())
))
def is_following(user_id: int, followed_id: int) -> bool:
"""