![]() If you already have an existing slack application and don't want to rewrite your entire codebase to Bolt, then you'll need to handle the event processing yourself. Instead of time.sleep(), you can do await asyncio.sleep(.), which returns the thread to the async loop, and allow the worker thread to process other events. You can use Bolt for Python, which is a Python Slack library that natively support asynchronous even processing. There are a couple options you can do here. If you does something like time.sleep(.), that worker thread will still be occupied and unavailable to handle other requests until the sleep finishes. When it's running a view handler, it uses up a web worker thread. ![]() I can handle individual events, but I cannot handle them while another is running. State = ).get('channel')Ĭlient.chat_postMessage(channel=emoji_channel_id, text=emoji)įor message_id, message_data in ems():Ĭlient.chat_postMessage(channel=channel_id, text=text) Os.environ,'/slack/events',app)Ĭlient = WebClient(token=os.environ)īOT_ID = client.api_call("auth.test") The issue is I cannot figure out how to handle an event while another event is still running, please see the following code: rom slack import WebClientįrom slackeventsapi import SlackEventAdapter For example, I want to handle a message and have the message keep repeating in slack until a thumbs up reaction is added to that message. I'm not super experienced with decorators, and I can get the bot posting messages in slack, however I can't seem to handle two events at once. As the title states, I'm writing a Slack Bot in Python and using NGROK to host it locally.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |