-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.py
77 lines (62 loc) · 2.6 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import os
import requests
from StarkChat import starkchat
from pyrogram import *
from pyrogram.types import *
chatbot = starkchat.StarkChat()
API_ID = ""
API_HASH = ""
BOT_TOKEN = ""
API_KEY = ""
bot = Client("STARK", api_id=API_ID, api_hash=API_HASH, bot_token=BOT_TOKEN)
@bot.on_message(filters.command("reset"))
async def reset(client, message):
user_id = message.from_user.id
TEXTS = "Trying To Send Reset Request..."
msg = await message.reply(TEXTS)
try:
data1=requests.get(f"https://api.gpt.starkai.live/reset?client_id={user_id}")
await msg.edit("US West Server has been Reeset!")
data2=requests.get(f"https://asia.api.gpt.starkai.live/reset?client_id={user_id}")
await msg.edit("Asia Server has been Reset!")
data3=requests.get(f"https://eu.api.gpt.starkai.live/reset?client_id={user_id}")
await msg.edit("Europe Server has been Reset!")
data4=requests.get(f"https://us-east.api.gpt.starkai.live/reset?client_id={user_id}")
await msg.edit("US East Server has been Reset!")
await msg.edit("Reset Requests has been Sent Successfully!")
except Exception as e:
await msg.edit("Unable to Reset User Data's")
@bot.on_message(filters.text)
async def response(client, message):
question = message.text
user_id = message.from_user.id
TEXTS = "Thinking..."
msg = await message.reply(TEXTS)
try:
r = requests.get(f"https://api.gpt.starkai.live/api?message={question}&key={API_KEY}&client_id={user_id}")
reply = r.json()["message"]
await msg.edit(reply)
return
except Exception as e:
print(e)
try:
r = requests.get(f"https://asia.api.gpt.starkai.live/api?message={question}&key={API_KEY}&client_id={user_id}")
reply = r.json()["message"]
await msg.edit(reply)
return
except Exception as e:
print(e)
try:
r = requests.get(f"https://us-east.api.gpt.starkai.live/api?message={question}&key={API_KEY}&client_id={user_id}")
reply = r.json()["message"]
await msg.edit(reply)
return
except Exception as e:
print(e)
reply = chatbot.chat(question)
await msg.edit(reply)
return
def main():
bot.run()
if __name__ == "__main__":
main()