kagarlickij
kagarlickij

Reputation: 8107

Make slack event message.im work only with bot mention

I'm working on slack bot that will generate some creds for users, so it must be asked and reply in direct messages only.

It works with message.im Slack event, but event is triggered twice - when user asks bot AND when bot replies: enter image description here

I have a trap for second event in my code:

    if "subtype" in SLACK_EVENT["event"]:
        print('Ignore bot event..')
        exit(0)

..but I'd like to get rid of that.

Can I somehow combine (add AND condition) message.im with app_mention?

So user will send IM to bot and only of bot was mentioned event will raise?

Upvotes: 1

Views: 412

Answers (1)

Erik Kalkoken
Erik Kalkoken

Reputation: 32737

That is not possible. If you are only interested to a subset of message.im events you need to filter them out in your code as you suggested.

Upvotes: 1

Related Questions