mirror of
https://github.com/tgbot-collection/ytdlbot.git
synced 2024-09-20 23:15:57 +08:00
parent
19e4f32196
commit
cc037deda2
|
@ -237,6 +237,7 @@ settings - Set your preference
|
|||
direct - Download file directly
|
||||
sub - Subscribe to YouTube Channel
|
||||
unsub - Unsubscribe from YouTube Channel
|
||||
sub_count - Check subscription status, owner only.
|
||||
```
|
||||
|
||||
# Test data
|
||||
|
|
|
@ -187,6 +187,18 @@ class VIP(Redis, MySQL):
|
|||
logging.info("Checking peroidic subscriber...")
|
||||
return group
|
||||
|
||||
def sub_count(self):
|
||||
sql = """
|
||||
select user_id, channel.title, channel.link
|
||||
from subscribe, channel where subscribe.channel_id = channel.channel_id
|
||||
"""
|
||||
self.cur.execute(sql)
|
||||
data = self.cur.fetchall()
|
||||
text = f"Total {len(data)} subscriptions found.\n\n"
|
||||
for item in data:
|
||||
text += "{} ==> [{}]({})\n".format(*item)
|
||||
return text
|
||||
|
||||
|
||||
class BuyMeACoffee:
|
||||
def __init__(self):
|
||||
|
@ -293,5 +305,3 @@ def subscribe_query():
|
|||
has = vip.has_newer_update(cid)
|
||||
if has:
|
||||
print(f"{has} - {uid}")
|
||||
|
||||
|
||||
|
|
|
@ -171,6 +171,14 @@ def terms_handler(client: "Client", message: "types.Message"):
|
|||
client.send_message(chat_id, bot_text.terms)
|
||||
|
||||
|
||||
@app.on_message(filters.command(["sub_count"]))
|
||||
def sub_count_handler(client: "Client", message: "types.Message"):
|
||||
username = message.from_user.username
|
||||
chat_id = message.chat.id
|
||||
if username == OWNER:
|
||||
client.send_message(chat_id, VIP().sub_count())
|
||||
|
||||
|
||||
@app.on_message(filters.command(["direct"]))
|
||||
def direct_handler(client: "Client", message: "types.Message"):
|
||||
chat_id = message.from_user.id
|
||||
|
|
Loading…
Reference in a new issue