Răsfoiți Sursa

feat: user.id in welcome message (#244)

SI_NN_ER_LS 2 ani în urmă
părinte
comite
4457498cbe
2 a modificat fișierele cu 4 adăugiri și 2 ștergeri
  1. 1 1
      README.md
  2. 3 1
      wbb/modules/greetings.py

+ 1 - 1
README.md

@@ -114,7 +114,7 @@ __MODULE__ = "Module Name"
 __HELP__ = "Module help message"
 
 
-@app.on_message(~filters.edited & filters.command("start"))
+@app.on_message(filters.command("start"))
 async def some_function(_, message):
     await message.reply_text("I'm already up!!")
 

+ 3 - 1
wbb/modules/greetings.py

@@ -87,7 +87,7 @@ For text welcome message just send the text. Then reply with the command
 The format should be something like below.
 
 ```
-**Hi** {name} Welcome to {chat}
+**Hi** {name} [{id}] Welcome to {chat}
 
 ~ #This separater (~) should be there between text and buttons, remove this comment also
 
@@ -254,6 +254,8 @@ async def send_welcome_message(chat: Chat, user_id: int, delete: bool = False):
         text = text.replace("{chat}", chat.title)
     if "{name}" in text:
         text = text.replace("{name}", (await app.get_users(user_id)).mention)
+    if "{id}" in text:
+        text = text.replace("{id}", f"`{user_id}`")
 
     async def _send_wait_delete():
         if welcome == "Text":