+ Telegram bot: sign up, sign in, notifications + Anonymous users can't see yuan_rate_commission * Only logged in customers can create/update orders * Customer info migrated to separate User model * Renamed legacy fields in serializers * Cleanup in API classes
38 lines
796 B
Python
38 lines
796 B
Python
import os
|
|
import asyncio
|
|
import logging
|
|
import sys
|
|
|
|
import django
|
|
import telebot
|
|
from telebot import asyncio_filters
|
|
|
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'poizonstore.settings')
|
|
django.setup()
|
|
|
|
from tg_bot.bot import bot, commands
|
|
from tg_bot.handlers import register_handlers
|
|
|
|
|
|
logger = telebot.logger
|
|
telebot.logger.setLevel(logging.DEBUG)
|
|
|
|
|
|
async def setup():
|
|
await bot.delete_my_commands(scope=None, language_code=None)
|
|
|
|
bot.add_custom_filter(asyncio_filters.StateFilter(bot))
|
|
register_handlers()
|
|
await bot.set_my_commands(commands=commands)
|
|
|
|
|
|
async def main():
|
|
logger.info("bot starting...")
|
|
await setup()
|
|
await bot.infinity_polling()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
logging.basicConfig(level=logging.INFO, stream=sys.stdout)
|
|
asyncio.run(main())
|