-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
175 lines (171 loc) · 10.3 KB
/
main.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#!/usr/bin/env python
#-*-coding:utf-8-*-
import requests
import discord
import os
import json
#API'S
def getUser(nickname):
base_url = "https://wtapi.joygame.com:443/api/Profile/GetPublicGameInfo"
base_headers = {"Sec-Ch-Ua": "\"Chromium\";v=\"89\", \";Not A Brand\";v=\"99\"", "Sec-Ch-Ua-Mobile": "?0", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36", "Content-Type": "application/json", "Accept": "*/*", "Origin": "chrome-extension://gmmkjpcadciiokjpikmkkmapphbmdjok", "Sec-Fetch-Site": "none", "Sec-Fetch-Mode": "cors", "Sec-Fetch-Dest": "empty", "Accept-Encoding": "gzip, deflate", "Accept-Language": "tr-TR,tr;q=0.9,en-US;q=0.8,en;q=0.7", "Connection": "close"}
base_json={"nickname": f"{nickname}"}
r = requests.post(base_url, headers=base_headers, json=base_json)
data = r.json()
if data["Data"] != None:
return data
else:
return False
def getMemberList(clan):
base_url = "https://wtapi.joygame.com:443/api/Clan/GetClanMemberList"
base_headers = {"Sec-Ch-Ua": "\"Chromium\";v=\"89\", \";Not A Brand\";v=\"99\"", "Sec-Ch-Ua-Mobile": "?0", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36", "Content-Type": "application/json", "Accept": "*/*", "Origin": "chrome-extension://gmmkjpcadciiokjpikmkkmapphbmdjok", "Sec-Fetch-Site": "none", "Sec-Fetch-Mode": "cors", "Sec-Fetch-Dest": "empty", "Accept-Encoding": "gzip, deflate", "Accept-Language": "tr-TR,tr;q=0.9,en-US;q=0.8,en;q=0.7", "Connection": "close"}
base_json={"ClanName": f"{clan}"}
r = requests.post(base_url, headers=base_headers, json=base_json)
data = r.json()
if data["Data"] != None:
return data
else:
return False
def getClan(clan):
base_url = "https://wtapi.joygame.com:443/api/Clan/GetClanInfo"
base_headers = {"Sec-Ch-Ua": "\"Chromium\";v=\"89\", \";Not A Brand\";v=\"99\"", "Sec-Ch-Ua-Mobile": "?0", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36", "Content-Type": "application/json", "Accept": "*/*", "Origin": "chrome-extension://gmmkjpcadciiokjpikmkkmapphbmdjok", "Sec-Fetch-Site": "none", "Sec-Fetch-Mode": "cors", "Sec-Fetch-Dest": "empty", "Accept-Encoding": "gzip, deflate", "Accept-Language": "tr-TR,tr;q=0.9,en-US;q=0.8,en;q=0.7", "Connection": "close"}
base_json={"ClanName": f"{clan}"}
r = requests.post(base_url, headers=base_headers, json=base_json)
data = r.json()
if data["Data"] != None:
return data
else:
return False
def getClanRank(clan):
base_url = "https://wtapi.joygame.com:443/api/Ranking/GetClanDailyRanking"
base_headers = {"Sec-Ch-Ua": "\"Chromium\";v=\"89\", \";Not A Brand\";v=\"99\"", "Sec-Ch-Ua-Mobile": "?0", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36", "Content-Type": "application/json", "Accept": "*/*", "Origin": "chrome-extension://gmmkjpcadciiokjpikmkkmapphbmdjok", "Sec-Fetch-Site": "none", "Sec-Fetch-Mode": "cors", "Sec-Fetch-Dest": "empty", "Accept-Encoding": "gzip, deflate", "Accept-Language": "tr-TR,tr;q=0.9,en-US;q=0.8,en;q=0.7", "Connection": "close"}
base_json={"ClanName": f"{clan}"}
r = requests.post(base_url, headers=base_headers, json=base_json)
data = r.json()
if data["Data"] != None:
return data
else:
return False
def listToString(s):
str1 = ""
for ele in s:
str1 += ele
return str1
# DISCORD BOT
TOKEN = "YOUR_BOT_TOKEN"
client = discord.Client(command_prefix="!")
@client.event
async def on_ready():
print(f'Connected To {client.user}!')
@client.event
async def on_message(message):
async with message.channel.typing():
if "!hesapara" in message.content:
nickname = message.content.replace("!hesapara","").strip()
data = getUser(nickname)
if data != False:
Rank = data["Data"]["Rank"]
Grade = data["Data"]["Grade"]
PrevRank = data["Data"]["PrevRank"]
UserName = data["Data"]["Name"]
ClanName = data["Data"]["ClanName"]
Exp = data["Data"]["Exp"]
Win = data["Data"]["Win"]
Lose= data["Data"]["Lose"]
Dead = data["Data"]["Dead"]
HeadShot = data["Data"]["HeadShot"]
WolfKill = data["Data"]["WolfKill"]
Kill = data["Data"]["Kill"]
Dead = data["Data"]["Dead"]
TotalRound = data["Data"]["TotalRound"]
GrenadeKill = data["Data"]["GrenadeKill"]
CampaignFlag = data["Data"]["CampaignFlag"]
LastLoginDate = data["Data"]["LastLoginDate"]
FirstCashUse = data["Data"]["FirstCashUse"]
PrideRegisterTime = data["Data"]["PrideRegisterTime"]
PrideOrder = data["Data"]["PrideOrder"]
BoxCount = data["Data"]["BoxCount"]
UserCreateDate = data["Data"]["UserCreateDate"]
PlayTime = int(data["Data"]["PlayTime"] / 60 / 24)
FavWeapon = data["Data"]["FavouriteWeapon"]["Name"]
FavWeaponIMG = data["Data"]["FavouriteWeapon"]["ImageUrl"]
with open('rankData.json',encoding='utf-8') as f:
data = json.load(f)
for n in range (0,73):
if data["Data"][n]["RankId"] == Grade:
RankTitle = data["Data"][n]["Title"]
IMG = data["Data"][n]["ImageUrl"]
if "http" not in IMG:
IMG = "http:"+data["Data"][n]["ImageUrl"]
else:
IMG = data["Data"][n]["ImageUrl"]
embed=discord.Embed(title=UserName+" Kullanıcısının Bilgileri", color=0x6d01a7)
embed.set_author(name=RankTitle, icon_url=IMG)
embed.set_thumbnail(url=FavWeaponIMG)
embed.add_field(name="Sıralama", value=Rank, inline=True)
embed.add_field(name="Gelişim Puanı", value=Exp, inline=True)
embed.add_field(name="Klan", value=ClanName, inline=True)
embed.add_field(name="Toplam Maç", value=TotalRound, inline=True)
embed.add_field(name="Oyun Süresi", value=f"{PlayTime} Saat", inline=True)
embed.add_field(name="Açılan Kutu", value=BoxCount, inline=True)
embed.add_field(name="Kazanma", value=Win, inline=True)
embed.add_field(name="Kaybetme", value=Lose, inline=True)
embed.add_field(name="Öldürme", value=Kill, inline=True)
embed.add_field(name="Ölme", value=Dead, inline=True)
embed.add_field(name="Tam Kafadan", value=HeadShot, inline=True)
embed.add_field(name="Bomba", value=GrenadeKill, inline=True)
embed.add_field(name="Kurtla Öldürme", value=WolfKill, inline=True)
embed.add_field(name="Favori Silahı", value=FavWeapon, inline=True)
embed.add_field(name="Son Giriş", value=LastLoginDate, inline=True)
embed.add_field(name="Kayıt Tarihi", value=UserCreateDate, inline=True)
embed.add_field(name="İlk Nakit Kullan Tarihi", value=FirstCashUse, inline=True)
embed.set_footer(text="Powered by 4NaT")
await message.channel.send(embed=embed)
elif data == False:
embed=discord.Embed(title="Aradığın Hesabı Bulamadık!", description=nickname+" Kullanıcısı Bulunamadı!", color=0x7a00b3)
embed.set_footer(text="Powered by 4NaT")
await message.channel.send(embed=embed)
elif "!klanara" in message.content:
clan = message.content.replace("!klanara","").strip()
data = getClan(clan)
data1 = getClanRank(clan)
if data and data1 != False:
ClanName = data["Data"]["ClanName"]
ClanRank = data1["Data"]["Rank"]
ClanOwner = data1["Data"]["ClanMaster"]
MemberCount = data["Data"]["MemberCount"]
WinCount = data["Data"]["ClanBattleWinCount"]
LoseCount = data["Data"]["ClanBattleLoseCount"]
CreateDate = data["Data"]["CreateDate"]
ClanExp = data["Data"]["Exp"]
ID = data["Data"]["Id"]
BattleCount = WinCount + LoseCount
embed=discord.Embed(title=ClanName+" Klanının Bilgieri", color=0x6d01a7)
embed.set_author(name=ClanName)
embed.add_field(name="Klan Kimliği", value=ID, inline=True)
embed.add_field(name="Kazanma", value=WinCount, inline=True)
embed.add_field(name="Kaybetme", value=LoseCount, inline=True)
embed.add_field(name="Sıra", value=ClanRank, inline=True)
embed.add_field(name="Sahibi", value=ClanOwner, inline=True)
embed.add_field(name="EXP", value=ClanExp, inline=True)
embed.add_field(name="Üye Sayısı", value=MemberCount, inline=True)
embed.add_field(name="Maç Sayısı", value=BattleCount, inline=True)
await message.channel.send(embed=embed)
elif data == False:
embed=discord.Embed(title="Aradığın Klanı Bulamadık!", description=clan+" Klanı Bulunamadı!", color=0x7a00b3)
embed.set_footer(text="Powered by 4NaT")
await message.channel.send(embed=embed)
elif "!klanoyuncu" in message.content:
clan = message.content.replace("!klanoyuncu","").strip()
data = getMemberList(clan)
x = []
if data != False:
for n in range (0,50):
try:
MemberName = data["Data"][n]["MemberNickname"]
MemberJoin = data["Data"][n]["JoinDate"]
x.append(f"Ad: {MemberName} | Katılım Tarihi: {MemberJoin}\n")
except:
break
m = listToString(x)
await message.channel.send(f"```{m}```")
client.run(TOKEN)