Skip to content

Commit a4d5ba2

Browse files
committed
Link metadata with api token
1 parent 290a8fa commit a4d5ba2

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</div>
2121
<br>
2222
<div align="center">
23-
This is an open source discord bot made by kyb3r and improved upon suggestions by the users! This bot enables server members to DM it, the messages then get relayed to the server moderators who can then respond through the bot. In essence this bot serves as a means for members to easily communicate with server leadership in an organised manner.
23+
This is an open source discord bot made by kyb3r and improved upon suggestions by the users! It enables server members to DM it, the messages then get relayed to the server moderators who can then respond through the bot. In essence this bot serves as a means for members to easily communicate with server leadership in an organised manner.
2424

2525
</div>
2626

bot.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -325,10 +325,11 @@ async def data_loop(self):
325325
"guild_name": self.guild.name,
326326
"member_count": len(self.guild.members),
327327
"uptime": (datetime.datetime.utcnow() - self.start_time).total_seconds(),
328+
"latency": f'{self.ws.latency * 1000:.4f}',
328329
"version": __version__
329330
}
330331

331-
await self.session.post('https://api.modmail.tk/metadata', json=data)
332+
await self.modmail_api.post_metadata(data)
332333

333334
await asyncio.sleep(3600)
334335

core/api.py

+4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ async def get_latest_commits(self, limit=3):
2929
class ModmailApiClient(ApiClient):
3030

3131
base = 'https://api.modmail.tk'
32+
metadata = base + '/metadata'
3233
github = base + '/github'
3334
logs = base + '/logs'
3435
config = base + '/config'
@@ -44,6 +45,9 @@ def __init__(self, bot):
4445
async def validate_token(self):
4546
resp = await self.request(self.base + '/token/verify', return_response=True)
4647
return resp.status == 200
48+
49+
def post_metadata(self, data):
50+
return self.request(self.metadata, method='POST', payload=data)
4751

4852
def get_user_info(self):
4953
return self.request(self.github + '/userinfo')

0 commit comments

Comments
 (0)