Skip to content

Instantly share code, notes, and snippets.

@mingkyme
Created April 15, 2021 02:14
Show Gist options
  • Save mingkyme/23fd9357d8e702e6fec7ce51bfc44cc2 to your computer and use it in GitHub Desktop.
Save mingkyme/23fd9357d8e702e6fec7ce51bfc44cc2 to your computer and use it in GitHub Desktop.
alfred workflow에서 discord로 메시지 보내기
import sys
import requests
message = sys.argv[1]
token = "TOKEN";
channel_id = "CHANNEL ID"
channel_url = "https://discord.com/api/v8/channels/"+channel_id+"/messages"
headers = {
'Authorization': token,
'Accept': '/',
'Authority': 'discordapp.com',
'content-type': 'application/json'
}
respone = requests.post(channel_url, headers=headers, data='{"content":"'+message+'"}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment