await everything
This commit is contained in:
1 file changed
+6
-6
@@ -82,20 +82,20 @@ class ReforgerStats(commands.Bot):
|
|||||||
if self.ssh is None or self.sftp is None: self.sftp, self.ssh = createSSHClient(self.config)
|
if self.ssh is None or self.sftp is None: self.sftp, self.ssh = createSSHClient(self.config)
|
||||||
|
|
||||||
remote_path = "/profile/logs"
|
remote_path = "/profile/logs"
|
||||||
if self.log_dir == "": self.log_dir = getLatestDir(self.sftp, remote_path)
|
if self.log_dir == "": self.log_dir = await getLatestDir(self.sftp, remote_path)
|
||||||
|
|
||||||
# Read data
|
# Read data
|
||||||
file: SFTPFile = self.sftp.open(f"{remote_path}/{self.log_dir}/console.log")
|
file: SFTPFile = await self.sftp.open(f"{remote_path}/{self.log_dir}/console.log")
|
||||||
lines: list[str] = file.readlines()
|
lines: list[str] = await file.readlines()
|
||||||
if self.log_index == -1: self.log_index = len(lines) - 1
|
if self.log_index == -1: self.log_index = len(lines) - 1
|
||||||
self.players, self.gamertags = readLogFromIndex(self.log_index, lines, self.players, self.gamertags)
|
self.players, self.gamertags = await readLogFromIndex(self.log_index, lines, self.players, self.gamertags)
|
||||||
self.log_index = len(lines) - 1
|
self.log_index = len(lines) - 1
|
||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
# Send leaderboard embeds via webhook
|
# Send leaderboard embeds via webhook
|
||||||
content: dict = await self.createLeaderboardEmbed(self.players)
|
content: dict = await self.createLeaderboardEmbed(self.players)
|
||||||
if self.message_id == "": self.webhookSend(content)
|
if self.message_id == "": await self.webhookSend(content)
|
||||||
else: self.webhookUpdateMessage(content)
|
else: await self.webhookUpdateMessage(content)
|
||||||
|
|
||||||
# Close SSH && SFTP sessions and file
|
# Close SSH && SFTP sessions and file
|
||||||
self.sftp.close()
|
self.sftp.close()
|
||||||
|
|||||||
Reference in new issue
Block a user