Beispiel #1
0
def add_car_command(message):
	db = SQLighter()

	if message.chat.id in [i[0] for i in db.get_subscriptions()]:
		bot.send_message(message.chat.id, 'Введите название комплекта фильтра:')
		bot.register_next_step_handler(message, add_car)
	else:
		bot.send_message(message.chat.id, "Вы не подписаны.")

	db.close()
Beispiel #2
0
def subscribe(message):
	db = SQLighter()
	if not db.subscriber_exists(message.from_user.id):
		db.add_subscriber(message.from_user.id)
	else:
		db.update_subscription(message.from_user.id, True)
	bot.send_message(message.chat.id, "Вы успешно подписались на рассылку!\nПо умолчанию вам будут приходить все уведомление машин с сайта. =)")
	db.close()
Beispiel #3
0
def schedule(wait_for):
	while True:
		sleep(wait_for)

		db = SQLighter()

		for i in db.get_subscriptions():
			for j, k in eval(i[2]).items():
				sg = KolesaKz('users/'+str(i[0])+'.txt', filters=k)
				for l in sg.new_cars():
					bot.send_message(i[0], 'Новая объявление в %s: %s' % (j, l), disable_notification=False)

		db.close()
Beispiel #4
0
def unsubscribe(message):
	db = SQLighter()

	if not db.subscriber_exists(message.from_user.id):
		db.add_subscriber(message.from_user.id, False)
		bot.send_message(message.chat.id, "Вы итак не подписаны.")
	else:
		db.update_subscription(message.from_user.id, False)
		bot.send_message(message.chat.id, "Вы успешно отписаны от рассылки.")

	db.close()
Beispiel #5
0
def save_filter(id, text, filter, car):
	db = SQLighter()

	filters = eval(db.get_subscriber(id)[0][2])

	if text.lower() == 'неважен':
		filters[car][filter] = None
	else:
		filters[car][filter] = text

	db.update_subscription(id, True, filters=filters)
	bot.send_message(id, "Фильтр применен.")

	db.close()
Beispiel #6
0
def filters(message):
	db = SQLighter()

	if message.chat.id in [i[0] for i in db.get_subscriptions()]:
		keyboard = types.InlineKeyboardMarkup()
		subscriber = db.get_subscriber(message.chat.id)

		for i in eval(subscriber[0][2]).keys():
			keyboard.add(types.InlineKeyboardButton(i, callback_data='19.'+i))
		bot.send_message(message.chat.id, 'Выберите комплект фильтра:', reply_markup=keyboard)
	else:
		bot.send_message(message.chat.id, "Вы не подписаны.")

	db.close()
Beispiel #7
0
from datetime import datetime
from aiogram import Bot, Dispatcher, executor, types
from aiogram.types import ReplyKeyboardRemove, \
    ReplyKeyboardMarkup, KeyboardButton, \
    InlineKeyboardMarkup, InlineKeyboardButton
# 2 - Мы импортируем объекты для работы бота
from sqlighter import SQLighter

logging.basicConfig(level=logging.INFO)
# 4 - Эта строчка кода необходима для выведения сообщения о работе нашего бота и его юзернейма.
bot = Bot(token=config.TOKEN)
# 5 - Здесь мы создаем основу бота, где указываем что его токен равен нашей переменной.
dp = Dispatcher(bot)
# 6 - Диспетчер. Понадобится для принятия будущих сообщений.
# инициализируем соединение с БД
dbase = SQLighter('dbase.db')

block_number = 0
picture = Image()
name_of_cat = picture.get_categories()  # 50
length_of_block = len(name_of_cat) // 4  # 12
n_of_blocks = 4 + bool(len(name_of_cat) % 4)  # 5
com = ['/📷Фото', '/☰Категории', '/☺Подписаться', '/😢Отписаться', '/❓Статус']


# возвращает Inline Keyboard - блок категорий под номером
def create_block(number):
    markup = InlineKeyboardMarkup(row_width=3)
    if number == 1:
        markup_item0 = InlineKeyboardButton('All photos',
                                            callback_data='/photos')
Beispiel #8
0
from aiogram import Bot, Dispatcher, executor, types
import re
import sys
from bs4 import BeautifulSoup as BS
import requests
from sqlighter import SQLighter
from aiogram.bot import api

# блокировки
# pached_url = "https://telegg.ru/orig/bot{token}/{method}"
# setattr(api, 'API_URL', pached_url)

bot = Bot(token='1005395522:AAH_Mz2DUbMfJ5J9gVvMkEO6xO2tFUhcz-E')
dp = Dispatcher(bot)
# инициализируем соединение с БД
db = SQLighter()
session = requests.Session()
logging.basicConfig(level=logging.INFO)


# button_subscribe = KeyboardButton('Подписатся')
# button_unsubscribe = KeyboardButton('Отписаться')
# button_get_last = KeyboardButton('Получить последнюю станицу')
#
# greet_kb = ReplyKeyboardMarkup()
# greet_kb.add(button_subscribe)
# greet_kb.add(button_unsubscribe)
# greet_kb.add(button_get_last)


def login():
import random

from sqlighter import SQLighter
from messages import MESSAGES, NAMES
from utils import TestStates


logging.basicConfig(level=logging.INFO)

bot = Bot(token='1160891964:AAE0ba37vkpS14RQlH0VVlI2VPTovdS_D7U')

dp = Dispatcher(bot, storage=MemoryStorage())
dp.middleware.setup(LoggingMiddleware())


db = SQLighter('tables.db')


@dp.message_handler(commands=['start'], state='*')
async def start_and_add_user_in_BD(message: types.Message):

    """Начало работы бота и добавление юзера в БД.
    Возможно стоит добавлять в БД на следующих этапах"""

    if not db.user_exists(message.from_user.id):
        db.add_user(message.from_user.id)
    await message.answer(MESSAGES['start'])



@dp.message_handler(commands=['help'], state='*')
import asyncio
from aiogram import Bot, Dispatcher, executor, types
from aiogram.types import InlineKeyboardMarkup, InlineKeyboardButton
from sqlighter import SQLighter
from conf import token_
from get import chek_url, get_data_serch, get_similar_value, get_id_by_url, get_exact_book, check_text

db = SQLighter('db.db')  # Подключение к Базе
# chats = {}
bot = Bot(token=token_)
dp = Dispatcher(bot)

loop = asyncio.get_event_loop()

inline_btn_1 = InlineKeyboardButton('Нет', callback_data='cancel_1')
inline_btn_2 = InlineKeyboardButton('Да', callback_data='subsc_2')
inline_kb1 = InlineKeyboardMarkup(row_width=2).add(inline_btn_1, inline_btn_2)


@dp.callback_query_handler(lambda c: c.data)
async def process_callback_button1(callback_query: types.CallbackQuery):

    code = callback_query.data[-1]  # использовать последний символ
    if code.isdigit():
        code = int(code)
    last_message_id = db.get_last_message_id(
        callback_query.from_user.id
    )  #Сравнить текущий message_id с послденим из бызы
    if code == 2 and last_message_id == callback_query.message.reply_to_message.message_id:  #Да
        await bot.answer_callback_query(callback_query.id)
        await bot.send_message(callback_query.from_user.id,
Beispiel #11
0
if os.path.exists('Bote.session-journal'):
    path = os.path.join(os.path.abspath(os.path.dirname(__file__)),
                        'Bote.session-journal')
    os.remove(path)
    path = os.path.join(os.path.abspath(os.path.dirname(__file__)),
                        'Bote.session')
    time.sleep(1)
else:
    if os.path.exists('Bote.session'):
        shutil.copyfile("Bote.session", "Bote_2.session")

client = TelegramClient('Bote', api_id, api_hash)
client.start()
# инициализируем соединение с БД
db = SQLighter('db.db')


async def rer(cotegory):
    r = await client.get_dialogs()
    for i in r:
        if cotegory == i.title:
            return True
    return False


@dp.message_handler(commands=['start'], content_types=types.ContentTypes.TEXT)
async def process_admin_command(message: types.Message, state: FSMContext):
    if (not db.subscriber_exists(message.from_user.id)):
        db.add_db(message.from_user.id, message.from_user.first_name)
    if admin_id == message.from_user.id:
Beispiel #12
0
def handler_callback_query(query):
	if query.data.startswith('1.'):
		keyboard = types.InlineKeyboardMarkup()

		for i in bodywork.keys():
			keyboard.add(types.InlineKeyboardButton(i, callback_data='14.'+bodywork[i]+'.'+query.data.split('1.')[1]))
		keyboard.add(types.InlineKeyboardButton('Неважно', callback_data='14.0.'+query.data.split('1.')[1]))

		bot.edit_message_text(chat_id=query.from_user.id, message_id=query.message.message_id, text="Кузов:", reply_markup=keyboard)
	elif query.data.startswith('2.'):
		keyboard = types.InlineKeyboardMarkup()
		regions = get_regions()

		for i in regions.keys():
			keyboard.add(types.InlineKeyboardButton(i, callback_data='15.'+regions[i]+'.'+query.data.split('2.')[1]))
		keyboard.add(types.InlineKeyboardButton('Неважно', callback_data='15.0.'+query.data.split('2.')[1]))

		bot.edit_message_text(chat_id=query.from_user.id, message_id=query.message.message_id, text="Где искать (неважно):", reply_markup=keyboard)
	elif query.data.startswith('7.'):
		keyboard = types.InlineKeyboardMarkup()
		marks = get_marks()

		for i in marks.keys():
			keyboard.add(types.InlineKeyboardButton(i, callback_data='16.'+marks[i]+'.'+query.data.split('7.')[1]))
		keyboard.add(types.InlineKeyboardButton('Неважно', callback_data='16.0.'+query.data.split('7.')[1]))

		bot.edit_message_text(chat_id=query.from_user.id, message_id=query.message.message_id, text="Марка:", reply_markup=keyboard)
	elif query.data.startswith('8.'):
		db = SQLighter()
		subscriber = db.get_subscriber(query.from_user.id)
		db.close()

		if eval(subscriber[0][2])[query.data.split('8.')[1]]['car'] != None:
			keyboard = types.InlineKeyboardMarkup()
			models = get_models(eval(subscriber[0][2])[query.data.split('8.')[1]]['car'])

			for i in models.keys():
				keyboard.add(types.InlineKeyboardButton(i, callback_data='17.'+models[i]+'.'+query.data.split('8.')[1]))
			keyboard.add(types.InlineKeyboardButton('Неважно', callback_data='17.0.'+query.data.split('8.')[1]))

			bot.edit_message_text(chat_id=query.from_user.id, message_id=query.message.message_id, text="Модель:", reply_markup=keyboard)
		else:
			bot.send_message(query.from_user.id, "Выберите марку!")
	elif query.data.startswith('12.'):
		keyboard = types.InlineKeyboardMarkup()

		for i in KKP.keys():
			keyboard.add(types.InlineKeyboardButton(i, callback_data='18.'+KKP[i]+'.'+query.data.split('12.')[1]))
		keyboard.add(types.InlineKeyboardButton('Неважно', callback_data='18.0.'+query.data.split('12.')[1]))

		bot.edit_message_text(chat_id=query.from_user.id, message_id=query.message.message_id, text="КПП:", reply_markup=keyboard)
	elif query.data.startswith('3.'):
		bot.edit_message_text(chat_id=query.from_user.id, message_id=query.message.message_id, text="Введите год от (неважно):")
		bot.register_next_step_handler(query.message, lambda message: save_filter(message.chat.id, message.text, 'year[from]', query.data.split('3.')[1]))
	elif query.data.startswith('4.'):
		bot.edit_message_text(chat_id=query.from_user.id, message_id=query.message.message_id, text="Введите год до 2020 (неважно):")
		bot.register_next_step_handler(query.message, lambda message: save_filter(message.chat.id, message.text, 'year[to]', query.data.split('4.')[1]))
	elif query.data.startswith('5.'):
		bot.edit_message_text(chat_id=query.from_user.id, message_id=query.message.message_id, text="Цену от (неважно):")
		bot.register_next_step_handler(query.message, lambda message: save_filter(message.chat.id, message.text, 'price[from]', query.data.split('5.')[1]))
	elif query.data.startswith('6.'):
		bot.edit_message_text(chat_id=query.from_user.id, message_id=query.message.message_id, text="Цену до (неважно):")
		bot.register_next_step_handler(query.message, lambda message: save_filter(message.chat.id, message.text, 'price[to]', query.data.split('6.')[1]))
	elif query.data.startswith('9.'):
		bot.edit_message_text(chat_id=query.from_user.id, message_id=query.message.message_id, text="Введите пробег (неважно):")
		bot.register_next_step_handler(query.message, lambda message: save_filter(message.chat.id, message.text, 'auto-run[to]', query.data.split('9.')[1]))
	elif query.data.startswith('10.'):
		bot.edit_message_text(chat_id=query.from_user.id, message_id=query.message.message_id, text="Введите объем от (неважно):")
		bot.register_next_step_handler(query.message, lambda message: save_filter(message.chat.id, message.text, 'auto-car-volume[from]', query.data.split('10.')[1]))
	elif query.data.startswith('11.'):
		bot.edit_message_text(chat_id=query.from_user.id, message_id=query.message.message_id, text="Введите объем до (неважно):")
		bot.register_next_step_handler(query.message, lambda message: save_filter(message.chat.id, message.text, 'auto-car-volume[to]', query.data.split('11.')[1]))
	elif query.data.startswith('13.'):
		db = SQLighter()

		db.reset_filters(query.from_user.id, query.data.split('13.')[1])
		bot.edit_message_text(chat_id=query.from_user.id, message_id=query.message.message_id, text="Фильтры сброшены.")

		db.close()
	elif query.data.startswith('14.') or query.data.startswith('15.') or query.data.startswith('16.') or query.data.startswith('17.') or query.data.startswith('18.'):
		data = query.data.split('.')

		if query.data.startswith('14.'):
			name = 'bodywork'
		elif query.data.startswith('15.'):
			name = 'region'
		elif query.data.startswith('16.'):
			name = 'car'
		elif query.data.startswith('17.'):
			name = 'model'
		elif query.data.startswith('18.'):
			name = 'auto-car-transm'

		db = SQLighter()
		filters = eval(db.get_subscriber(query.from_user.id)[0][2])

		if data == '0':
			filters[data[2]][name] = None
		else:
			filters[data[2]][name] = data[1]

		db.update_subscription(query.from_user.id, True, filters=filters)
		db.close()
		bot.edit_message_text(chat_id=query.from_user.id, message_id=query.message.message_id, text='Фильтр применен.')
	elif query.data.startswith('19.'):
		data = query.data.split('19.')[1]
		filters_keyboard = types.InlineKeyboardMarkup()

		filters_keyboard.row(types.InlineKeyboardButton('Кузов', callback_data='1.'+data), types.InlineKeyboardButton('Где искать', callback_data='2.'+data), types.InlineKeyboardButton('Год ОТ', callback_data='3.'+data))
		filters_keyboard.row(types.InlineKeyboardButton('Год ДО', callback_data='4.'+data), types.InlineKeyboardButton('Цена ОТ', callback_data='5.'+data), types.InlineKeyboardButton('Цена ДО', callback_data='6.'+data))
		filters_keyboard.row(types.InlineKeyboardButton('Марка', callback_data='7.'+data), types.InlineKeyboardButton('Модель', callback_data='8.'+data), types.InlineKeyboardButton('Пробег', callback_data='9.'+data))
		filters_keyboard.row(types.InlineKeyboardButton('Объем ОТ', callback_data='10.'+data), types.InlineKeyboardButton('Объем ДО', callback_data='11.'+data), types.InlineKeyboardButton('КПП', callback_data='12.'+data))
		filters_keyboard.row(types.InlineKeyboardButton('Сброс', callback_data='13.'+data))

		bot.edit_message_text(chat_id=query.from_user.id, message_id=query.message.message_id, text='Выберите желаемый фильтр:', reply_markup=filters_keyboard)
	elif query.data.startswith('20.'):
		db = SQLighter()
		db.delete_car(query.from_user.id, query.data.split('20.')[1])
		db.close()

		bot.edit_message_text(chat_id=query.from_user.id, message_id=query.message.message_id, text="Комплект фильтра удален.")
	elif query.data.startswith('21.'):
		db = SQLighter()
		text = ''
		filters = eval(db.get_subscriber(query.from_user.id)[0][2])[query.data.split('21.')[1]]

		if filters['bodywork'] != None:
			text += 'Кузов: {}\n'.format(filters['bodywork'])
		else:
			text += 'Кузов: не важен\n'

		if filters['region'] != None:
			text += 'Где искать: {}\n'.format(filters['region'])
		else:
			text += 'Где искать: не важен\n'

		if filters['year[from]'] != None:
			text += 'Год ОТ: {}\n'.format(filters['year[from]'])
		else:
			text += 'Год ОТ: не важен\n'

		if filters['year[to]'] != None:
			text += 'Год ДО: {}\n'.format(filters['year[to]'])
		else:
			text += 'Год ДО: не важен\n'

		if filters['price[from]'] != None:
			text += 'Цена ОТ: {}\n'.format(filters['price[from]'])
		else:
			text += 'Цена ОТ: не важен\n'

		if filters['price[to]'] != None:
			text += 'Цена ДО: {}\n'.format(filters['price[to]'])
		else:
			text += 'Цена ДО: не важен\n'

		if filters['car'] != None:
			text += 'Марка: {}\n'.format(filters['car'])
		else:
			text += 'Марка: не важен\n'

		if filters['model'] != None:
			text += 'Модель: {}\n'.format(filters['model'])
		else:
			text += 'Модель: не важен\n'

		if filters['auto-run[to]'] != None:
			text += 'Пробег: {}\n'.format(filters['auto-run[to]'])
		else:
			text += 'Пробег: не важен\n'

		if filters['auto-car-volume[from]'] != None:
			text += 'Объём ОТ: {}\n'.format(filters['auto-car-volume[from]'])
		else:
			text += 'Объём ОТ: не важен\n'

		if filters['auto-car-volume[to]'] != None:
			text += 'Объём ДО: {}\n'.format(filters['auto-car-volume[to]'])
		else:
			text += 'Объём ДО: не важен\n'

		if filters['auto-car-transm'] != None:
			text += 'КПП: {}\n'.format(filters['auto-car-transm'])
		else:
			text += 'КПП: не важен\n'

		bot.edit_message_text(chat_id=query.from_user.id, message_id=query.message.message_id, text=text)
		db.close()

	bot.answer_callback_query(query.id)
Beispiel #13
0
from bs4 import BeautifulSoup as BS
from sqlighter import SQLighter

print("[Log]: " + "All API loaded")
print("[Log]: " + "All files loaded")
print("[Log]: " + "All lib's loaded")

# задаем уровень логов
logging.basicConfig(level=logging.INFO)

# инициализируем бота
bot = Bot(token=config.TOKEN)

dp = Dispatcher(bot)
#Пдключние к БД
db = SQLighter('heroes.db')


@dp.message_handler(commands=['start'])
async def welcome(message: types.Message):
    markup = types.ReplyKeyboardMarkup(resize_keyboard=True, row_width=2)
    item1 = types.KeyboardButton("Список героев")
    item2 = types.KeyboardButton("Полезная информация")
    item3 = types.KeyboardButton("Связки героев")
    markup.add(item1, item2, item3)

    await bot.send_message(message.chat.id,
                           "Привет, я бот по игре AFK Arena",
                           parse_mode='html',
                           reply_markup=markup)
Beispiel #14
0
import config
# import time
from sqlighter import SQLighter

logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=config.loggingLevel)
logger = logging.getLogger(__name__)

BOT_TOKEN = config.token
bot = telebot.TeleBot(BOT_TOKEN)


# task = bot.get_me()
# result = task.wait()
# bot.send_message(message.chat.id, result)

db = SQLighter(user=config.db_user, passwd=config.db_passwd, db=config.db)

WelcomeText = f'Welcome!\n' \
       f'This bot can save songs from different users.\n' \
       f'You can request a random song from DB that any users added\n' \
       f'And much more) stay tuned!'


def print_keyboard():
    markup = telebot.types.InlineKeyboardMarkup(row_width=3)
    markup.add(
        telebot.types.InlineKeyboardButton(text='Subscribe', callback_data='sub'),
        telebot.types.InlineKeyboardButton(text='Unsubscribe', callback_data='unsub'),
        telebot.types.InlineKeyboardButton(text='Status', callback_data='status'),
        telebot.types.InlineKeyboardButton(text='Get song', callback_data='get_song_call'),
        telebot.types.InlineKeyboardButton(text='Get song+rotate', callback_data='get_rotate_call'),
Beispiel #15
0
import requests
from bs4 import BeautifulSoup
import telebot
from telebot import types
import datetime
from datetime import timedelta
from sqlighter import SQLighter
import exchange_rates
import config

bot = telebot.TeleBot(config.TOKEN)

db = SQLighter('tgbot_db.db')

main_buttons = telebot.types.ReplyKeyboardMarkup(True, True, True)
main_buttons.row('Coronavirus', 'New articles', 'Exchange Rates')

button_sub = telebot.types.ReplyKeyboardMarkup(True)
button_sub.row('Subscribe')


@bot.message_handler(commands=['start'])
def cmd_start(message):
    bot.send_message(message.chat.id,
                     f'BOT LAUNCHED\n\n {config.command_list}',
                     reply_markup=button_sub)


@bot.message_handler(commands=['help'])
def cmd_help(message):
    bot.send_message(message.chat.id,
Beispiel #16
0
logging.basicConfig(level=logging.INFO)

# # Считываем учетные данные
# config = configparser.ConfigParser()
# config.read("config.ini")
#
# # Присваиваем значения внутренним переменным
# api_id = config['Telegram']['api_id']
# api_hash = config['Telegram']['api_hash']
# username = config['Telegram']['username']

bot = Bot(token=config.TOKEN)
dp = Dispatcher(bot)

# Инициализируем соединение с БД
db = SQLighter('subscriptions.db')

# инициализируем парсер
sg = StopGame('lastkey.txt')


# Команда активации подписки
@dp.message_handler(commands=['subscribe'])
async def echo(message: types.Message):
    if not db.subscribers_exists(message.from_user.id):
        # если юзера нет в базе - добавляем его
        db.add_subscriber(message.from_user.id)
    else:
        # если он уже есть, то просто обновляем ему статус подписки
        db.update_subscription(message.from_user.id, True)
Beispiel #17
0
import asyncio
# import config
import logging
import requests
from aiogram import Bot, Dispatcher, executor, types
from aiogram.types import CallbackQuery
from sqlighter import SQLighter
from datetime import date


logging.basicConfig(level=logging.INFO)

# initialising bot
bot = Bot(token="1155158545:AAF-Z3nxdsxIkLT1Bl3LJrDZVRvTu2fmXiM")
dp = Dispatcher(bot)
db = SQLighter('privat_curr.db')


date = str(date.today())
id = 382233106


# money
keys = ['ccy', 'buy', 'sale']
USD, EUR, RUB, BTC = [], [], [], []
USD_old, EUR_old, RUB_old, BTC_old = [], [], [], []


# USD
data = requests.get('https://api.privatbank.ua/p24api/pubinfo?exchange&json&coursid=11').json()
for key in keys:
Beispiel #18
0
def send_joke(message):
    keyboard = types.InlineKeyboardMarkup()
    keyboard.add(types.InlineKeyboardButton(text="Еще анекдот!", callback_data="anekdot"))
    sqlighter = SQLighter(config.DB_PATH)
    reply_text = "{0} :satisfied:".format(sqlighter.get_random_joke())
    bot.send_message(message.chat.id, unescape(emojize(reply_text)),reply_markup=keyboard)
Beispiel #19
0
from telebot import TeleBot, types
from sqlighter import SQLighter

from pars import KolesaKz, get_marks, get_regions, get_models, bodywork, KKP

from time import sleep
from multiprocessing import Process

bot = TeleBot('1315224989:AAHZRgQNITGn1IZSF4i22KW_jiLhOEDhYXI')

db = SQLighter()

db.create_table()

db.close()

@bot.message_handler(commands= ['start'])
def main(message):
    markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
    item1 = types.KeyboardButton('/subscribe')
    item2 = types.KeyboardButton('/unsubscribe')
    item3 = types.KeyboardButton('/edit_filters')
    item4 = types.KeyboardButton('/show_filters')
    item5 = types.KeyboardButton('/delete_car')
    item6 = types.KeyboardButton('/add_car')
    markup.add(item1,item2, item3, item4,item5, item6)

    bot.send_message(message.chat.id, 'Приветствую {0.first_name}!, \nsubscribe  - Подписка на рассылку\nunsubscribe  - Отписка от рассылок\nedit_filters - изменить фильтры\nshow_filters - посмотреть все текущие комплекты /фильтры\nadd_car - добавить комплект\ndelete_car - удалить комплект'.format(message.from_user, bot.get_me()),
        parse_mode='html', reply_markup=markup)

Beispiel #20
0
def add_car(message):
	db = SQLighter()
	db.add_car(message.chat.id, message.text)
	db.close()

	bot.send_message(message.chat.id, "Комплект фильтра добавлен.")
Beispiel #21
0
from aiogram import Bot, types
from aiogram.utils import executor
from aiogram.dispatcher import Dispatcher
from config import Token
import config
from pars import News
from sqlighter import SQLighter
import asyncio
import aioschedule

bot = Bot(token=Token)
dp = Dispatcher(bot)
news = News('check.txt')
db = SQLighter('db.db')


@dp.message_handler(commands=['start'])
async def process_start_command(message: types.Message):
    await message.reply(
        "Привет!\nЧтобы получать новости подпишитесь на рассылку!\n/subscribe\n/help - помощь, для TheMrSuperAlex007, а то хер разберется)",
        reply_markup=config.keyboard1)


@dp.message_handler(commands=['help'])
async def help_comand(message: types.Message):
    await message.reply(
        'Выберите команду \n\n /subscribe - подписаться на рассылку \n /unsubscribe - отписаться от рассылки \n /start - перезапустить бота'
    )


# Команда активации подписки
Beispiel #22
0
import telebot
import markup
import config
import text
import sqlite3
from sqlighter import SQLighter

bot = telebot.TeleBot(config.token)

# DataBase
db = SQLighter('bot.db')
con = sqlite3.connect('bot.db', check_same_thread=False)
cur = con.cursor()


# Комманда - /start - ГОТОВО
@bot.message_handler(commands=['start'])
def handler_start(message):
    bot.send_message(message.from_user.id,
                     'Добро пожаловать!',
                     reply_markup=markup.start_markup)
    db.add_user(message.from_user.id, message.from_user.first_name,
                message.from_user.last_name)
    # db.create_user_table(message.from_user.id)


# Комманда - /anal
@bot.message_handler(commands=['anal'])
def handler_analytics(message):
    bot.send_message(config.admin,
                     'Аналитика',