import os

import telegram

from leonard import Leonard

if __name__ == '__main__':
    os.chdir('../')
    telegram_client = telegram.Bot(os.environ['BOT_TOKEN'])
    bot = Leonard(telegram_client)
    i = 0
    while True:
        if i % 10 == 0:
            bot.collect_plugins()
        for name, check, send in bot.subscriptions:
            send(bot, check(bot))
        i += 1

import os
import time

import telegram

from leonard import Leonard

if __name__ == '__main__':
    os.chdir('../')
    telegram_client = telegram.Bot(os.environ['BOT_TOKEN'])
    bot = Leonard(telegram_client)
    bot.collect_plugins()
    while True:
        for name, check, send in bot.subscriptions:
            send(bot, check(bot))
        time.sleep(60)

Remove collecting plugins every second
Remove collecting plugins every second

  import os
+ import time
  
  import telegram
  
  from leonard import Leonard
  
  if __name__ == '__main__':
      os.chdir('../')
      telegram_client = telegram.Bot(os.environ['BOT_TOKEN'])
      bot = Leonard(telegram_client)
-     i = 0
+     bot.collect_plugins()
      while True:
-         if i % 10 == 0:
-             bot.collect_plugins()
          for name, check, send in bot.subscriptions:
              send(bot, check(bot))
-         i += 1
+         time.sleep(60)
  
Remove collecting plugins every second
## Code Before:
import os

import telegram

from leonard import Leonard

if __name__ == '__main__':
    os.chdir('../')
    telegram_client = telegram.Bot(os.environ['BOT_TOKEN'])
    bot = Leonard(telegram_client)
    i = 0
    while True:
        if i % 10 == 0:
            bot.collect_plugins()
        for name, check, send in bot.subscriptions:
            send(bot, check(bot))
        i += 1

## Instruction:
Remove collecting plugins every second
## Code After:
import os
import time

import telegram

from leonard import Leonard

if __name__ == '__main__':
    os.chdir('../')
    telegram_client = telegram.Bot(os.environ['BOT_TOKEN'])
    bot = Leonard(telegram_client)
    bot.collect_plugins()
    while True:
        for name, check, send in bot.subscriptions:
            send(bot, check(bot))
        time.sleep(60)
