2022-11-01 18:52:08 +10:00
|
|
|
|
from cgitb import text
|
2022-11-03 01:01:08 +10:00
|
|
|
|
import datetime
|
2022-10-18 19:17:36 +10:00
|
|
|
|
import logging
|
2022-11-04 19:05:33 +10:00
|
|
|
|
from random import randint
|
2022-11-11 18:18:16 +10:00
|
|
|
|
from sqlalchemy import create_engine, MetaData, Table, Integer, String, \
|
|
|
|
|
Column, DateTime, ForeignKey, Numeric
|
|
|
|
|
from sqlalchemy.ext.declarative import declarative_base
|
|
|
|
|
from sqlalchemy.orm import sessionmaker
|
2022-10-18 19:17:36 +10:00
|
|
|
|
from aiogram import Bot, Dispatcher, executor, types
|
2022-10-18 20:22:30 +10:00
|
|
|
|
from aiogram.types import ReplyKeyboardRemove, ReplyKeyboardMarkup, KeyboardButton
|
2022-11-11 18:18:16 +10:00
|
|
|
|
from sqdb import user
|
2022-11-08 20:43:34 +10:00
|
|
|
|
|
2022-11-07 17:11:33 +10:00
|
|
|
|
|
2022-11-07 00:52:46 +10:00
|
|
|
|
|
2022-11-07 17:09:24 +10:00
|
|
|
|
|
2022-10-18 19:17:36 +10:00
|
|
|
|
API_TOKEN = '5724991559:AAEuLvpLsgP6LHRGMSyFtQLlR5qPQUO4b_w'
|
|
|
|
|
|
|
|
|
|
logging.basicConfig(level=logging.DEBUG)
|
|
|
|
|
|
2022-11-22 21:42:04 +10:00
|
|
|
|
bot = Bot(token=API_TOKEN, parse_mode="HTML")
|
2022-10-18 19:17:36 +10:00
|
|
|
|
dp = Dispatcher(bot)
|
2022-10-29 14:04:56 +10:00
|
|
|
|
|
2022-11-03 16:28:19 +10:00
|
|
|
|
|
2022-11-03 00:39:03 +10:00
|
|
|
|
|
2022-11-03 01:01:08 +10:00
|
|
|
|
@dp.message_handler(commands=["time"])
|
2022-11-03 00:39:03 +10:00
|
|
|
|
async def send_time(message: types.Message):
|
2022-11-03 19:20:54 +10:00
|
|
|
|
new_year = datetime.datetime(2022, 12, 31) #дата нового года
|
2022-11-03 19:07:20 +10:00
|
|
|
|
ct = datetime.datetime.now() #датавремя
|
2022-11-03 19:20:54 +10:00
|
|
|
|
cd = datetime.datetime.now().strftime("%d/%m/%Y") #дата (д,м,г)
|
2022-11-18 19:07:43 +10:00
|
|
|
|
ct1 = ct+datetime.timedelta(hours=15) # +14 часов от сервера
|
2022-11-03 19:20:54 +10:00
|
|
|
|
ct2 = ct1.strftime('%H:%M') # форматирует датувремя просто во время(ч,м)
|
|
|
|
|
raznitsa = (new_year - ct).days #отнимает от нг текущее время и получаем разницу в днях
|
2022-11-03 22:13:45 +10:00
|
|
|
|
|
|
|
|
|
days = ['день', 'дня', 'дней']
|
|
|
|
|
if raznitsa % 10 == 1 and raznitsa % 100 != 11:
|
|
|
|
|
p = 0
|
|
|
|
|
elif 2 <= raznitsa % 10 <= 4 and (raznitsa % 100 < 10 or raznitsa % 100 >= 20):
|
|
|
|
|
p = 1
|
|
|
|
|
else:
|
|
|
|
|
p = 2
|
|
|
|
|
num=(str(raznitsa) + ' ' + days[p])
|
|
|
|
|
|
|
|
|
|
await message.reply(f'Сегодня {cd} \nВремя: {ct2} \nДо Нового Года осталось {num}')
|
2022-11-04 19:05:33 +10:00
|
|
|
|
|
|
|
|
|
#####______________________ПИПИСА БОТ БУДЕТ ЗДЕСЬ__________________________________
|
2022-11-04 19:09:26 +10:00
|
|
|
|
|
|
|
|
|
|
2022-11-11 18:18:16 +10:00
|
|
|
|
|
|
|
|
|
|
2022-11-15 15:25:08 +10:00
|
|
|
|
|
|
|
|
|
@dp.message_handler(commands=["dick"])
|
2022-11-07 17:10:21 +10:00
|
|
|
|
async def ident(message: types.Message):
|
2022-11-12 20:36:08 +10:00
|
|
|
|
# рандомайзер
|
|
|
|
|
numb = randint(-7,10)
|
|
|
|
|
global size_change, dick_plus, dick_minus
|
2022-11-22 22:01:48 +10:00
|
|
|
|
dick_plus = f'<b>вырос</b> 🚀 на <b>{numb}</b> см!'
|
|
|
|
|
dick_minus = f'<b>уменьшился</b> на <b>{abs(numb)}</b> см!😔'
|
2022-11-12 20:36:08 +10:00
|
|
|
|
if numb > 0:
|
|
|
|
|
size_change = dick_plus
|
|
|
|
|
else: size_change = dick_minus
|
|
|
|
|
####
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-11 18:18:16 +10:00
|
|
|
|
# работа с таблицей
|
2022-11-12 20:36:08 +10:00
|
|
|
|
engine = create_engine('postgresql+psycopg2://postgres:postgres@postgres.vdk2ch.ru:5432/jack_bot', echo=True)
|
2022-11-11 18:18:16 +10:00
|
|
|
|
Session = sessionmaker(bind=engine)
|
|
|
|
|
session = Session()
|
|
|
|
|
Base = declarative_base()
|
2022-11-13 19:24:33 +10:00
|
|
|
|
if session.query(user).filter(user.user_id == message.from_user.id).first():
|
2022-11-15 15:22:57 +10:00
|
|
|
|
b = session.query(user).filter(user.user_id == message.from_user.id).first()
|
|
|
|
|
now_time = datetime.datetime.now()
|
|
|
|
|
last_time = b.datetimes
|
2022-11-18 18:01:02 +10:00
|
|
|
|
diff = now_time.day - last_time.day
|
|
|
|
|
|
2022-11-18 16:39:34 +10:00
|
|
|
|
|
2022-11-18 18:01:02 +10:00
|
|
|
|
if diff <= 0:
|
2022-11-22 22:01:48 +10:00
|
|
|
|
await bot.send_message(message.chat.id, f'@{message.from_user.username},🚫 вы уже крутили пипису, ее размер <b>{b.dick_size}</b> см! ')
|
2022-11-18 15:28:22 +10:00
|
|
|
|
session.close_all()
|
2022-11-18 16:56:41 +10:00
|
|
|
|
print(diff)
|
|
|
|
|
print(type(diff))
|
2022-11-18 15:28:22 +10:00
|
|
|
|
else:
|
2022-11-15 15:22:57 +10:00
|
|
|
|
a = session.query(user).filter(user.user_id == message.from_user.id).first() # запрос на поиск в таблице
|
|
|
|
|
a.dick_size = (a.dick_size + numb)
|
|
|
|
|
a.datetimes = datetime.datetime.now()
|
|
|
|
|
session.commit() #обновляет запись
|
2022-11-18 18:39:21 +10:00
|
|
|
|
await bot.send_message(message.chat.id, f'@{message.from_user.username}, ваш писюн {size_change}\n\
|
2022-11-22 21:42:04 +10:00
|
|
|
|
Теперь он равен <b>{a.dick_size}</b> см! ')
|
2022-11-15 15:22:57 +10:00
|
|
|
|
session.close_all()
|
2022-11-13 19:01:53 +10:00
|
|
|
|
|
2022-11-13 19:24:33 +10:00
|
|
|
|
else:
|
2022-11-14 00:03:09 +10:00
|
|
|
|
int_table = user(user_id = message.from_user.id, user_fullname = message.from_user.full_name, dick_size = numb, datetimes = datetime.datetime.now())
|
2022-11-13 19:24:33 +10:00
|
|
|
|
session.add(int_table)
|
|
|
|
|
session.commit()
|
2022-11-18 18:39:21 +10:00
|
|
|
|
await bot.send_message(message.chat.id, f'@{message.from_user.username}, ваш писюн {size_change}\n\
|
2022-11-22 21:42:04 +10:00
|
|
|
|
Теперь он равен <b>{int_table.dick_size}</b> см!')
|
2022-11-15 15:22:57 +10:00
|
|
|
|
session.close_all()
|
|
|
|
|
|
2022-11-13 18:37:20 +10:00
|
|
|
|
|
|
|
|
|
# int_table = user(user_id = message.from_user.id, user_fullname = message.from_user.full_name, dick_size = numb) #импортирую юзер из sqdb
|
|
|
|
|
# session.add(int_table)
|
|
|
|
|
# session.commit()
|
2022-11-12 21:57:46 +10:00
|
|
|
|
#обновление
|
2022-11-12 23:18:46 +10:00
|
|
|
|
# dick_update = session.query(user).filter_by(user.user_id = message.from_user.id).update({'dick_size': user.dick_size + numb})
|
2022-11-12 21:57:46 +10:00
|
|
|
|
# session.add(dick_update)
|
|
|
|
|
# session.commit()
|
2022-11-12 23:23:48 +10:00
|
|
|
|
#last_size = session.query(user).filter_by(user_id = message.from_user.id).select_from(dick_size = 'dick_size: ').one()
|
2022-11-11 18:18:16 +10:00
|
|
|
|
|
2022-11-04 19:05:33 +10:00
|
|
|
|
|
|
|
|
|
|
2022-11-04 19:11:40 +10:00
|
|
|
|
#####______________________ПИПИСА БОТ БУДЕТ ЗДЕСЬ__________________________________
|
2022-11-03 01:01:08 +10:00
|
|
|
|
|
2022-11-15 17:45:33 +10:00
|
|
|
|
@dp.message_handler(commands=["topdick"])
|
|
|
|
|
async def send_time(message: types.Message):
|
|
|
|
|
engine = create_engine('postgresql+psycopg2://postgres:postgres@postgres.vdk2ch.ru:5432/jack_bot', echo=True)
|
|
|
|
|
Session = sessionmaker(bind=engine)
|
|
|
|
|
session = Session()
|
|
|
|
|
Base = declarative_base()
|
2022-11-22 22:14:22 +10:00
|
|
|
|
|
2022-11-23 00:45:45 +10:00
|
|
|
|
top = session.query(user.user_fullname, user.dick_size).order_by(user.dick_size.desc()).limit(10).all()
|
2022-11-24 18:31:18 +10:00
|
|
|
|
delimiter = ': '
|
|
|
|
|
|
2022-11-24 18:33:05 +10:00
|
|
|
|
await bot.send_message(message.chat.id, f'<u>Топ пипис!</u>\n\
|
|
|
|
|
<b>1.</b>{delimiter.join(map(str, top[0]))}\n\
|
|
|
|
|
<b>2.</b> {delimiter.join(map(str, top[1]))}\n\
|
|
|
|
|
<b>3.</b>3{delimiter.join(map(str, top[2]))}\n\
|
|
|
|
|
<b>4.</b>{delimiter.join(map(str, top[3]))}\n\
|
|
|
|
|
<b>5.</b>{delimiter.join(map(str, top[4]))}\n\
|
|
|
|
|
<b>6.</b>{delimiter.join(map(str, top[5]))}\n\
|
|
|
|
|
<b>7.</b>{delimiter.join(map(str, top[6]))}\n\
|
|
|
|
|
<b>8.</b>{delimiter.join(map(str, top[7]))}\n\
|
|
|
|
|
<b>9.</b>{delimiter.join(map(str, top[8]))}\n\
|
2022-11-24 18:33:38 +10:00
|
|
|
|
<b>10.</b>{delimiter.join(map(str, top[9]))}\n')
|
2022-11-23 00:20:08 +10:00
|
|
|
|
session.close_all()
|
2022-11-12 20:36:08 +10:00
|
|
|
|
|
2022-10-29 14:04:56 +10:00
|
|
|
|
@dp.message_handler(commands=['start'])
|
2022-10-29 14:26:58 +10:00
|
|
|
|
async def start_func(message: types.Message):
|
2022-10-30 21:23:07 +10:00
|
|
|
|
# user_id = message.from_user.id
|
|
|
|
|
# user_full_name = message.from_user.full_name
|
|
|
|
|
# logging.INFO(f'{user_id=} {user_full_name=}', {time.asctime()})
|
2022-11-02 23:10:27 +10:00
|
|
|
|
await message.reply('похуй')
|
2022-10-30 20:49:19 +10:00
|
|
|
|
|
|
|
|
|
@dp.message_handler(commands=['photo'])
|
2022-10-30 21:17:21 +10:00
|
|
|
|
async def send_image(message: types.Message):
|
2022-11-02 23:10:27 +10:00
|
|
|
|
await bot.send_photo(message.chat.id, photo='https://memepedia.ru/wp-content/uploads/2018/08/ya-pidoras.jpg', reply_to_message_id=message.message_id)
|
2022-10-30 20:49:19 +10:00
|
|
|
|
|
2022-11-01 20:22:58 +10:00
|
|
|
|
@dp.message_handler(content_types=types.ContentTypes.TEXT)
|
2022-11-01 19:40:45 +10:00
|
|
|
|
async def send_faggot(message: types.Message):
|
2022-11-01 20:14:33 +10:00
|
|
|
|
print(message.text)
|
|
|
|
|
if message.text == 'хто я':
|
|
|
|
|
await bot.send_photo(message.chat.id, photo='https://www.meme-arsenal.com/memes/ecebd2339c7eab40e09874bd86a38a09.jpg')
|
2022-11-01 18:52:08 +10:00
|
|
|
|
|
2022-10-30 21:20:49 +10:00
|
|
|
|
#хуй
|
2022-10-29 14:04:56 +10:00
|
|
|
|
|
2022-10-18 19:17:36 +10:00
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
executor.start_polling(dp, skip_updates=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|