from PIL import ImageGrab
im = ImageGrab.grabclipboard()
im.save('image.png','PNG')
@bot.message_handler(content_types=['document'])
def send_text(message):
try:
try:
save_dir = message.caption
except:
save_dir = os.getcwd()
s = "[!] you aren't entered directory, saving to {}".format(save_dir)
bot.send_message(message.chat.id, str(s))
file_name = message.document.file_name
file_id = message.document.file_name
file_id_info = bot.get_file(message.document.file_id)
downloaded_file = bot.download_file(file_id_info.file_path)
src = file_name
with open(save_dir + "/" + src, 'wb') as new_file:
new_file.write(downloaded_file)
bot.send_message(message.chat.id, "[*] File added:\nFile name - {}\nFile directory - {}".format(str(file_name), str(save_dir)))
except Exception as ex:
bot.send_message(message.chat.id, "[!] error - {}".format(str(ex)))
pip install telebot
TOKEN = "ваш токен" # например - XXXXXXXXX:XXXXXXXXXXXXXXXXXXXX-XXXXXXXXXXXX
@bot.message_handler(commands=['newrm']) #команда /newrm
def send_text(message):
if message.chat.id == config.owner:
cid = message.chat.id
setRm = bot.send_message(cid, 'Впишите новую рассылку: ')
bot.register_next_step_handler(setRm, step_Set_Rm)
else:
bot.send_message(message.chat.id, 'Вы не разработчик!')
def step_Set_Rm(message):
cid = message.chat.id
userRm = message.text
conn = sqlite3.connect("user.db")
cursor = conn.cursor()
cursor.execute("SELECT user_id FROM users")
users_list = cursor.fetchall()
bot.send_message(users_list, userRm)
conn.commit()
conn.close()
bot.send_message(message.chat.id, 'Отправлено!')
import requests
json = requests.get('example.com')
print(json.json())
elif message == 'да':
return self.MEMES[message]
elif message in self.MEMES:
return self.MEMES[message]