You can download this code by clicking the button below.
This code is now available for download.
This function is used to get the current status of a specified user. If the user's privacy settings restrict status viewing, it returns a prompt message.
Technology Stack : Pyrogram
Code Type : Pyrogram API Function
Code Difficulty : Intermediate
def random_user_status(user_id, bot):
from pyrogram import Client, filters
from pyrogram.errors import UserPrivacyRestricted
try:
user = bot.get_users(user_id)
status = user.status
return status
except UserPrivacyRestricted:
return "This user has restricted their status privacy."