azils3/bash
0
1# Ultroid - UserBot2# Copyright (C) 2021-2025 TeamUltroid3#4# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >5# PLease read the GNU Affero General Public License in6# <https://github.com/TeamUltroid/pyUltroid/blob/main/LICENSE>.7 8from .. import udB9 10 11def get_stuff():12 return udB.get_key("WARNS") or {}13 14 15def add_warn(chat, user, count, reason):16 x = get_stuff()17 try:18 x[chat].update({user: [count, reason]})19 except BaseException:20 x.update({chat: {user: [count, reason]}})21 return udB.set_key("WARNS", x)22 23 24def warns(chat, user):25 x = get_stuff()26 try:27 count, reason = x[chat][user][0], x[chat][user][1]28 return count, reason29 except BaseException:30 return 0, None31 32 33def reset_warn(chat, user):34 x = get_stuff()35 try:36 x[chat].pop(user)37 return udB.set_key("WARNS", x)38 except BaseException:39 return40 