diff --git a/shizuka/ShizukaChatBot/VoiceChatbot.py b/shizuka/ShizukaChatBot/VoiceChatbot.py
index 5396fa6..bb1f090 100644
--- a/shizuka/ShizukaChatBot/VoiceChatbot.py
+++ b/shizuka/ShizukaChatBot/VoiceChatbot.py
@@ -19,36 +19,36 @@ async def fetch(url):
async def ai_shizuka(url):
- ai_name = 'Shizuka.mp3'
+ ai_name = "Shizuka.mp3"
async with aiohttp.ClientSession() as session, session.get(url) as resp:
if resp.status == 200:
- f = await aiofiles.open(ai_name, mode='wb')
+ f = await aiofiles.open(ai_name, mode="wb")
await f.write(await resp.read())
await f.close()
return ai_name
-@SHIZUKA.on_message(filters.command('shizuka'))
+@SHIZUKA.on_message(filters.command("shizuka"))
async def shizuka(_, message):
if len(message.command) < 2:
- await message.reply_text('Shizuka AI Voice Chatbot')
+ await message.reply_text("Shizuka AI Voice Chatbot")
return
text = message.text.split(None, 1)[1]
- shizuka = text.replace(' ', '%20')
- m = await message.reply_text('Shizuka is the best...')
+ shizuka = text.replace(" ", "%20")
+ m = await message.reply_text("Shizuka is the best...")
try:
L = await fetch(
f"https://api.affiliateplus.xyz/api/chatbot?message={shizuka}&botname=Shizuka&ownername=Chankit&user=1",
)
- chatbot = L['message']
+ chatbot = L["message"]
VoiceAi = f"https://lyciavoice.herokuapp.com/shizuka?text={chatbot}&lang=en"
- name = 'shizuka'
+ name = "shizuka"
except Exception as e:
await m.edit(str(e))
return
- await m.edit('Made By @NeuroticAssociation')
+ await m.edit("Made By @NeuroticAssociation")
ShizukaVoice = await ai_shizuka(VoiceAi)
- await m.edit('Replying...')
+ await m.edit("Replying...")
await message.reply_audio(audio=ShizukaVoice, title=chatbot, performer=name)
os.remove(ShizukaVoice)
await m.delete()
diff --git a/shizuka/ShizukaChatBot/shizukabot.py b/shizuka/ShizukaChatBot/shizukabot.py
index 1b51d44..f45e56d 100644
--- a/shizuka/ShizukaChatBot/shizukabot.py
+++ b/shizuka/ShizukaChatBot/shizukabot.py
@@ -13,14 +13,14 @@
from shizuka import SHIZUKA
-url = 'https://acobot-brainshop-ai-v1.p.rapidapi.com/get'
+url = "https://acobot-brainshop-ai-v1.p.rapidapi.com/get"
translator = Translator()
BOT_ID = 1699240021
def extract_emojis(s):
- return ''.join(c for c in s if c in emoji.UNICODE_EMOJI)
+ return "".join(c for c in s if c in emoji.UNICODE_EMOJI)
en_chats = []
@@ -36,94 +36,94 @@ async def lycia(client, message):
msg = message.text
chat_id = message.chat.id
hello = message.from_user.id
- if msg.startswith('/') or msg.startswith('@'):
+ if msg.startswith("/") or msg.startswith("@"):
message.continue_propagation()
if chat_id in en_chats:
onik = msg
querystring = {
- 'bid': '161901',
- 'key': 'Sgv5QAk5wEbhqYn0',
- 'uid': hello,
- 'msg': {test},
+ "bid": "161901",
+ "key": "Sgv5QAk5wEbhqYn0",
+ "uid": hello,
+ "msg": {test},
}
headers = {
- 'X-RapidAPI-Host': 'acobot-brainshop-ai-v1.p.rapidapi.com',
- 'X-RapidAPI-Key': 'a1fa7cb243msh40ac83d27b168ddp1fdc80jsn7d0db8bffc62',
+ "X-RapidAPI-Host": "acobot-brainshop-ai-v1.p.rapidapi.com",
+ "X-RapidAPI-Key": "a1fa7cb243msh40ac83d27b168ddp1fdc80jsn7d0db8bffc62",
}
response = requests.request(
- 'GET',
+ "GET",
url,
headers=headers,
params=querystring,
)
result = response.text
- result = result.replace('{"cnt":"', '')
- result = result.replace('"}', '')
- result = result.replace('', '')
+ result = result.replace('{"cnt":"', "")
+ result = result.replace('"}', "")
+ result = result.replace("", "")
saini = result
try:
- await SHIZUKA.send_chat_action(message.chat.id, 'typing')
+ await SHIZUKA.send_chat_action(message.chat.id, "typing")
await message.reply_text(saini)
except CFError as e:
print(e)
else:
u = msg.split()
emj = extract_emojis(msg)
- msg = msg.replace(emj, '')
+ msg = msg.replace(emj, "")
if (
- [(k) for k in u if k.startswith('@')]
- and [(k) for k in u if k.startswith('#')]
- and [(k) for k in u if k.startswith('/')]
- and re.findall(r'\[([^]]+)]\(\s*([^)]+)\s*\)', msg) != []
+ [(k) for k in u if k.startswith("@")]
+ and [(k) for k in u if k.startswith("#")]
+ and [(k) for k in u if k.startswith("/")]
+ and re.findall(r"\[([^]]+)]\(\s*([^)]+)\s*\)", msg) != []
):
- h = ' '.join(filter(lambda x: x[0] != '@', u))
- km = re.sub(r'\[([^]]+)]\(\s*([^)]+)\s*\)', r'', h)
+ h = " ".join(filter(lambda x: x[0] != "@", u))
+ km = re.sub(r"\[([^]]+)]\(\s*([^)]+)\s*\)", r"", h)
tm = km.split()
- jm = ' '.join(filter(lambda x: x[0] != '#', tm))
+ jm = " ".join(filter(lambda x: x[0] != "#", tm))
hm = jm.split()
- rm = ' '.join(filter(lambda x: x[0] != '/', hm))
- elif [(k) for k in u if k.startswith('@')]:
- rm = ' '.join(filter(lambda x: x[0] != '@', u))
- elif [(k) for k in u if k.startswith('#')]:
- rm = ' '.join(filter(lambda x: x[0] != '#', u))
- elif [(k) for k in u if k.startswith('/')]:
- rm = ' '.join(filter(lambda x: x[0] != '/', u))
- elif re.findall(r'\[([^]]+)]\(\s*([^)]+)\s*\)', msg) != []:
- rm = re.sub(r'\[([^]]+)]\(\s*([^)]+)\s*\)', r'', msg)
+ rm = " ".join(filter(lambda x: x[0] != "/", hm))
+ elif [(k) for k in u if k.startswith("@")]:
+ rm = " ".join(filter(lambda x: x[0] != "@", u))
+ elif [(k) for k in u if k.startswith("#")]:
+ rm = " ".join(filter(lambda x: x[0] != "#", u))
+ elif [(k) for k in u if k.startswith("/")]:
+ rm = " ".join(filter(lambda x: x[0] != "/", u))
+ elif re.findall(r"\[([^]]+)]\(\s*([^)]+)\s*\)", msg) != []:
+ rm = re.sub(r"\[([^]]+)]\(\s*([^)]+)\s*\)", r"", msg)
else:
rm = msg
lan = await translator.detect(rm)
onik = rm
- if not 'en' in lan and not lan == '':
- onik = translator.translate(onik, targetlang='en')
+ if not "en" in lan and not lan == "":
+ onik = translator.translate(onik, targetlang="en")
querystring = {
- 'bid': '161901',
- 'key': 'Sgv5QAk5wEbhqYn0',
- 'uid': hello,
- 'msg': {onik},
+ "bid": "161901",
+ "key": "Sgv5QAk5wEbhqYn0",
+ "uid": hello,
+ "msg": {onik},
}
headers = {
- 'X-RapidAPI-Host': 'acobot-brainshop-ai-v1.p.rapidapi.com',
- 'X-RapidAPI-Key': 'a1fa7cb243msh40ac83d27b168ddp1fdc80jsn7d0db8bffc62',
+ "X-RapidAPI-Host": "acobot-brainshop-ai-v1.p.rapidapi.com",
+ "X-RapidAPI-Key": "a1fa7cb243msh40ac83d27b168ddp1fdc80jsn7d0db8bffc62",
}
response = requests.request(
- 'GET',
+ "GET",
url,
headers=headers,
params=querystring,
)
result = response.text
- result = result.replace('{"cnt":"', '')
- result = result.replace('"}', '')
- result = result.replace('', '')
+ result = result.replace('{"cnt":"', "")
+ result = result.replace('"}', "")
+ result = result.replace("", "")
saini = result
- if not 'en' in lan and not lan == '':
+ if not "en" in lan and not lan == "":
pro = translator.translate(saini, lang_tgt=lan[0])
try:
- await SHIZUKA.send_chat_action(message.chat.id, 'typing')
+ await SHIZUKA.send_chat_action(message.chat.id, "typing")
await message.reply_text(saini)
except CFError as e:
print(e)
@@ -133,71 +133,71 @@ async def lycia(client, message):
async def chankit(client, message):
msg = message.text
hello = message.from_user.id
- if msg.startswith('/') or msg.startswith('@'):
+ if msg.startswith("/") or msg.startswith("@"):
message.continue_propagation()
u = msg.split()
emj = extract_emojis(msg)
- msg = msg.replace(emj, '')
+ msg = msg.replace(emj, "")
if (
- [(k) for k in u if k.startswith('@')]
- and [(k) for k in u if k.startswith('#')]
- and [(k) for k in u if k.startswith('/')]
- and re.findall(r'\[([^]]+)]\(\s*([^)]+)\s*\)', msg) != []
+ [(k) for k in u if k.startswith("@")]
+ and [(k) for k in u if k.startswith("#")]
+ and [(k) for k in u if k.startswith("/")]
+ and re.findall(r"\[([^]]+)]\(\s*([^)]+)\s*\)", msg) != []
):
- h = ' '.join(filter(lambda x: x[0] != '@', u))
- km = re.sub(r'\[([^]]+)]\(\s*([^)]+)\s*\)', r'', h)
+ h = " ".join(filter(lambda x: x[0] != "@", u))
+ km = re.sub(r"\[([^]]+)]\(\s*([^)]+)\s*\)", r"", h)
tm = km.split()
- jm = ' '.join(filter(lambda x: x[0] != '#', tm))
+ jm = " ".join(filter(lambda x: x[0] != "#", tm))
hm = jm.split()
- rm = ' '.join(filter(lambda x: x[0] != '/', hm))
- elif [(k) for k in u if k.startswith('@')]:
- rm = ' '.join(filter(lambda x: x[0] != '@', u))
- elif [(k) for k in u if k.startswith('#')]:
- rm = ' '.join(filter(lambda x: x[0] != '#', u))
- elif [(k) for k in u if k.startswith('/')]:
- rm = ' '.join(filter(lambda x: x[0] != '/', u))
- elif re.findall(r'\[([^]]+)]\(\s*([^)]+)\s*\)', msg) != []:
- rm = re.sub(r'\[([^]]+)]\(\s*([^)]+)\s*\)', r'', msg)
+ rm = " ".join(filter(lambda x: x[0] != "/", hm))
+ elif [(k) for k in u if k.startswith("@")]:
+ rm = " ".join(filter(lambda x: x[0] != "@", u))
+ elif [(k) for k in u if k.startswith("#")]:
+ rm = " ".join(filter(lambda x: x[0] != "#", u))
+ elif [(k) for k in u if k.startswith("/")]:
+ rm = " ".join(filter(lambda x: x[0] != "/", u))
+ elif re.findall(r"\[([^]]+)]\(\s*([^)]+)\s*\)", msg) != []:
+ rm = re.sub(r"\[([^]]+)]\(\s*([^)]+)\s*\)", r"", msg)
else:
rm = msg
lan = await translator.detect(rm)
onik = rm
- if not 'en' in lan and not lan == '':
- onik = translator.translate(onik, targetlang='en')
+ if not "en" in lan and not lan == "":
+ onik = translator.translate(onik, targetlang="en")
querystring = {
- 'bid': '161901',
- 'key': 'Sgv5QAk5wEbhqYn0',
- 'uid': hello,
- 'msg': {onik},
+ "bid": "161901",
+ "key": "Sgv5QAk5wEbhqYn0",
+ "uid": hello,
+ "msg": {onik},
}
headers = {
- 'X-RapidAPI-Host': 'acobot-brainshop-ai-v1.p.rapidapi.com',
- 'X-RapidAPI-Key': 'a1fa7cb243msh40ac83d27b168ddp1fdc80jsn7d0db8bffc62',
+ "X-RapidAPI-Host": "acobot-brainshop-ai-v1.p.rapidapi.com",
+ "X-RapidAPI-Key": "a1fa7cb243msh40ac83d27b168ddp1fdc80jsn7d0db8bffc62",
}
response = requests.request(
- 'GET',
+ "GET",
url,
headers=headers,
params=querystring,
)
result = response.text
- result = result.replace('{"cnt":"', '')
- result = result.replace('"}', '')
- result = result.replace('', '')
+ result = result.replace('{"cnt":"', "")
+ result = result.replace('"}', "")
+ result = result.replace("", "")
saini = result
- if not 'en' in lan and not lan == '':
+ if not "en" in lan and not lan == "":
saini = translator.translate(saini, targetlang=lan[0])
try:
- await SHIZUKA.send_chat_action(message.chat.id, 'typing')
+ await SHIZUKA.send_chat_action(message.chat.id, "typing")
await message.reply_text(saini)
except CFError as e:
print(e)
@SHIZUKA.on_message(
- filters.regex('Lycia|lycia|SHIZUKA|shizuka||Shizuka')
+ filters.regex("Lycia|lycia|SHIZUKA|shizuka||Shizuka")
& ~filters.bot
& ~filters.via_bot
& ~filters.forwarded
@@ -206,63 +206,63 @@ async def chankit(client, message):
)
async def chankitsaini(client, message):
msg = message.text
- if msg.startswith('/') or msg.startswith('@'):
+ if msg.startswith("/") or msg.startswith("@"):
message.continue_propagation()
u = msg.split()
emj = extract_emojis(msg)
- msg = msg.replace(emj, '')
+ msg = msg.replace(emj, "")
if (
- [(k) for k in u if k.startswith('@')]
- and [(k) for k in u if k.startswith('#')]
- and [(k) for k in u if k.startswith('/')]
- and re.findall(r'\[([^]]+)]\(\s*([^)]+)\s*\)', msg) != []
+ [(k) for k in u if k.startswith("@")]
+ and [(k) for k in u if k.startswith("#")]
+ and [(k) for k in u if k.startswith("/")]
+ and re.findall(r"\[([^]]+)]\(\s*([^)]+)\s*\)", msg) != []
):
- h = ' '.join(filter(lambda x: x[0] != '@', u))
- km = re.sub(r'\[([^]]+)]\(\s*([^)]+)\s*\)', r'', h)
+ h = " ".join(filter(lambda x: x[0] != "@", u))
+ km = re.sub(r"\[([^]]+)]\(\s*([^)]+)\s*\)", r"", h)
tm = km.split()
- jm = ' '.join(filter(lambda x: x[0] != '#', tm))
+ jm = " ".join(filter(lambda x: x[0] != "#", tm))
hm = jm.split()
- rm = ' '.join(filter(lambda x: x[0] != '/', hm))
- elif [(k) for k in u if k.startswith('@')]:
- rm = ' '.join(filter(lambda x: x[0] != '@', u))
- elif [(k) for k in u if k.startswith('#')]:
- rm = ' '.join(filter(lambda x: x[0] != '#', u))
- elif [(k) for k in u if k.startswith('/')]:
- rm = ' '.join(filter(lambda x: x[0] != '/', u))
- elif re.findall(r'\[([^]]+)]\(\s*([^)]+)\s*\)', msg) != []:
- rm = re.sub(r'\[([^]]+)]\(\s*([^)]+)\s*\)', r'', msg)
+ rm = " ".join(filter(lambda x: x[0] != "/", hm))
+ elif [(k) for k in u if k.startswith("@")]:
+ rm = " ".join(filter(lambda x: x[0] != "@", u))
+ elif [(k) for k in u if k.startswith("#")]:
+ rm = " ".join(filter(lambda x: x[0] != "#", u))
+ elif [(k) for k in u if k.startswith("/")]:
+ rm = " ".join(filter(lambda x: x[0] != "/", u))
+ elif re.findall(r"\[([^]]+)]\(\s*([^)]+)\s*\)", msg) != []:
+ rm = re.sub(r"\[([^]]+)]\(\s*([^)]+)\s*\)", r"", msg)
else:
rm = msg
lan = await translator.detect(rm)
onik = rm
- if not 'en' in lan and not lan == '':
- onik = await translator.translate(onik, targetlang='en')
+ if not "en" in lan and not lan == "":
+ onik = await translator.translate(onik, targetlang="en")
querystring = {
- 'bid': '161901',
- 'key': 'Sgv5QAk5wEbhqYn0',
- 'uid': hello,
- 'msg': {onik},
+ "bid": "161901",
+ "key": "Sgv5QAk5wEbhqYn0",
+ "uid": hello,
+ "msg": {onik},
}
headers = {
- 'X-RapidAPI-Host': 'acobot-brainshop-ai-v1.p.rapidapi.com',
- 'X-RapidAPI-Key': 'a1fa7cb243msh40ac83d27b168ddp1fdc80jsn7d0db8bffc62',
+ "X-RapidAPI-Host": "acobot-brainshop-ai-v1.p.rapidapi.com",
+ "X-RapidAPI-Key": "a1fa7cb243msh40ac83d27b168ddp1fdc80jsn7d0db8bffc62",
}
response = requests.request(
- 'GET',
+ "GET",
url,
headers=headers,
params=querystring,
)
result = response.text
- result = result.replace('{"cnt":"', '')
- result = result.replace('"}', '')
- result = result.replace('', '')
+ result = result.replace('{"cnt":"', "")
+ result = result.replace('"}', "")
+ result = result.replace("", "")
pro = result
- if not 'en' in lan and not lan == '':
+ if not "en" in lan and not lan == "":
saini = translator.translate(saini, targetlang=lan[0])
try:
- await SHIZUKA.send_chat_action(message.chat.id, 'typing')
+ await SHIZUKA.send_chat_action(message.chat.id, "typing")
await message.reply_text(saini)
except CFError as e:
print(e)
diff --git a/shizuka/ShizukaChatBot/shizukainline.py b/shizuka/ShizukaChatBot/shizukainline.py
index 49df799..cd72e30 100644
--- a/shizuka/ShizukaChatBot/shizukainline.py
+++ b/shizuka/ShizukaChatBot/shizukainline.py
@@ -36,13 +36,13 @@ async def inline_query_handler(client, query):
string = query.query.lower()
answers = []
- if string.split()[0] == 'shizuka':
+ if string.split()[0] == "shizuka":
if len(string.split()) < 2:
await client.answer_inline_query(
query.id,
results=answers,
- switch_pm_text='Shizuka | Chat [text]',
- switch_pm_parameter='shizuka',
+ switch_pm_text="Shizuka | Chat [text]",
+ switch_pm_parameter="shizuka",
)
return
shizuka = string.split(None, 1)[1].strip()
@@ -56,8 +56,8 @@ async def shizukachatbot(answers, text):
buttons = InlineKeyboard(row_width=1)
buttons.add(
InlineKeyboardButton(
- 'Shizuka',
- switch_inline_query_current_chat='shizuka',
+ "Shizuka",
+ switch_inline_query_current_chat="shizuka",
),
)
caption = f"""
@@ -65,9 +65,9 @@ async def shizukachatbot(answers, text):
**Shizuka:** `{result['cnt']}`"""
answers.append(
InlineQueryResultPhoto(
- photo_url='https://telegra.ph/file/c8f2e290ba36052058154.jpg',
- title='Shizuka',
- description=result['cnt'],
+ photo_url="https://telegra.ph/file/c8f2e290ba36052058154.jpg",
+ title="Shizuka",
+ description=result["cnt"],
caption=caption,
reply_markup=buttons,
),
diff --git a/shizuka/ShizukaChatBot/start.py b/shizuka/ShizukaChatBot/start.py
index a5231f5..d85aa66 100644
--- a/shizuka/ShizukaChatBot/start.py
+++ b/shizuka/ShizukaChatBot/start.py
@@ -8,23 +8,23 @@
SHIZUKA_START = f"I am Shizuka 『しずか』, An Intelligent ChatBot.[⠀]({START_IMG})"
-@SHIZUKA.on_message(filters.command(['start'], prefixes=['/', '!']) & ~filters.edited)
+@SHIZUKA.on_message(filters.command(["start"], prefixes=["/", "!"]) & ~filters.edited)
async def info(client, message):
buttons = [
[
InlineKeyboardButton(
- text='Go inline',
- switch_inline_query_current_chat='shizuka ',
+ text="Go inline",
+ switch_inline_query_current_chat="shizuka ",
),
],
[
InlineKeyboardButton(
- 'Github',
- url='https://github.com/ChankitSaini/ShizukaChatBot',
+ "Github",
+ url="https://github.com/ChankitSaini/ShizukaChatBot",
),
InlineKeyboardButton(
- 'Maintained by',
- url='https://t.me/NeuroticAssociation',
+ "Maintained by",
+ url="https://t.me/NeuroticAssociation",
),
],
]
diff --git a/shizuka/__init__.py b/shizuka/__init__.py
index 01d636a..a0ae6ae 100644
--- a/shizuka/__init__.py
+++ b/shizuka/__init__.py
@@ -2,12 +2,12 @@
from pyrogram import Client
-API_ID = os.environ.get('API_ID', None)
-API_HASH = os.environ.get('API_HASH', None)
-TOKEN = os.environ.get('TOKEN', None)
+API_ID = os.environ.get("API_ID", None)
+API_HASH = os.environ.get("API_HASH", None)
+TOKEN = os.environ.get("TOKEN", None)
START_IMG = os.environ.get(
- 'START_IMG',
- 'https://telegra.ph/file/f3696f6234fce4d4fb85d.jpg',
+ "START_IMG",
+ "https://telegra.ph/file/f3696f6234fce4d4fb85d.jpg",
)
-SHIZUKA = Client(':memory:', api_id=API_ID, api_hash=API_HASH, bot_token=TOKEN)
+SHIZUKA = Client(":memory:", api_id=API_ID, api_hash=API_HASH, bot_token=TOKEN)
diff --git a/shizuka/__main__.py b/shizuka/__main__.py
index 743dcf0..c4fa97b 100644
--- a/shizuka/__main__.py
+++ b/shizuka/__main__.py
@@ -6,5 +6,5 @@
from shizuka.ShizukaChatBot import shizukainline
from shizuka.ShizukaChatBot import start
-if __name__ == '__main__':
+if __name__ == "__main__":
SHIZUKA.run()