mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2025-06-21 13:18:22 +02:00
Add script to fix channel permissions
This commit is contained in:
0
apps/participation/management/commands/__init__.py
Normal file
0
apps/participation/management/commands/__init__.py
Normal file
@ -0,0 +1,25 @@
|
||||
from asgiref.sync import async_to_sync
|
||||
from nio import RoomPreset
|
||||
|
||||
from corres2math.matrix import Matrix, RoomVisibility
|
||||
from django.core.management import BaseCommand
|
||||
from registration.models import AdminRegistration
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
def handle(self, *args, **options):
|
||||
Matrix.set_display_name("Bot des Correspondances")
|
||||
|
||||
if not async_to_sync(Matrix.resolve_room_alias)("#faq:correspondances-maths.fr"):
|
||||
Matrix.create_room(
|
||||
visibility=RoomVisibility.public,
|
||||
alias="faq",
|
||||
name="FAQ",
|
||||
topic="Posez toutes vos questions ici !",
|
||||
federate=False,
|
||||
preset=RoomPreset.public_chat,
|
||||
)
|
||||
|
||||
for admin in AdminRegistration.objects.all():
|
||||
Matrix.set_room_power_level("#faq:correspondances-maths.fr",
|
||||
f"@{admin.matrix_username}:correspondances-maths.fr", 95)
|
Reference in New Issue
Block a user