# -*- coding: utf-8 -*-
import telebot
from time import time
import os
bot = telebot.TeleBot(token_test)
@bot.message_handler(content_types=['voice'])
def voice_processing(message):
file_info = bot.get_file(message.voice.file_id)
downloaded_file = bot.download_file(file_info.file_path)
with open(f'{message.chat.id}_{int(time())}.ogg', 'wb') as new_file:
new_file.write(downloaded_file)
@bot.message_handler(commands=['start'])
def voice_send(message):
l_send = [filename for filename in os.listdir() if filename.startswith(f'{message.chat.id}')]
for f in l_send:
voice = open(f'{f}', 'rb')
bot.send_voice(chat_id=message.chat.id, voice=voice)
if __name__ == "__main__":
try:
bot.polling(none_stop=True)
except Exception as e:
print(e)
# -*- coding: utf-8 -*-
import telebot
from time import sleep
from threading import Thread
bot = telebot.TeleBot(token_test)
@bot.message_handler(commands=['start'])
def thread_main(message):
Thread(target=timer, args=(message,)).start()
Thread(target=counter, args=(message,)).start()
def timer(message):
msg = bot.send_message(chat_id=message.chat.id, text='Timer start')
sleep(1)
msg_id = msg.message_id
time_s = 15
for t in range(time_s, 0, -1):
bot.edit_message_text(chat_id=message.chat.id, message_id=msg_id, text=f'Timer - {t}')
sleep(1)
bot.edit_message_text(chat_id=message.chat.id, message_id=msg_id, text='Timer End')
def counter(message):
msg = bot.send_message(chat_id=message.chat.id, text='Count start')
sleep(1)
msg_id = msg.message_id
count = 15
for c in range(count):
bot.edit_message_text(chat_id=message.chat.id, message_id=msg_id, text=f'Count - {c}')
sleep(1)
bot.edit_message_text(chat_id=message.chat.id, message_id=msg_id, text='Count End')
if __name__ == "__main__":
try:
bot.polling(none_stop=True)
except Exception as e:
print(e)
# -*- coding: utf-8 -*-
import telebot
from time import sleep
bot = telebot.TeleBot(token)
@bot.message_handler(commands=['start'])
def send_notification(message):
msg = bot.send_message(chat_id=message.chat.id, text='START')
sleep(1)
msg_id = msg.message_id
time_s = 15
for t in range(time_s, 0, -1):
bot.edit_message_text(chat_id=message.chat.id, message_id=msg_id, text=f'Wait...{t} секунд')
sleep(1)
bot.edit_message_text(chat_id=message.chat.id, message_id=msg_id, text='END')
if __name__ == "__main__":
try:
bot.polling(none_stop=True)
except Exception as e:
print(e)
with requests.Session() as session:
cookies = dict(uid=uid, usess=usess)
auth = dict(username=login, password=password) # Данные в виде словаря, которые отправлятся в POST
r = session.get(url, timeout=5) # Получаем страницу с формой логина
r.encoding = 'utf-8'
session.post(url, auth) # Отправляем данные в POST, в session записываются наши куки
r = session.get(link, cookies=cookies, timeout=5)
open('some_file_name', 'wb').write(r.content)
CREATE TABLE IF NOT EXISTS games
(game TEXT NOT NULL, play_date TEXT NOT NULL, play_time TEXT NOT NULL,
team_a TEXT NOT NULL, team_b TEXT NOT NULL, cup TEXT,
PRIMARY KEY (game , play_date , play_time ));
SELECT *
FROM taxi_anketa
WHERE
id IN
(SELECT id FROM taxi_anketa GROUP BY
id HAVING COUNT(id) > 1)
AND
korob_result IS NOT NULL;
-o --output=STRING Change journal output mode (short, short-precise,
short-iso, short-iso-precise, short-full,
short-monotonic, short-unix, verbose, export,
json, json-pretty, json-sse, cat)
journalctl --output=short-iso
2018-01-28T18:58:20+0300 ubuntu kernel: BIOS-e820: [mem 0x00000000bfd15000-0x00000000bfd5ffff] ACPI NVS
2018-01-28T18:58:20+0300 ubuntu kernel: BIOS-e820: [mem 0x00000000bfd60000-0x00000000bfd68fff] ACPI data
2018-01-28T18:58:20+0300 ubuntu kernel: BIOS-e820: [mem 0x00000000bfd69000-0x00000000bfd6bfff] ACPI NVS