CryptoBalance.py 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # meta developer: @visionavtr / @toxicuse
  2. from .. import loader, utils
  3. from telethon.tl.types import Message
  4. cryptobot = 'CryptoBot'
  5. tonrocket = 'tonRocketBot'
  6. xjetswap = 'xJetSwapBot'
  7. cryptotest = 'CryptoTestnetBot'
  8. walletbot = 'wallet'
  9. class CryptoBalanceMod(loader.Module):
  10. '''Check your balance in some bots.'''
  11. strings = {'name': 'CryptoBalance', 'balance': '<emoji document_id=5343662197874630855>💲</emoji> <b>Your balance in @{}:</b>\n\n{}'}
  12. async def check_balance(
  13. self,
  14. bot: int,
  15. message: Message,
  16. ):
  17. async with message.client.conversation(bot) as conv:
  18. enter = await conv.send_message('/wallet')
  19. otvet = await conv.get_response()
  20. await enter.delete()
  21. await otvet.delete()
  22. return(otvet.text)
  23. @loader.command()
  24. async def bcrypto(self, message: Message):
  25. '''- check your balance in @CryptoBot'''
  26. balance = ((await self.check_balance(cryptobot, message))[18:])
  27. await utils.answer(message, self.strings('balance').format(cryptobot, balance))
  28. @loader.command()
  29. async def bton(self, message: Message):
  30. '''- check your balance in @tonRocketBot'''
  31. balance = (await self.check_balance(tonrocket, message))[21:]
  32. await utils.answer(message, self.strings('balance').format(tonrocket, balance))
  33. @loader.command()
  34. async def bjet(self, message: Message):
  35. '''- check your balance in @xJetSwapBot'''
  36. balance = (await self.check_balance(xjetswap, message))[26:]
  37. await utils.answer(message, self.strings('balance').format(xjetswap, balance))
  38. @loader.command()
  39. async def btest(self, message: Message):
  40. '''- check your balance in @CryptoTestnetBot'''
  41. balance = (await self.check_balance(cryptotest, message))[18:]
  42. await utils.answer(message, self.strings('balance').format(cryptotest, balance))
  43. @loader.command()
  44. async def bwallet(self, message: Message):
  45. '''- check your balance in @wallet'''
  46. balance = (await self.check_balance(walletbot, message))[22:]
  47. await utils.answer(message, self.strings('balance').format(walletbot, balance))