-
Notifications
You must be signed in to change notification settings - Fork 0
/
Discord.sh
41 lines (30 loc) · 2.07 KB
/
Discord.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
user_id="xxxxxxxxx"
bot_token="xxxxxxxxxxxxx"
channel_id="xxxxxxxxxx"
webhook_url="https://discord.com/api/webhooks/xxxxxxxxx"
echo "Enter Message :"
read message
# For Send Message in Channel With Webhook --> Edit Channel --> Integrations --> Webhooks --> New Webhook --> Copy Webhook URL
curl -H "Content-Type: application/json" -X POST $webhook_url \
-d "{\"content\":\"$message\"}"
# For Send Message in Channel With Your Bot
curl -H "Authorization: Bot $bot_token" -H "Content-Type: application/json" -X POST \
-d "{\"content\":\"$message\"}" "https://discord.com/api/v9/channels/$channel_id/messages"
# For Send Direct Message To Other Users With Your Bot
DM_ID=$(curl -H "Authorization: Bot $bot_token" -H "Content-Type: application/json" \
-X POST -d "{\"recipient_id\": \"$user_id\"}" \
"https://discord.com/api/v9/users/@me/channels" | sed -n 's/.*"id":"\([^"]*\)".*"type":1.*/\1/p')
curl -H "Authorization: Bot $bot_token" -H "Content-Type: application/json" \
-X POST -d "{\"content\":\"$message\"}" "https://discord.com/api/v9/channels/$DM_ID/messages"
# For Send Message And File in Channel With Webhook --> Edit Channel --> Integrations --> Webhooks --> New Webhook --> Copy Webhook URL
curl -X POST -H "Content-Type: multipart/form-data" -F "file=@/home/zakzaki/Desktop/images.png" \
-F "content=$message" $webhook_url
# For Send Message And File in Channel With Your Bot
curl -X POST -H "Content-Type: multipart/form-data" -F "file=@/home/zakzaki/Desktop/images.png" \
-F "content=$message" -H "Authorization: Bot $bot_token" "https://discord.com/api/v9/channels/$channel_id/messages"
# For Send Direct Message And File To Other Users With Your Bot
DM_ID=$(curl -H "Authorization: Bot $bot_token" -H "Content-Type: application/json" \
-X POST -d "{\"recipient_id\": \"$user_id\"}" \
"https://discord.com/api/v9/users/@me/channels" | sed -n 's/.*"id":"\([^"]*\)".*"type":1.*/\1/p')
curl -X POST -H "Content-Type: multipart/form-data" -F "file=@/home/zakzaki/Desktop/images.png" \
-F "content=$message" -H "Authorization: Bot $bot_token" "https://discord.com/api/v9/channels/$DM_ID/messages"