Upload 20 files
Browse files- pyUltroid/dB/__init__.py +65 -0
- pyUltroid/dB/afk_db.py +33 -0
- pyUltroid/dB/antiflood_db.py +32 -0
- pyUltroid/dB/asstcmd_db.py +39 -0
- pyUltroid/dB/base.py +44 -0
- pyUltroid/dB/blacklist_chat_db.py +15 -0
- pyUltroid/dB/blacklist_db.py +44 -0
- pyUltroid/dB/botchat_db.py +41 -0
- pyUltroid/dB/echo_db.py +43 -0
- pyUltroid/dB/filestore_db.py +35 -0
- pyUltroid/dB/filter_db.py +47 -0
- pyUltroid/dB/forcesub_db.py +35 -0
- pyUltroid/dB/gban_mute_db.py +52 -0
- pyUltroid/dB/greetings_db.py +66 -0
- pyUltroid/dB/mute_db.py +34 -0
- pyUltroid/dB/notes_db.py +47 -0
- pyUltroid/dB/nsfw_db.py +51 -0
- pyUltroid/dB/snips_db.py +36 -0
- pyUltroid/dB/vc_sudos.py +29 -0
- pyUltroid/dB/warn_db.py +39 -0
pyUltroid/dB/__init__.py
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .. import run_as_module
|
| 2 |
+
|
| 3 |
+
if not run_as_module:
|
| 4 |
+
from ..exceptions import RunningAsFunctionLibError
|
| 5 |
+
|
| 6 |
+
raise RunningAsFunctionLibError(
|
| 7 |
+
"You are running 'pyUltroid' as a functions lib, not as run module. You can't access this folder.."
|
| 8 |
+
)
|
| 9 |
+
|
| 10 |
+
from .. import *
|
| 11 |
+
|
| 12 |
+
DEVLIST = [
|
| 13 |
+
719195224, # @xditya
|
| 14 |
+
1322549723, # @danish_00
|
| 15 |
+
1903729401, # @its_buddhhu
|
| 16 |
+
1303895686, # @Sipak_OP
|
| 17 |
+
611816596, # @Arnab431
|
| 18 |
+
1318486004, # @sppidy
|
| 19 |
+
803243487, # @hellboi_atul
|
| 20 |
+
]
|
| 21 |
+
|
| 22 |
+
ULTROID_IMAGES = [
|
| 23 |
+
f"https://graph.org/file/{_}.jpg"
|
| 24 |
+
for _ in [
|
| 25 |
+
"ec250c66268b62ee4ade6",
|
| 26 |
+
"3c25230ae30d246194eba",
|
| 27 |
+
"b01715a61b9e876c0d45d",
|
| 28 |
+
"4ceaf720a96a24527ecff",
|
| 29 |
+
"a96223b574f29f3f0d184",
|
| 30 |
+
"6e081d339a01cc6190393",
|
| 31 |
+
]
|
| 32 |
+
]
|
| 33 |
+
|
| 34 |
+
stickers = [
|
| 35 |
+
"CAADAQADeAIAAm_BZBQh8owdViocCAI",
|
| 36 |
+
"CAADAQADegIAAm_BZBQ6j8GpKtnrSgI",
|
| 37 |
+
"CAADAQADfAIAAm_BZBQpqC84n9JNXgI",
|
| 38 |
+
"CAADAQADfgIAAm_BZBSxLmTyuHvlzgI",
|
| 39 |
+
"CAADAQADgAIAAm_BZBQ3TZaueMkS-gI",
|
| 40 |
+
"CAADAQADggIAAm_BZBTPcbJMorVVsQI",
|
| 41 |
+
"CAADAQADhAIAAm_BZBR3lnMZRdsYxAI",
|
| 42 |
+
"CAADAQADhgIAAm_BZBQGQRx4iaM4pQI",
|
| 43 |
+
"CAADAQADiAIAAm_BZBRRF-cjJi_QywI",
|
| 44 |
+
"CAADAQADigIAAm_BZBQQJwfzkqLM0wI",
|
| 45 |
+
"CAADAQADjAIAAm_BZBQSl5GSAT0viwI",
|
| 46 |
+
"CAADAQADjgIAAm_BZBQ2xU688gfHhQI",
|
| 47 |
+
"CAADAQADkAIAAm_BZBRGuPNgVvkoHQI",
|
| 48 |
+
"CAADAQADpgIAAm_BZBQAAZr0SJ5EKtQC",
|
| 49 |
+
"CAADAQADkgIAAm_BZBTvuxuayqvjhgI",
|
| 50 |
+
"CAADAQADlAIAAm_BZBSMZdWN2Yew1AI",
|
| 51 |
+
"CAADAQADlQIAAm_BZBRXyadiwWGNkwI",
|
| 52 |
+
"CAADAQADmAIAAm_BZBQDoB15A1jS1AI",
|
| 53 |
+
"CAADAQADmgIAAm_BZBTnOLQ8_d72vgI",
|
| 54 |
+
"CAADAQADmwIAAm_BZBTve1kgdG0Y5gI",
|
| 55 |
+
"CAADAQADnAIAAm_BZBQUMyFiylJSqQI",
|
| 56 |
+
"CAADAQADnQIAAm_BZBSMAe2V4pwhNgI",
|
| 57 |
+
"CAADAQADngIAAm_BZBQ06D92QL_vywI",
|
| 58 |
+
"CAADAQADnwIAAm_BZBRw7UAbr6vtEgI",
|
| 59 |
+
"CAADAQADoAIAAm_BZBRkv9DnGPXh_wI",
|
| 60 |
+
"CAADAQADoQIAAm_BZBQwI2NgQdyKlwI",
|
| 61 |
+
"CAADAQADogIAAm_BZBRPHJF3XChVLgI",
|
| 62 |
+
"CAADAQADowIAAm_BZBThpas7rZD6DAI",
|
| 63 |
+
"CAADAQADpAIAAm_BZBQcC2DpZcCw1wI",
|
| 64 |
+
"CAADAQADpQIAAm_BZBQKruTcEU4ntwI",
|
| 65 |
+
]
|
pyUltroid/dB/afk_db.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Ultroid - UserBot
|
| 2 |
+
# Copyright (C) 2021-2025 TeamUltroid
|
| 3 |
+
#
|
| 4 |
+
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
| 5 |
+
# PLease read the GNU Affero General Public License in
|
| 6 |
+
# <https://github.com/TeamUltroid/pyUltroid/blob/main/LICENSE>.
|
| 7 |
+
|
| 8 |
+
from datetime import datetime as dt
|
| 9 |
+
|
| 10 |
+
from .. import udB
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def get_stuff():
|
| 14 |
+
return udB.get_key("AFK_DB") or []
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def add_afk(msg, media_type, media):
|
| 18 |
+
time = dt.now().strftime("%b %d %Y %I:%M:%S%p")
|
| 19 |
+
udB.set_key("AFK_DB", [msg, media_type, media, time])
|
| 20 |
+
return
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def is_afk():
|
| 24 |
+
afk = get_stuff()
|
| 25 |
+
if afk:
|
| 26 |
+
start_time = dt.strptime(afk[3], "%b %d %Y %I:%M:%S%p")
|
| 27 |
+
afk_since = str(dt.now().replace(microsecond=0) - start_time)
|
| 28 |
+
return afk[0], afk[1], afk[2], afk_since
|
| 29 |
+
return False
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
def del_afk():
|
| 33 |
+
return udB.del_key("AFK_DB")
|
pyUltroid/dB/antiflood_db.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Ultroid - UserBot
|
| 2 |
+
# Copyright (C) 2021-2025 TeamUltroid
|
| 3 |
+
#
|
| 4 |
+
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
| 5 |
+
# PLease read the GNU Affero General Public License in
|
| 6 |
+
# <https://github.com/TeamUltroid/pyUltroid/blob/main/LICENSE>.
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
from .. import udB
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def get_flood():
|
| 13 |
+
return udB.get_key("ANTIFLOOD") or {}
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
def set_flood(chat_id, limit):
|
| 17 |
+
omk = get_flood()
|
| 18 |
+
omk.update({chat_id: limit})
|
| 19 |
+
return udB.set_key("ANTIFLOOD", omk)
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def get_flood_limit(chat_id):
|
| 23 |
+
omk = get_flood()
|
| 24 |
+
if chat_id in omk.keys():
|
| 25 |
+
return omk[chat_id]
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def rem_flood(chat_id):
|
| 29 |
+
omk = get_flood()
|
| 30 |
+
if chat_id in omk.keys():
|
| 31 |
+
del omk[chat_id]
|
| 32 |
+
return udB.set_key("ANTIFLOOD", omk)
|
pyUltroid/dB/asstcmd_db.py
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Ultroid - UserBot
|
| 2 |
+
# Copyright (C) 2021-2025 TeamUltroid
|
| 3 |
+
#
|
| 4 |
+
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
| 5 |
+
# PLease read the GNU Affero General Public License in
|
| 6 |
+
# <https://github.com/TeamUltroid/pyUltroid/blob/main/LICENSE>.
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
from .. import udB
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def get_stuff():
|
| 13 |
+
return udB.get_key("ASST_CMDS") or {}
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
def add_cmd(cmd, msg, media, button):
|
| 17 |
+
ok = get_stuff()
|
| 18 |
+
ok.update({cmd: {"msg": msg, "media": media, "button": button}})
|
| 19 |
+
return udB.set_key("ASST_CMDS", ok)
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def rem_cmd(cmd):
|
| 23 |
+
ok = get_stuff()
|
| 24 |
+
if ok.get(cmd):
|
| 25 |
+
ok.pop(cmd)
|
| 26 |
+
return udB.set_key("ASST_CMDS", ok)
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def cmd_reply(cmd):
|
| 30 |
+
ok = get_stuff()
|
| 31 |
+
if ok.get(cmd):
|
| 32 |
+
okk = ok[cmd]
|
| 33 |
+
return okk["msg"], okk["media"], okk["button"] if ok.get("button") else None
|
| 34 |
+
return
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def list_cmds():
|
| 38 |
+
ok = get_stuff()
|
| 39 |
+
return ok.keys()
|
pyUltroid/dB/base.py
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .. import udB
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
class KeyManager:
|
| 5 |
+
def __init__(self, key, cast=None) -> None:
|
| 6 |
+
self._key = key
|
| 7 |
+
self._cast = cast
|
| 8 |
+
|
| 9 |
+
def get(self):
|
| 10 |
+
_data = udB.get_key(self._key)
|
| 11 |
+
if self._cast and not isinstance(_data, self._cast):
|
| 12 |
+
return [_data] if self._cast == list else self._cast(_data)
|
| 13 |
+
return _data or (self._cast() if callable(self._cast) else self._cast)
|
| 14 |
+
|
| 15 |
+
def get_child(self, key):
|
| 16 |
+
return self.get()[key]
|
| 17 |
+
|
| 18 |
+
def count(self):
|
| 19 |
+
return len(self.get())
|
| 20 |
+
|
| 21 |
+
def add(self, item):
|
| 22 |
+
content = self.get()
|
| 23 |
+
if content == None and callable(type(item)):
|
| 24 |
+
content = type(item)()
|
| 25 |
+
if isinstance(content, dict) and isinstance(item, dict):
|
| 26 |
+
content.update(item)
|
| 27 |
+
elif isinstance(content, list) and item not in content:
|
| 28 |
+
content.append(item)
|
| 29 |
+
else:
|
| 30 |
+
return
|
| 31 |
+
udB.set_key(self._key, content)
|
| 32 |
+
|
| 33 |
+
def remove(self, item):
|
| 34 |
+
content = self.get()
|
| 35 |
+
if isinstance(content, list) and item in content:
|
| 36 |
+
content.remove(item)
|
| 37 |
+
elif isinstance(content, dict) and content.get(item):
|
| 38 |
+
del content[item]
|
| 39 |
+
else:
|
| 40 |
+
return
|
| 41 |
+
udB.set_key(self._key, content)
|
| 42 |
+
|
| 43 |
+
def contains(self, item):
|
| 44 |
+
return item in self.get()
|
pyUltroid/dB/blacklist_chat_db.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .. import udB
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
def add_black_chat(chat_id):
|
| 5 |
+
chat = udB.get_key("BLACKLIST_CHATS") or []
|
| 6 |
+
if chat_id not in chat:
|
| 7 |
+
chat.append(chat_id)
|
| 8 |
+
return udB.set_key("BLACKLIST_CHATS", chat)
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def rem_black_chat(chat_id):
|
| 12 |
+
chat = udB.get_key("BLACKLIST_CHATS") or []
|
| 13 |
+
if chat_id in chat:
|
| 14 |
+
chat.remove(chat_id)
|
| 15 |
+
return udB.set_key("BLACKLIST_CHATS", chat)
|
pyUltroid/dB/blacklist_db.py
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Ultroid - UserBot
|
| 2 |
+
# Copyright (C) 2021-2025 TeamUltroid
|
| 3 |
+
#
|
| 4 |
+
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
| 5 |
+
# PLease read the GNU Affero General Public License in
|
| 6 |
+
# <https://github.com/TeamUltroid/pyUltroid/blob/main/LICENSE>.
|
| 7 |
+
|
| 8 |
+
from .. import udB
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def get_stuff():
|
| 12 |
+
return udB.get_key("BLACKLIST_DB") or {}
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def add_blacklist(chat, word):
|
| 16 |
+
ok = get_stuff()
|
| 17 |
+
if ok.get(chat):
|
| 18 |
+
for z in word.split():
|
| 19 |
+
if z not in ok[chat]:
|
| 20 |
+
ok[chat].append(z)
|
| 21 |
+
else:
|
| 22 |
+
ok.update({chat: [word]})
|
| 23 |
+
return udB.set_key("BLACKLIST_DB", ok)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def rem_blacklist(chat, word):
|
| 27 |
+
ok = get_stuff()
|
| 28 |
+
if ok.get(chat) and word in ok[chat]:
|
| 29 |
+
ok[chat].remove(word)
|
| 30 |
+
return udB.set_key("BLACKLIST_DB", ok)
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
def list_blacklist(chat):
|
| 34 |
+
ok = get_stuff()
|
| 35 |
+
if ok.get(chat):
|
| 36 |
+
txt = "".join(f"π`{z}`\n" for z in ok[chat])
|
| 37 |
+
if txt:
|
| 38 |
+
return txt
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
def get_blacklist(chat):
|
| 42 |
+
ok = get_stuff()
|
| 43 |
+
if ok.get(chat):
|
| 44 |
+
return ok[chat]
|
pyUltroid/dB/botchat_db.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Ultroid - UserBot
|
| 2 |
+
# Copyright (C) 2021-2025 TeamUltroid
|
| 3 |
+
#
|
| 4 |
+
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
| 5 |
+
# PLease read the GNU Affero General Public License in
|
| 6 |
+
# <https://github.com/TeamUltroid/pyUltroid/blob/main/LICENSE>.
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
from .. import udB
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def get_stuff():
|
| 13 |
+
return udB.get_key("BOTCHAT") or {}
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
def add_stuff(msg_id, user_id):
|
| 17 |
+
ok = get_stuff()
|
| 18 |
+
ok.update({msg_id: user_id})
|
| 19 |
+
return udB.set_key("BOTCHAT", ok)
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def get_who(msg_id):
|
| 23 |
+
ok = get_stuff()
|
| 24 |
+
if ok.get(msg_id):
|
| 25 |
+
return ok[msg_id]
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def tag_add(msg, chat, user):
|
| 29 |
+
ok = get_stuff()
|
| 30 |
+
if not ok.get("TAG"):
|
| 31 |
+
ok.update({"TAG": {msg: [chat, user]}})
|
| 32 |
+
else:
|
| 33 |
+
ok["TAG"].update({msg: [chat, user]})
|
| 34 |
+
return udB.set_key("BOTCHAT", ok)
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def who_tag(msg):
|
| 38 |
+
ok = get_stuff()
|
| 39 |
+
if ok.get("TAG") and ok["TAG"].get(msg):
|
| 40 |
+
return ok["TAG"][msg]
|
| 41 |
+
return False, False
|
pyUltroid/dB/echo_db.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Ultroid - UserBot
|
| 2 |
+
# Copyright (C) 2021-2025 TeamUltroid
|
| 3 |
+
#
|
| 4 |
+
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
| 5 |
+
# PLease read the GNU Affero General Public License in
|
| 6 |
+
# <https://github.com/TeamUltroid/pyUltroid/blob/main/LICENSE>.
|
| 7 |
+
|
| 8 |
+
from .. import udB
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def get_stuff():
|
| 12 |
+
return udB.get_key("ECHO") or {}
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def add_echo(chat, user):
|
| 16 |
+
x = get_stuff()
|
| 17 |
+
if k := x.get(int(chat)):
|
| 18 |
+
if user not in k:
|
| 19 |
+
k.append(int(user))
|
| 20 |
+
x.update({int(chat): k})
|
| 21 |
+
else:
|
| 22 |
+
x.update({int(chat): [int(user)]})
|
| 23 |
+
return udB.set_key("ECHO", x)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def rem_echo(chat, user):
|
| 27 |
+
x = get_stuff()
|
| 28 |
+
if k := x.get(int(chat)):
|
| 29 |
+
if user in k:
|
| 30 |
+
k.remove(int(user))
|
| 31 |
+
x.update({int(chat): k})
|
| 32 |
+
return udB.set_key("ECHO", x)
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def check_echo(chat, user):
|
| 36 |
+
x = get_stuff()
|
| 37 |
+
if (k := x.get(int(chat))) and int(user) in k:
|
| 38 |
+
return True
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
def list_echo(chat):
|
| 42 |
+
x = get_stuff()
|
| 43 |
+
return x.get(int(chat))
|
pyUltroid/dB/filestore_db.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Ultroid - UserBot
|
| 2 |
+
# Copyright (C) 2021-2025 TeamUltroid
|
| 3 |
+
#
|
| 4 |
+
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
| 5 |
+
# PLease read the GNU Affero General Public License in
|
| 6 |
+
# <https://github.com/TeamUltroid/pyUltroid/blob/main/LICENSE>.
|
| 7 |
+
|
| 8 |
+
from .. import udB
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def get_stored():
|
| 12 |
+
return udB.get_key("FILE_STORE") or {}
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def store_msg(hash, msg_id):
|
| 16 |
+
all = get_stored()
|
| 17 |
+
all.update({hash: msg_id})
|
| 18 |
+
return udB.set_key("FILE_STORE", all)
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def list_all_stored_msgs():
|
| 22 |
+
all = get_stored()
|
| 23 |
+
return list(all.keys())
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def get_stored_msg(hash):
|
| 27 |
+
all = get_stored()
|
| 28 |
+
if all.get(hash):
|
| 29 |
+
return all[hash]
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
def del_stored(hash):
|
| 33 |
+
all = get_stored()
|
| 34 |
+
all.pop(hash)
|
| 35 |
+
return udB.set_key("FILE_STORE", all)
|
pyUltroid/dB/filter_db.py
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Ultroid - UserBot
|
| 2 |
+
# Copyright (C) 2021-2025 TeamUltroid
|
| 3 |
+
#
|
| 4 |
+
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
| 5 |
+
# PLease read the GNU Affero General Public License in
|
| 6 |
+
# <https://github.com/TeamUltroid/pyUltroid/blob/main/LICENSE>.
|
| 7 |
+
|
| 8 |
+
from .. import udB
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def get_stuff():
|
| 12 |
+
return udB.get_key("FILTERS") or {}
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def add_filter(chat, word, msg, media, button):
|
| 16 |
+
ok = get_stuff()
|
| 17 |
+
if ok.get(chat):
|
| 18 |
+
ok[chat].update({word: {"msg": msg, "media": media, "button": button}})
|
| 19 |
+
else:
|
| 20 |
+
ok.update({chat: {word: {"msg": msg, "media": media, "button": button}}})
|
| 21 |
+
udB.set_key("FILTERS", ok)
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def rem_filter(chat, word):
|
| 25 |
+
ok = get_stuff()
|
| 26 |
+
if ok.get(chat) and ok[chat].get(word):
|
| 27 |
+
ok[chat].pop(word)
|
| 28 |
+
udB.set_key("FILTERS", ok)
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
def rem_all_filter(chat):
|
| 32 |
+
ok = get_stuff()
|
| 33 |
+
if ok.get(chat):
|
| 34 |
+
ok.pop(chat)
|
| 35 |
+
udB.set_key("FILTERS", ok)
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
def get_filter(chat):
|
| 39 |
+
ok = get_stuff()
|
| 40 |
+
if ok.get(chat):
|
| 41 |
+
return ok[chat]
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
def list_filter(chat):
|
| 45 |
+
ok = get_stuff()
|
| 46 |
+
if ok.get(chat):
|
| 47 |
+
return "".join(f"π `{z}`\n" for z in ok[chat])
|
pyUltroid/dB/forcesub_db.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Ultroid - UserBot
|
| 2 |
+
# Copyright (C) 2021-2025 TeamUltroid
|
| 3 |
+
#
|
| 4 |
+
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
| 5 |
+
# PLease read the GNU Affero General Public License in
|
| 6 |
+
# <https://github.com/TeamUltroid/pyUltroid/blob/main/LICENSE>.
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
from .. import udB
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def get_chats():
|
| 13 |
+
return udB.get_key("FORCESUB") or {}
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
def add_forcesub(chat_id, chattojoin):
|
| 17 |
+
omk = get_chats()
|
| 18 |
+
omk.update({chat_id: chattojoin})
|
| 19 |
+
return udB.set_key("FORCESUB", omk)
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def get_forcesetting(chat_id):
|
| 23 |
+
omk = get_chats()
|
| 24 |
+
if chat_id in omk.keys():
|
| 25 |
+
return omk[chat_id]
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def rem_forcesub(chat_id):
|
| 29 |
+
omk = get_chats()
|
| 30 |
+
if chat_id in omk.keys():
|
| 31 |
+
try:
|
| 32 |
+
del omk[chat_id]
|
| 33 |
+
return udB.set_key("FORCESUB", omk)
|
| 34 |
+
except KeyError:
|
| 35 |
+
return False
|
pyUltroid/dB/gban_mute_db.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Ultroid - UserBot
|
| 2 |
+
# Copyright (C) 2021-2025 TeamUltroid
|
| 3 |
+
#
|
| 4 |
+
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
| 5 |
+
# PLease read the GNU Affero General Public License in
|
| 6 |
+
# <https://github.com/TeamUltroid/pyUltroid/blob/main/LICENSE>.
|
| 7 |
+
|
| 8 |
+
from .. import udB
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def list_gbanned():
|
| 12 |
+
return udB.get_key("GBAN") or {}
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def gban(user, reason):
|
| 16 |
+
ok = list_gbanned()
|
| 17 |
+
ok.update({int(user): reason or "No Reason. "})
|
| 18 |
+
return udB.set_key("GBAN", ok)
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def ungban(user):
|
| 22 |
+
ok = list_gbanned()
|
| 23 |
+
if ok.get(int(user)):
|
| 24 |
+
del ok[int(user)]
|
| 25 |
+
return udB.set_key("GBAN", ok)
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def is_gbanned(user):
|
| 29 |
+
ok = list_gbanned()
|
| 30 |
+
if ok.get(int(user)):
|
| 31 |
+
return ok[int(user)]
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def gmute(user):
|
| 35 |
+
ok = list_gmuted()
|
| 36 |
+
ok.append(int(user))
|
| 37 |
+
return udB.set_key("GMUTE", ok)
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
def ungmute(user):
|
| 41 |
+
ok = list_gmuted()
|
| 42 |
+
if user in ok:
|
| 43 |
+
ok.remove(int(user))
|
| 44 |
+
return udB.set_key("GMUTE", ok)
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
def is_gmuted(user):
|
| 48 |
+
return int(user) in list_gmuted()
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def list_gmuted():
|
| 52 |
+
return udB.get_key("GMUTE") or []
|
pyUltroid/dB/greetings_db.py
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Ultroid - UserBot
|
| 2 |
+
# Copyright (C) 2021-2025 TeamUltroid
|
| 3 |
+
#
|
| 4 |
+
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
| 5 |
+
# PLease read the GNU Affero General Public License in
|
| 6 |
+
# <https://github.com/TeamUltroid/pyUltroid/blob/main/LICENSE>.
|
| 7 |
+
|
| 8 |
+
from .. import udB
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def get_stuff(key=None):
|
| 12 |
+
return udB.get_key(key) or {}
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def add_welcome(chat, msg, media, button):
|
| 16 |
+
ok = get_stuff("WELCOME")
|
| 17 |
+
ok.update({chat: {"welcome": msg, "media": media, "button": button}})
|
| 18 |
+
return udB.set_key("WELCOME", ok)
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def get_welcome(chat):
|
| 22 |
+
ok = get_stuff("WELCOME")
|
| 23 |
+
return ok.get(chat)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def delete_welcome(chat):
|
| 27 |
+
ok = get_stuff("WELCOME")
|
| 28 |
+
if ok.get(chat):
|
| 29 |
+
ok.pop(chat)
|
| 30 |
+
return udB.set_key("WELCOME", ok)
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
def add_goodbye(chat, msg, media, button):
|
| 34 |
+
ok = get_stuff("GOODBYE")
|
| 35 |
+
ok.update({chat: {"goodbye": msg, "media": media, "button": button}})
|
| 36 |
+
return udB.set_key("GOODBYE", ok)
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def get_goodbye(chat):
|
| 40 |
+
ok = get_stuff("GOODBYE")
|
| 41 |
+
return ok.get(chat)
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
def delete_goodbye(chat):
|
| 45 |
+
ok = get_stuff("GOODBYE")
|
| 46 |
+
if ok.get(chat):
|
| 47 |
+
ok.pop(chat)
|
| 48 |
+
return udB.set_key("GOODBYE", ok)
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def add_thanks(chat):
|
| 52 |
+
x = get_stuff("THANK_MEMBERS")
|
| 53 |
+
x.update({chat: True})
|
| 54 |
+
return udB.set_key("THANK_MEMBERS", x)
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
def remove_thanks(chat):
|
| 58 |
+
x = get_stuff("THANK_MEMBERS")
|
| 59 |
+
if x.get(chat):
|
| 60 |
+
x.pop(chat)
|
| 61 |
+
return udB.set_key("THANK_MEMBERS", x)
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
def must_thank(chat):
|
| 65 |
+
x = get_stuff("THANK_MEMBERS")
|
| 66 |
+
return x.get(chat)
|
pyUltroid/dB/mute_db.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Ultroid - UserBot
|
| 2 |
+
# Copyright (C) 2021-2025 TeamUltroid
|
| 3 |
+
#
|
| 4 |
+
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
| 5 |
+
# PLease read the GNU Affero General Public License in
|
| 6 |
+
# <https://github.com/TeamUltroid/pyUltroid/blob/main/LICENSE>.
|
| 7 |
+
|
| 8 |
+
from .. import udB
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def get_muted():
|
| 12 |
+
return udB.get_key("MUTE") or {}
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def mute(chat, id):
|
| 16 |
+
ok = get_muted()
|
| 17 |
+
if ok.get(chat):
|
| 18 |
+
if id not in ok[chat]:
|
| 19 |
+
ok[chat].append(id)
|
| 20 |
+
else:
|
| 21 |
+
ok.update({chat: [id]})
|
| 22 |
+
return udB.set_key("MUTE", ok)
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def unmute(chat, id):
|
| 26 |
+
ok = get_muted()
|
| 27 |
+
if ok.get(chat) and id in ok[chat]:
|
| 28 |
+
ok[chat].remove(id)
|
| 29 |
+
return udB.set_key("MUTE", ok)
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
def is_muted(chat, id):
|
| 33 |
+
ok = get_muted()
|
| 34 |
+
return bool(ok.get(chat) and id in ok[chat])
|
pyUltroid/dB/notes_db.py
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Ultroid - UserBot
|
| 2 |
+
# Copyright (C) 2021-2025 TeamUltroid
|
| 3 |
+
#
|
| 4 |
+
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
| 5 |
+
# PLease read the GNU Affero General Public License in
|
| 6 |
+
# <https://github.com/TeamUltroid/pyUltroid/blob/main/LICENSE>.
|
| 7 |
+
|
| 8 |
+
from .. import udB
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def get_stuff():
|
| 12 |
+
return udB.get_key("NOTE") or {}
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def 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 |
+
|
| 24 |
+
def 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 |
+
|
| 31 |
+
def 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 |
+
|
| 38 |
+
def 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 |
+
|
| 44 |
+
def list_note(chat):
|
| 45 |
+
ok = get_stuff()
|
| 46 |
+
if ok.get(int(chat)):
|
| 47 |
+
return "".join(f"π #{z}\n" for z in ok[chat])
|
pyUltroid/dB/nsfw_db.py
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Ultroid - UserBot
|
| 2 |
+
# Copyright (C) 2021-2025 TeamUltroid
|
| 3 |
+
#
|
| 4 |
+
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
| 5 |
+
# PLease read the GNU Affero General Public License in
|
| 6 |
+
# <https://github.com/TeamUltroid/pyUltroid/blob/main/LICENSE>.
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
from .. import udB
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def get_stuff(key="NSFW"):
|
| 13 |
+
return udB.get_key(key) or {}
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
def nsfw_chat(chat, action):
|
| 17 |
+
x = get_stuff()
|
| 18 |
+
x.update({chat: action})
|
| 19 |
+
return udB.set_key("NSFW", x)
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def rem_nsfw(chat):
|
| 23 |
+
x = get_stuff()
|
| 24 |
+
if x.get(chat):
|
| 25 |
+
x.pop(chat)
|
| 26 |
+
return udB.set_key("NSFW", x)
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def is_nsfw(chat):
|
| 30 |
+
x = get_stuff()
|
| 31 |
+
if x.get(chat):
|
| 32 |
+
return x[chat]
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def profan_chat(chat, action):
|
| 36 |
+
x = get_stuff("PROFANITY")
|
| 37 |
+
x.update({chat: action})
|
| 38 |
+
return udB.set_key("PROFANITY", x)
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
def rem_profan(chat):
|
| 42 |
+
x = get_stuff("PROFANITY")
|
| 43 |
+
if x.get(chat):
|
| 44 |
+
x.pop(chat)
|
| 45 |
+
return udB.set_key("PROFANITY", x)
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def is_profan(chat):
|
| 49 |
+
x = get_stuff("PROFANITY")
|
| 50 |
+
if x.get(chat):
|
| 51 |
+
return x[chat]
|
pyUltroid/dB/snips_db.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Ultroid - UserBot
|
| 2 |
+
# Copyright (C) 2021-2025 TeamUltroid
|
| 3 |
+
#
|
| 4 |
+
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
| 5 |
+
# PLease read the GNU Affero General Public License in
|
| 6 |
+
# <https://github.com/TeamUltroid/pyUltroid/blob/main/LICENSE>.
|
| 7 |
+
|
| 8 |
+
from .. import udB
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def get_all_snips():
|
| 12 |
+
return udB.get_key("SNIP") or {}
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def add_snip(word, msg, media, button):
|
| 16 |
+
ok = get_all_snips()
|
| 17 |
+
ok.update({word: {"msg": msg, "media": media, "button": button}})
|
| 18 |
+
udB.set_key("SNIP", ok)
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def rem_snip(word):
|
| 22 |
+
ok = get_all_snips()
|
| 23 |
+
if ok.get(word):
|
| 24 |
+
ok.pop(word)
|
| 25 |
+
udB.set_key("SNIP", ok)
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def get_snips(word):
|
| 29 |
+
ok = get_all_snips()
|
| 30 |
+
if ok.get(word):
|
| 31 |
+
return ok[word]
|
| 32 |
+
return False
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def list_snip():
|
| 36 |
+
return "".join(f"π ${z}\n" for z in get_all_snips())
|
pyUltroid/dB/vc_sudos.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Ultroid - UserBot
|
| 2 |
+
# Copyright (C) 2021-2025 TeamUltroid
|
| 3 |
+
#
|
| 4 |
+
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
| 5 |
+
# PLease read the GNU Affero General Public License in
|
| 6 |
+
# <https://github.com/TeamUltroid/pyUltroid/blob/main/LICENSE>.
|
| 7 |
+
|
| 8 |
+
from .. import udB
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def get_vcsudos():
|
| 12 |
+
return udB.get_key("VC_SUDOS") or []
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def is_vcsudo(id):
|
| 16 |
+
return id in get_vcsudos()
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
def add_vcsudo(id):
|
| 20 |
+
sudos = get_vcsudos()
|
| 21 |
+
sudos.append(id)
|
| 22 |
+
return udB.set_key("VC_SUDOS", sudos)
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def del_vcsudo(id):
|
| 26 |
+
if is_vcsudo(id):
|
| 27 |
+
sudos = get_vcsudos()
|
| 28 |
+
sudos.remove(id)
|
| 29 |
+
return udB.set_key("VC_SUDOS", sudos)
|
pyUltroid/dB/warn_db.py
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Ultroid - UserBot
|
| 2 |
+
# Copyright (C) 2021-2025 TeamUltroid
|
| 3 |
+
#
|
| 4 |
+
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
| 5 |
+
# PLease read the GNU Affero General Public License in
|
| 6 |
+
# <https://github.com/TeamUltroid/pyUltroid/blob/main/LICENSE>.
|
| 7 |
+
|
| 8 |
+
from .. import udB
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def get_stuff():
|
| 12 |
+
return udB.get_key("WARNS") or {}
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def 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 |
+
|
| 24 |
+
def warns(chat, user):
|
| 25 |
+
x = get_stuff()
|
| 26 |
+
try:
|
| 27 |
+
count, reason = x[chat][user][0], x[chat][user][1]
|
| 28 |
+
return count, reason
|
| 29 |
+
except BaseException:
|
| 30 |
+
return 0, None
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
def 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 |
+
return
|