25 lines
565 B
Python
25 lines
565 B
Python
from datetime import datetime
|
|
|
|
import csv
|
|
|
|
import asyncio
|
|
|
|
from payphone.db import setup, models
|
|
|
|
|
|
async def main():
|
|
await setup.init()
|
|
|
|
with open("bans.csv", "r", encoding="latin-1") as f:
|
|
reader = csv.reader(f)
|
|
|
|
for row in reader:
|
|
user_id = int(row[1])
|
|
reason = row[2].strip()[:500]
|
|
expires = datetime.fromisoformat(row[9].strip()) if row[9].strip() else None
|
|
|
|
await models.Ban.create(user_id=user_id, reason=reason, expires_at=expires)
|
|
|
|
|
|
asyncio.get_event_loop().run_until_complete(main())
|