Spaces:
Paused
Paused
Devesh Pal
commited on
Commit
·
583badc
1
Parent(s):
dda8bb8
chore: fix chatbot and other minor issues.
Browse files- update Chatbot API.
- Fix Invalid type of object in database.
- plugins/_chatactions.py +2 -2
- plugins/chatbot.py +10 -10
- pyUltroid/fns/tools.py +10 -16
- pyUltroid/startup/funcs.py +1 -1
- pyUltroid/version.py +2 -2
plugins/_chatactions.py
CHANGED
@@ -224,7 +224,7 @@ async def uname_change(e):
|
|
224 |
|
225 |
|
226 |
async def uname_stuff(id, uname, name):
|
227 |
-
if udB.get_key("USERNAME_LOG")
|
228 |
old_ = udB.get_key("USERNAME_DB") or {}
|
229 |
old = old_.get(id)
|
230 |
# Ignore Name Logs
|
@@ -247,4 +247,4 @@ async def uname_stuff(id, uname, name):
|
|
247 |
)
|
248 |
|
249 |
old_[id] = uname
|
250 |
-
udB.set_key("USERNAME_DB",
|
|
|
224 |
|
225 |
|
226 |
async def uname_stuff(id, uname, name):
|
227 |
+
if udB.get_key("USERNAME_LOG"):
|
228 |
old_ = udB.get_key("USERNAME_DB") or {}
|
229 |
old = old_.get(id)
|
230 |
# Ignore Name Logs
|
|
|
247 |
)
|
248 |
|
249 |
old_[id] = uname
|
250 |
+
udB.set_key("USERNAME_DB", old_)
|
plugins/chatbot.py
CHANGED
@@ -12,7 +12,7 @@ __doc__ = get_help("help_chatbot")
|
|
12 |
|
13 |
from pyUltroid.fns.tools import get_chatbot_reply
|
14 |
|
15 |
-
from . import eod, get_string, inline_mention, udB, ultroid_cmd
|
16 |
|
17 |
|
18 |
@ultroid_cmd(pattern="repai")
|
@@ -62,14 +62,14 @@ async def chat_bot_fn(event, type_):
|
|
62 |
temp = event.text.split(maxsplit=1)
|
63 |
try:
|
64 |
user_ = await event.client.get_entity(await event.client.parse_id(temp[1]))
|
65 |
-
except BaseException:
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
key = udB.get_key("CHATBOT_USERS") or {}
|
74 |
chat = event.chat_id
|
75 |
user = user_.id
|
@@ -85,5 +85,5 @@ async def chat_bot_fn(event, type_):
|
|
85 |
key[chat].remove(user)
|
86 |
if chat in key and not key[chat]:
|
87 |
del key[chat]
|
88 |
-
udB.set_key("CHATBOT_USERS",
|
89 |
await event.eor(f"**ChatBot:**\n{type_}ed {inline_mention(user_)}")
|
|
|
12 |
|
13 |
from pyUltroid.fns.tools import get_chatbot_reply
|
14 |
|
15 |
+
from . import eod, get_string, inline_mention, udB, ultroid_cmd, LOGS
|
16 |
|
17 |
|
18 |
@ultroid_cmd(pattern="repai")
|
|
|
62 |
temp = event.text.split(maxsplit=1)
|
63 |
try:
|
64 |
user_ = await event.client.get_entity(await event.client.parse_id(temp[1]))
|
65 |
+
except BaseException as er:
|
66 |
+
LOGS.exception(er)
|
67 |
+
user_ = event.chat if event.is_private else None
|
68 |
+
if not user_:
|
69 |
+
return await eod(
|
70 |
+
event,
|
71 |
+
get_string("chab_1"),
|
72 |
+
)
|
73 |
key = udB.get_key("CHATBOT_USERS") or {}
|
74 |
chat = event.chat_id
|
75 |
user = user_.id
|
|
|
85 |
key[chat].remove(user)
|
86 |
if chat in key and not key[chat]:
|
87 |
del key[chat]
|
88 |
+
udB.set_key("CHATBOT_USERS", key)
|
89 |
await event.eor(f"**ChatBot:**\n{type_}ed {inline_mention(user_)}")
|
pyUltroid/fns/tools.py
CHANGED
@@ -407,11 +407,8 @@ async def get_paste(data: str, extension: str = "txt"):
|
|
407 |
|
408 |
|
409 |
async def get_chatbot_reply(message):
|
410 |
-
|
411 |
-
|
412 |
-
chatbot_base = "https://kukiapi.xyz/api/apikey=ULTROIDUSERBOT/Ultroid/{}/message={}"
|
413 |
req_link = chatbot_base.format(
|
414 |
-
ultroid_bot.me.first_name or "ultroid user",
|
415 |
message,
|
416 |
)
|
417 |
try:
|
@@ -419,7 +416,6 @@ async def get_chatbot_reply(message):
|
|
419 |
except Exception:
|
420 |
LOGS.info(f"**ERROR:**`{format_exc()}`")
|
421 |
|
422 |
-
|
423 |
def check_filename(filroid):
|
424 |
if os.path.exists(filroid):
|
425 |
no = 1
|
@@ -559,20 +555,19 @@ def make_html_telegraph(title, html=""):
|
|
559 |
|
560 |
async def Carbon(
|
561 |
code,
|
562 |
-
base_url="https://
|
563 |
file_name="ultroid",
|
564 |
download=False,
|
565 |
rayso=False,
|
566 |
**kwargs,
|
567 |
):
|
568 |
-
if rayso:
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
kwargs["code"] = code
|
576 |
con = await async_searcher(base_url, post=True, json=kwargs, re_content=True)
|
577 |
if not download:
|
578 |
file = BytesIO(con)
|
@@ -621,8 +616,7 @@ def _package_rpc(text, lang_src="auto", lang_tgt="auto"):
|
|
621 |
escaped_parameter = json.dumps(parameter, separators=(",", ":"))
|
622 |
rpc = [[[random.choice(GOOGLE_TTS_RPC), escaped_parameter, None, "generic"]]]
|
623 |
espaced_rpc = json.dumps(rpc, separators=(",", ":"))
|
624 |
-
|
625 |
-
freq = freq_initial
|
626 |
return freq
|
627 |
|
628 |
|
|
|
407 |
|
408 |
|
409 |
async def get_chatbot_reply(message):
|
410 |
+
chatbot_base = "https://kuki-api-lac.vercel.app/message={}"
|
|
|
|
|
411 |
req_link = chatbot_base.format(
|
|
|
412 |
message,
|
413 |
)
|
414 |
try:
|
|
|
416 |
except Exception:
|
417 |
LOGS.info(f"**ERROR:**`{format_exc()}`")
|
418 |
|
|
|
419 |
def check_filename(filroid):
|
420 |
if os.path.exists(filroid):
|
421 |
no = 1
|
|
|
555 |
|
556 |
async def Carbon(
|
557 |
code,
|
558 |
+
base_url="https://rayso-api-desvhu-33.koyeb.app/generate",
|
559 |
file_name="ultroid",
|
560 |
download=False,
|
561 |
rayso=False,
|
562 |
**kwargs,
|
563 |
):
|
564 |
+
# if rayso:
|
565 |
+
kwargs["text"] = code
|
566 |
+
kwargs["theme"] = kwargs.get("theme", "meadow")
|
567 |
+
kwargs["darkMode"] = kwargs.get("darkMode", True)
|
568 |
+
kwargs["title"] = kwargs.get("title", "Ultroid")
|
569 |
+
# else:
|
570 |
+
# kwargs["code"] = code
|
|
|
571 |
con = await async_searcher(base_url, post=True, json=kwargs, re_content=True)
|
572 |
if not download:
|
573 |
file = BytesIO(con)
|
|
|
616 |
escaped_parameter = json.dumps(parameter, separators=(",", ":"))
|
617 |
rpc = [[[random.choice(GOOGLE_TTS_RPC), escaped_parameter, None, "generic"]]]
|
618 |
espaced_rpc = json.dumps(rpc, separators=(",", ":"))
|
619 |
+
freq = "f.req={}&".format(quote(espaced_rpc))
|
|
|
620 |
return freq
|
621 |
|
622 |
|
pyUltroid/startup/funcs.py
CHANGED
@@ -256,7 +256,7 @@ async def autopilot():
|
|
256 |
new_channel = True
|
257 |
chat = r.chats[0]
|
258 |
channel = get_peer_id(chat)
|
259 |
-
udB.set_key("LOG_CHANNEL",
|
260 |
assistant = True
|
261 |
try:
|
262 |
await ultroid_bot.get_permissions(int(channel), asst.me.username)
|
|
|
256 |
new_channel = True
|
257 |
chat = r.chats[0]
|
258 |
channel = get_peer_id(chat)
|
259 |
+
udB.set_key("LOG_CHANNEL", channel)
|
260 |
assistant = True
|
261 |
try:
|
262 |
await ultroid_bot.get_permissions(int(channel), asst.me.username)
|
pyUltroid/version.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
__version__ = "2022.
|
2 |
-
ultroid_version = "0.7.
|
|
|
1 |
+
__version__ = "2022.12.18"
|
2 |
+
ultroid_version = "0.7.2"
|