I'm trying to send an image to user when 'message' event is triggered. I managed to send an image BUT even though I have a condition that makes bot not to reply on own messages, it sends image over and over again
BOT_ID = client.api_call('auth.test')['user_id']
file_name = "./cards/card3.png"
@slack_event_adapter.on('message')
def message(payload):
print('MESSAGE HAPPENED')
event = payload.get('event', {})
channel_id = event.get('channel')
user_id = event.get('user')
if BOT_ID != user_id and user_id:
print(f'user_id: {user_id}, bot_id: {BOT_ID}, channel_id: {channel_id}')
res = client.files_upload(
channels=channel_id,
initial_comment="Here's my file :smile:",
file=file_name,
)
I'm 100% sure that im sending only one message to the channel and somehow i get two or more