Skip to content

Commit

Permalink
Update pyroplug.py
Browse files Browse the repository at this point in the history
  • Loading branch information
devgaganin authored Mar 15, 2024
1 parent 7f16aae commit 219cbcc
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions main/plugins/pyroplug.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,16 @@ def thumbnail(sender):
# Define a dictionary to store user chat IDs
user_chat_ids = {}

# Command function to set user's chat ID
@bot.on_message(filters.command("setchat") & filters.private)
async def set_chat_id(client, message):
@bot.on(events.NewMessage(incoming=True, pattern='/setchat'))
async def set_chat_id(event):
# Extract chat ID from the message
chat_id = message.text.split(" ", 1)[1]
try:
# Try converting chat ID to integer
chat_id = int(chat_id)
chat_id = int(event.raw_text.split(" ", 1)[1])
# Store user's chat ID
user_chat_ids[message.from_user.id] = chat_id
await message.reply("Chat ID set successfully!")
user_chat_ids[event.sender_id] = chat_id
await event.reply("Chat ID set successfully!")
except ValueError:
await message.reply("Invalid chat ID!")
await event.reply("Invalid chat ID!")

async def send_video_with_chat_id(client, sender, path, caption, duration, hi, wi, thumb_path, upm):
# Get the user's set chat ID, if available; otherwise, use the original sender ID
Expand Down

0 comments on commit 219cbcc

Please sign in to comment.