mirror of
https://github.com/Paillat-dev/Botator.git
synced 2026-01-02 01:06:19 +00:00
🐛 fix(chat.py): fix import statement for banusr module ✨ feat(chat.py): add functionality to ban and unban users with botator!ban and botator!unban commands ✨ feat(chat.py): add functionality to send messages from banned users after a delay ✨ feat(banusr.py): create banusr module to handle banning and unbanning of users ✨ feat(banusr.py): add functionality to ban a user by appending their ID to banend_users list ✨ feat(banusr.py): add functionality to unban a user by removing their ID from banend_users list
23 lines
704 B
Python
23 lines
704 B
Python
import os
|
|
import orjson
|
|
|
|
banend_users_path = "./database/banend_users.json"
|
|
if not os.path.exists(banend_users_path):
|
|
with open(banend_users_path, "w", encoding="utf-8") as file:
|
|
file.write("[]")
|
|
|
|
with open("./database/banend_users.json", "r", encoding="utf-8") as file:
|
|
banend_users = orjson.loads(file.read())
|
|
|
|
|
|
async def banuser(id):
|
|
banend_users.append(id)
|
|
with open("./database/banend_users.json", "w", encoding="utf-8") as file:
|
|
file.write(orjson.dumps(banend_users).decode())
|
|
|
|
|
|
async def unbanuser(id):
|
|
banend_users.remove(id)
|
|
with open("./database/banend_users.json", "w", encoding="utf-8") as file:
|
|
file.write(orjson.dumps(banend_users).decode())
|