mirror of
https://github.com/Llloooggg/TextSouls.git
synced 2026-03-06 20:46:23 +03:00
not working mess
This commit is contained in:
16
backend/textsouls/telegram/tasks.py
Normal file
16
backend/textsouls/telegram/tasks.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from textsouls.common.database import db
|
||||
from textsouls import celery
|
||||
|
||||
from textsouls.users.models import User, Sendlist, SendlistDestination
|
||||
|
||||
|
||||
@celery.task()
|
||||
def broadcast_message(message):
|
||||
sendlist = Sendlist(message=message)
|
||||
db.session.add(sendlist)
|
||||
db.session.commit()
|
||||
for user in User.query.all():
|
||||
db.session.add(
|
||||
SendlistDestination(sendlist_id=sendlist.id, user_id=user.id)
|
||||
)
|
||||
db.session.commit()
|
||||
Reference in New Issue
Block a user