Merge branch 'main' of https://git.frik.su/n0one/CatBot
This commit is contained in:
BIN
requirements.txt
Normal file
BIN
requirements.txt
Normal file
Binary file not shown.
BIN
src/.DS_Store
vendored
BIN
src/.DS_Store
vendored
Binary file not shown.
@ -1,7 +1,8 @@
|
|||||||
from minio import Minio
|
from minio import Minio
|
||||||
from random import randint
|
from random import randint
|
||||||
import DBwork
|
import DBwork
|
||||||
import config
|
from src import config
|
||||||
|
|
||||||
|
|
||||||
def _setClient():
|
def _setClient():
|
||||||
minio_client = Minio(
|
minio_client = Minio(
|
||||||
|
|||||||
@ -1,9 +0,0 @@
|
|||||||
IS_address = "localhost:9000"
|
|
||||||
acc_key = "minioadmin"
|
|
||||||
sec_key = "minioadmin"
|
|
||||||
db_name = "postgres_db"
|
|
||||||
postgres_user = "postgres_user"
|
|
||||||
postgres_password = "postgres_password"
|
|
||||||
host_name = "localhost"
|
|
||||||
port = "5430"
|
|
||||||
bucket_name = "cat-images"
|
|
||||||
@ -1,5 +1,6 @@
|
|||||||
import psycopg2
|
import psycopg2
|
||||||
import config
|
from src import config
|
||||||
|
|
||||||
|
|
||||||
def get_last_id(cursor):
|
def get_last_id(cursor):
|
||||||
cursor.execute("SELECT MAX(id) FROM usernames")
|
cursor.execute("SELECT MAX(id) FROM usernames")
|
||||||
|
|||||||
BIN
src/Frontend/.DS_Store
vendored
BIN
src/Frontend/.DS_Store
vendored
Binary file not shown.
37
src/Frontend/createbot.py
Normal file
37
src/Frontend/createbot.py
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
from src import config
|
||||||
|
import asyncio
|
||||||
|
import logging
|
||||||
|
from aiogram import Bot, Dispatcher, F, Router
|
||||||
|
from aiogram.filters import Command
|
||||||
|
from aiogram.types import Message
|
||||||
|
from aiogram.client.default import DefaultBotProperties
|
||||||
|
from aiogram.enums import ParseMode
|
||||||
|
from aiogram.fsm.storage.memory import MemoryStorage
|
||||||
|
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
||||||
|
|
||||||
|
|
||||||
|
start_router = Router()
|
||||||
|
scheduler = AsyncIOScheduler(timezone = 'Europe/Moscow')
|
||||||
|
|
||||||
|
|
||||||
|
logging.basicConfig(level = logging.INFO, format = '%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
bot = Bot(token = config.TG_TOKEN , default = DefaultBotProperties(parse_mode = ParseMode.HTML))
|
||||||
|
dp = Dispatcher(storage = MemoryStorage())
|
||||||
|
|
||||||
|
|
||||||
|
@dp.message(Command('start'))
|
||||||
|
async def cmd_start(message: Message):
|
||||||
|
await message.answer('Запуск сообщения по команде /start используя фильтр CommandStart()')
|
||||||
|
|
||||||
|
|
||||||
|
@dp.message(F.text)
|
||||||
|
async def basic_reaction(message: Message):
|
||||||
|
if message.text != '':
|
||||||
|
await message.answer(message.text)
|
||||||
|
|
||||||
|
|
||||||
|
async def main():
|
||||||
|
await dp.start_polling(bot)
|
||||||
|
|
||||||
5
src/__main__.py
Normal file
5
src/__main__.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import asyncio
|
||||||
|
from Frontend.createbot import main
|
||||||
|
|
||||||
|
|
||||||
|
asyncio.run(main())
|
||||||
16
src/config.py
Normal file
16
src/config.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
from decouple import config
|
||||||
|
|
||||||
|
|
||||||
|
IS_address = config('IS_address')
|
||||||
|
acc_key = config('acc_key')
|
||||||
|
sec_key = config('sec_key')
|
||||||
|
db_name = config('db_name')
|
||||||
|
postgres_user = config('postgres_user')
|
||||||
|
postgres_password = config('postgres_password')
|
||||||
|
host_name = config('host_name')
|
||||||
|
port = config('port')
|
||||||
|
bucket_name = 'cat-images'
|
||||||
|
|
||||||
|
|
||||||
|
TG_TOKEN = config('TG_TOKEN')
|
||||||
|
# ADMINS = [int(admin_id) for admin_id in config('ADMINS').split(',')]
|
||||||
Reference in New Issue
Block a user