diff --git a/daemons/poll.py b/daemons/poll.py index 65415e9..755140d 100644 --- a/daemons/poll.py +++ b/daemons/poll.py @@ -26,10 +26,10 @@ class Daemon(base.Daemon): print(f'process for {project_name} {bot_name} is alive') continue new_process = multiprocessing.Process(target=self.start_polling, args=[bot_info['secrets']['telegram_token'], bot_info['queue']]) - print(f'starting process for {project_name} {bot_name} is alive') + print(f'starting process for {project_name} {bot_name}') new_process.start() self.telegram_pollers[project_name][bot_name] = new_process - print(f'started process for {project_name} {bot_name} is alive') + print(f'started process for {project_name} {bot_name}') else: if process is None or not process.is_alive: print(f'process for {project_name} {bot_name} is not alive') diff --git a/local_platform.json b/local_platform.json new file mode 100644 index 0000000..055dbfd --- /dev/null +++ b/local_platform.json @@ -0,0 +1,19 @@ +{ + "configs": { + "bots": { + "pizda-bot": { + "telegram-bot": { + "type": "telegram", + "poll_enabled": true, + "mailbox_enabled": false, + "queue": "pizda_bot_worker", + "secrets": { + "telegram_token": "5652624181:AAFFVjcHJjea7wlW6MRaxjFY_eu2XWPwOns" + } + } + } + } + }, + "experiments": {}, + "platform_staff": {} +} \ No newline at end of file diff --git a/main.py b/main.py index 49ce915..d76a671 100644 --- a/main.py +++ b/main.py @@ -1,15 +1,17 @@ import sys -arg = sys.argv[-1] +# arg = sys.argv[-1] +arg = 'poll' -if arg == "poll": - print("poll is starting") - from daemons.poll import Daemon -elif arg == 'mailbox': - print("mailbox is starting") - from daemons.mailbox import Daemon -else: - raise ValueError(f"Unknown param {arg}") +if __name__ == '__main__': + if arg == "poll": + print("poll is starting") + from daemons.poll import Daemon + elif arg == 'mailbox': + print("mailbox is starting") + from daemons.mailbox import Daemon + else: + raise ValueError(f"Unknown param {arg}") -Daemon().execute() + Daemon().execute() diff --git a/utils/platform.py b/utils/platform.py index 9b4e864..4b5068d 100644 --- a/utils/platform.py +++ b/utils/platform.py @@ -88,6 +88,6 @@ class PlatformClient: platform_client = PlatformClient( 'Botalka', - os.getenv('STAGE'), + os.getenv('STAGE', 'local'), need_poll=True, )