瀏覽代碼

Rss count

TheHamkerCat 5 年之前
父節點
當前提交
f0db46f5c4
共有 2 個文件被更改,包括 11 次插入 和 4 次删除
  1. 6 4
      wbb/modules/global_stats.py
  2. 5 0
      wbb/utils/dbfunctions.py

+ 6 - 4
wbb/modules/global_stats.py

@@ -32,13 +32,11 @@ from wbb.utils.dbfunctions import (get_blacklist_filters_count,
                                    get_filters_count, get_gbans_count,
                                    get_karmas_count, get_notes_count,
                                    get_served_chats, get_served_users,
-                                   get_warns_count,
-                                   remove_served_chat)
+                                   get_warns_count, remove_served_chat,
+                                   get_rss_feeds_count)
 from wbb.utils.http import get
 from wbb.utils.inlinefuncs import keywords_list
 
-""" CHAT WATCHER IS IN filters.py"""
-
 
 @app.on_message(
     filters.command("gstats")
@@ -105,6 +103,9 @@ async def global_stats(_, message):
     for developer in developers:
         commits += developer["contributions"]
     developers = len(developers)
+
+    # Rss feeds
+    rss_count = await get_rss_feeds_count()
     # Modules info
     modules_count = len(ALL_MODULES)
 
@@ -112,6 +113,7 @@ async def global_stats(_, message):
 **Global Stats of {BOT_NAME}**:
 **{modules_count}** Modules Loaded
 **{len(keywords_list)}** Inline Modules Loaded.
+**{rss_count}** Active RSS Feeds.
 **{gbans}** Globally banned users.
 **{filters_count}** Filters, Across **{filters_chats_count}** chats.
 **{blacklist_filters_count}** Blacklist Filters, Across **{blacklist_filters_chats_count}** chats.

+ 5 - 0
wbb/utils/dbfunctions.py

@@ -890,3 +890,8 @@ async def get_rss_feeds() -> list:
             )
         )
     return data
+
+async def get_rss_feeds_count() -> int:
+    feeds = rssdb.find({"chat_id": {"$exists": 1}})
+    feeds = await feeds.to_list(length=10000000)
+    return len(feeds)