-
Notifications
You must be signed in to change notification settings - Fork 7
/
get_display_info.py
35 lines (28 loc) · 1.15 KB
/
get_display_info.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# *- coding: utf-8 -*-
import telebot
from telebot import util, types
bot = telebot.TeleBot('TOKEN')
#Get and display information about command sender
@bot.message_handler(commands=['me'])
def send_user_data(message):
user = message.from_user
text = 'User:\n<code>{0}</code>'.format(user)
#if the command has sent in a group get and display status and other information
#about the command sender
if message.chat.id < 0:
chat_member = bot.get_chat_member(message.chat.id, message.from_user.id)
text += '\n\nChat member:\n<code>{0}</code>'.format(chat_member)
bot.send_message(message.chat.id, text, parse_mode='HTML')
#Get and display information about the bot
@bot.message_handler(commands=['bot'])
def send_getme(message):
me = bot.get_me()
text = '<code>' + str(me) + '</code>'
bot.send_message(message.chat.id, text, parse_mode='HTML')
#get and display information about the chat
@bot.message_handler(commands=['chat'])
def send_chat_data(message):
chat = message.chat
text = '<code>' + str(chat) + '</code>'
bot.send_message(message.chat.id, text, parse_mode='HTML')
bot.polling(none_stop=True)