chore: fix chatbot and other minor issues.
- update Chatbot API. - Fix Invalid type of object in database.
This commit is contained in:
@@ -224,7 +224,7 @@ async def uname_change(e):
|
||||
|
||||
|
||||
async def uname_stuff(id, uname, name):
|
||||
if udB.get_key("USERNAME_LOG") == "True":
|
||||
if udB.get_key("USERNAME_LOG"):
|
||||
old_ = udB.get_key("USERNAME_DB") or {}
|
||||
old = old_.get(id)
|
||||
# Ignore Name Logs
|
||||
@@ -247,4 +247,4 @@ async def uname_stuff(id, uname, name):
|
||||
)
|
||||
|
||||
old_[id] = uname
|
||||
udB.set_key("USERNAME_DB", str(old_))
|
||||
udB.set_key("USERNAME_DB", old_)
|
||||
|
||||
@@ -12,7 +12,7 @@ __doc__ = get_help("help_chatbot")
|
||||
|
||||
from pyUltroid.fns.tools import get_chatbot_reply
|
||||
|
||||
from . import eod, get_string, inline_mention, udB, ultroid_cmd
|
||||
from . import eod, get_string, inline_mention, udB, ultroid_cmd, LOGS
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="repai")
|
||||
@@ -62,14 +62,14 @@ async def chat_bot_fn(event, type_):
|
||||
temp = event.text.split(maxsplit=1)
|
||||
try:
|
||||
user_ = await event.client.get_entity(await event.client.parse_id(temp[1]))
|
||||
except BaseException:
|
||||
if event.is_private:
|
||||
user_ = event.chat
|
||||
if not user_:
|
||||
return await eod(
|
||||
event,
|
||||
get_string("chab_1"),
|
||||
)
|
||||
except BaseException as er:
|
||||
LOGS.exception(er)
|
||||
user_ = event.chat if event.is_private else None
|
||||
if not user_:
|
||||
return await eod(
|
||||
event,
|
||||
get_string("chab_1"),
|
||||
)
|
||||
key = udB.get_key("CHATBOT_USERS") or {}
|
||||
chat = event.chat_id
|
||||
user = user_.id
|
||||
@@ -85,5 +85,5 @@ async def chat_bot_fn(event, type_):
|
||||
key[chat].remove(user)
|
||||
if chat in key and not key[chat]:
|
||||
del key[chat]
|
||||
udB.set_key("CHATBOT_USERS", str(key))
|
||||
udB.set_key("CHATBOT_USERS", key)
|
||||
await event.eor(f"**ChatBot:**\n{type_}ed {inline_mention(user_)}")
|
||||
|
||||
@@ -407,11 +407,8 @@ async def get_paste(data: str, extension: str = "txt"):
|
||||
|
||||
|
||||
async def get_chatbot_reply(message):
|
||||
from .. import ultroid_bot
|
||||
|
||||
chatbot_base = "https://kukiapi.xyz/api/apikey=ULTROIDUSERBOT/Ultroid/{}/message={}"
|
||||
chatbot_base = "https://kuki-api-lac.vercel.app/message={}"
|
||||
req_link = chatbot_base.format(
|
||||
ultroid_bot.me.first_name or "ultroid user",
|
||||
message,
|
||||
)
|
||||
try:
|
||||
@@ -419,7 +416,6 @@ async def get_chatbot_reply(message):
|
||||
except Exception:
|
||||
LOGS.info(f"**ERROR:**`{format_exc()}`")
|
||||
|
||||
|
||||
def check_filename(filroid):
|
||||
if os.path.exists(filroid):
|
||||
no = 1
|
||||
@@ -559,20 +555,19 @@ def make_html_telegraph(title, html=""):
|
||||
|
||||
async def Carbon(
|
||||
code,
|
||||
base_url="https://carbonara-42.herokuapp.com/api/cook",
|
||||
base_url="https://rayso-api-desvhu-33.koyeb.app/generate",
|
||||
file_name="ultroid",
|
||||
download=False,
|
||||
rayso=False,
|
||||
**kwargs,
|
||||
):
|
||||
if rayso:
|
||||
base_url = "https://raysoapi.herokuapp.com/generate"
|
||||
kwargs["text"] = code
|
||||
kwargs["theme"] = kwargs.get("theme", "meadow")
|
||||
kwargs["darkMode"] = kwargs.get("darkMode", True)
|
||||
kwargs["title"] = kwargs.get("title", "Ultroid")
|
||||
else:
|
||||
kwargs["code"] = code
|
||||
# if rayso:
|
||||
kwargs["text"] = code
|
||||
kwargs["theme"] = kwargs.get("theme", "meadow")
|
||||
kwargs["darkMode"] = kwargs.get("darkMode", True)
|
||||
kwargs["title"] = kwargs.get("title", "Ultroid")
|
||||
# else:
|
||||
# kwargs["code"] = code
|
||||
con = await async_searcher(base_url, post=True, json=kwargs, re_content=True)
|
||||
if not download:
|
||||
file = BytesIO(con)
|
||||
@@ -621,8 +616,7 @@ def _package_rpc(text, lang_src="auto", lang_tgt="auto"):
|
||||
escaped_parameter = json.dumps(parameter, separators=(",", ":"))
|
||||
rpc = [[[random.choice(GOOGLE_TTS_RPC), escaped_parameter, None, "generic"]]]
|
||||
espaced_rpc = json.dumps(rpc, separators=(",", ":"))
|
||||
freq_initial = "f.req={}&".format(quote(espaced_rpc))
|
||||
freq = freq_initial
|
||||
freq = "f.req={}&".format(quote(espaced_rpc))
|
||||
return freq
|
||||
|
||||
|
||||
|
||||
@@ -256,7 +256,7 @@ async def autopilot():
|
||||
new_channel = True
|
||||
chat = r.chats[0]
|
||||
channel = get_peer_id(chat)
|
||||
udB.set_key("LOG_CHANNEL", str(channel))
|
||||
udB.set_key("LOG_CHANNEL", channel)
|
||||
assistant = True
|
||||
try:
|
||||
await ultroid_bot.get_permissions(int(channel), asst.me.username)
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
__version__ = "2022.08.30"
|
||||
ultroid_version = "0.7.1"
|
||||
__version__ = "2022.12.18"
|
||||
ultroid_version = "0.7.2"
|
||||
|
||||
Reference in New Issue
Block a user