Created
January 20, 2018 23:29
-
-
Save selcukusta/227f687966eb94270d48e4591252eeda to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from slackclient import SlackClient | |
| slackclient = SlackClient("Buraya Bot User OAuth Access Token gelecek") | |
| def get_users_in_channel(channel_id): | |
| result = slackclient.api_call("conversations.members", channel=channel_id) | |
| return result["members"] | |
| def send_message(channel_id): | |
| message = ":poultry_leg: *EFSANE ÖĞLEN YEMEĞİ* :poultry_leg:" | |
| attachments = [ | |
| { | |
| "text": "Bizimle misin, değil misin?", | |
| "fallback": ":sad: Herhangi bir seçim yapamıyorsun!", | |
| "callback_id": "wopr_lunch", | |
| "color": "#3AA3E3", | |
| "attachment_type": "default", | |
| "actions": [ | |
| { | |
| "name": "yes", | |
| "text": ":yum: Tabii ki geliyorum!", | |
| "type": "button", | |
| "value": "true" | |
| }, | |
| { | |
| "name": "no", | |
| "text": ":weary: Çok aç değilim sanki!", | |
| "style": "danger", | |
| "type": "button", | |
| "value": "false" | |
| } | |
| ] | |
| } | |
| ] | |
| slackclient.api_call("chat.postMessage", | |
| channel=channel_id, | |
| text=message, | |
| as_user="true", | |
| attachments=attachments) | |
| if __name__ == "__main__": | |
| for user in get_users_in_channel("C8VA80XHN"): | |
| send_message(user) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment