-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmisc.py
23 lines (18 loc) · 924 Bytes
/
misc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import os
from pyrogram import Client, filters, enums
from pyrogram.errors.exceptions.bad_request_400 import UserNotParticipant, MediaEmpty, PhotoInvalidDimensions, WebpageMediaEmpty
import time
from datetime import datetime
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, CallbackQuery
import logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.ERROR)
@Client.on_message(filters.command('id'))
async def showid(client, message):
chat_type = message.chat.type
if chat_type == enums.ChatType.PRIVATE:
await message.reply_text(f'★ User ID: <code>{message.from_user.id}</code>')
elif chat_type in [enums.ChatType.GROUP, enums.ChatType.SUPERGROUP]:
await message.reply_text(f'★ Group ID: <code>{message.chat.id}</code>')
elif chat_type == enums.ChatType.CHANNEL:
await message.reply_text(f'★ Channel ID: <code>{message.chat.id}</code>')