gsd 1 year ago
parent
commit
2921035354
  1. 28
      tradebot.facti13.external.py

28
tradebot.facti13.external.py

@ -77,6 +77,18 @@ class SteamClient(SteamPy.Client):
backend : BackendClient = None
backend_checker_enable = False
async def on_ready(self):
info(f"Logged in as: {self.user}")
asyncio.ensure_future(self.backend_checker(60))
async def on_connect(self):
await self.backend.pulse()
ok("Success connect to steam")
async def on_disconnect(self):
await self.backend.pulse()
ok("Disconnect from steam")
async def update_prices(self, exit_if_error = False):
prices = await self.backend.prices(exit_if_error)
self.items = TradeChecker(prices)
@ -200,7 +212,7 @@ if __name__ == "__main__":
parser.add_argument("--steam-secret", type=str, default=os.environ.get("STEAM_SECRET", ""))
args = parser.parse_args()
client = SteamClient(app = SteamPy.App(id=440), intents = SteamPy.Intents.Safe, state = SteamPy.PersonaState.Online)
client = SteamClient()
client.backend = backend
if args.auth_file and args.steam_secret:
@ -224,20 +236,6 @@ if __name__ == "__main__":
error("steam auth data or steam secret not be setted")
sys.exit(2)
@client.event
async def on_ready(client):
info(f"Logged in as: {client.user}")
asyncio.ensure_future(client.backend_checker(60))
@client.event
async def on_connect(client):
await client.backend.pulse()
ok("Success connect to steam")
@client.event
async def on_disconnect(client):
await client.backend.pulse()
ok("Disconnect from steam")
client.run(
username=login,

Loading…
Cancel
Save