Team Ai
Apppublic

azils3/bash

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
notes_db.py48 linesDownload Raw Back to dB
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("NOTE") or {}13 14 15def add_note(chat, word, msg, media, button):16    ok = get_stuff()17    if ok.get(int(chat)):18        ok[int(chat)].update({word: {"msg": msg, "media": media, "button": button}})19    else:20        ok.update({int(chat): {word: {"msg": msg, "media": media, "button": button}}})21    udB.set_key("NOTE", ok)22 23 24def rem_note(chat, word):25    ok = get_stuff()26    if ok.get(int(chat)) and ok[int(chat)].get(word):27        ok[int(chat)].pop(word)28        return udB.set_key("NOTE", ok)29 30 31def rem_all_note(chat):32    ok = get_stuff()33    if ok.get(int(chat)):34        ok.pop(int(chat))35        return udB.set_key("NOTE", ok)36 37 38def get_notes(chat, word):39    ok = get_stuff()40    if ok.get(int(chat)) and ok[int(chat)].get(word):41        return ok[int(chat)][word]42 43 44def list_note(chat):45    ok = get_stuff()46    if ok.get(int(chat)):47        return "".join(f"👉 #{z}\n" for z in ok[chat])48