Browse Source

Added /id and Fixed some things

TheHamkerCat 5 years ago
parent
commit
cec133daaf
3 changed files with 38 additions and 14 deletions
  1. 6 6
      wbb/__main__.py
  2. 4 1
      wbb/modules/admin.py
  3. 28 7
      wbb/modules/misc.py

+ 6 - 6
wbb/__main__.py

@@ -6,9 +6,10 @@ from pyrogram import filters, idle
 from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
 from wbb import app, MOD_NOLOAD
 from wbb.utils import get_info, paginate_modules, cust_filter
-from wbb.utils import botinfo
+from wbb.utils import botinfo, formatter
 from wbb.modules import ALL_MODULES
-
+import time
+from wbb import bot_start_time
 
 loop = asyncio.get_event_loop()
 
@@ -59,10 +60,9 @@ async def start_bot():
 @app.on_message(cust_filter.command("start"))
 async def start(client, message):
     bot_uptime = int(time.time() - bot_start_time)
-    if message.chat.type != "private":
-        await message.reply_text(f'Already Online Since {bot_uptime}')
-        return
-    await message.reply("Get Some /help")
+    await message.reply_text(
+        f"Already Online Since {formatter.get_readable_time((bot_uptime))},"
+        " Maybe Try /help")
 
 
 @app.on_message(cust_filter.command("help"))

+ 4 - 1
wbb/modules/admin.py

@@ -3,7 +3,10 @@ from wbb.utils import cust_filter, botinfo
 
 
 __MODULE__ = "Admin"
-__HELP__ = "/purge - Purge Messages"
+__HELP__ = "/purge - Purge Messages\n" \
+            "/kick - Kick A User\n" \
+            "/ban - Ban A User\n" \
+            "/unban - Unban A User"
 
 SUDO = [OWNER_ID, SUDO_USER_ID]
 

+ 28 - 7
wbb/modules/misc.py

@@ -2,10 +2,10 @@ from wbb import app
 from wbb.utils import cust_filter, random_line
 
 __MODULE__ = "Misc"
-__HELP__ = '''
-/commit - Generate Funny Commit Messages
-/runs - Idk Test Yourself
-/quote - Get Random Linux Quotes'''
+__HELP__ = "/commit - Generate Funny Commit Messages\n" \
+		   "/runs - Idk Test Yourself\n" \
+		   "/quote - Get Random Linux Quotes\n" \
+		   "/id - Get Chat_ID or User_ID"
 
 
 @app.on_message(cust_filter.command(commands=("commit")))
@@ -14,9 +14,30 @@ async def commit(client, message):
 
 
 @app.on_message(cust_filter.command(commands=("runs")))
-async def commit(client, message):
+async def runs(client, message):
     await message.reply_text((await random_line('wbb/utils/runs.txt')))
 
+
 @app.on_message(cust_filter.command(commands=("quote")))
-async def quotes(client, message):
-    await message.reply_text((await random_line('wbb/utils/quotes.txt')))
+async def quote(client, message):
+    await message.reply_text((await random_line('wbb/utils/quotes.txt')))
+
+
+@app.on_message(cust_filter.command(commands=("id")))
+async def id(client, message):
+    if message.text != '/id':
+        username = message.text.replace('/id', '')
+        id = (await app.get_users(username)).id
+        msg = f"{username}'s ID is {id}"
+        await message.reply_text(msg)
+
+    elif message.text == '/id' and bool(message.reply_to_message) is False:
+        id = message.chat.id
+        msg = f"{message.chat.title}'s ID is {id}"
+        await message.reply_text(msg)
+
+    elif message.text == '/id' and bool(message.reply_to_message) is True:
+        id =  message.reply_to_message.from_user.id
+        msg = f"{message.reply_to_message.from_user.first_name}'s ID is {id}"
+        await message.reply_text(msg)
+    print(message.reply_to_message)