Guilds
هذا المحتوى غير متوفر بلغتك بعد.
Get all guilds your Discord bot is in
Section titled “Get all guilds your Discord bot is in”Get detailed information about each individual server your bot is in
POST /api/discord/guilds
https://api.cookie-api.com/api/discord/guilds Authentication Learn how to get your API Key and use it in your requests!
Parameters
Section titled “Parameters”{ "bot_token": "Your Bot's Token"}Wondering how you can use your Bot Token without needing to provide it in every request? Check out this guide!
Request examples
Section titled “Request examples”curl --location 'https://api.cookie-api.com/api/discord/guilds' \--header 'Authorization: API_Key' \--header 'Content-Type: application/json' \--data '{ "bot_token": "Your Bot Token"}'import requests
url = 'https://api.cookie-api.com/api/discord/guilds'headers = { 'Authorization': 'API_Key', 'Content-Type': 'application/json'}
data = { 'bot_token': 'Your Bot Token'}
response = requests.post(url, headers=headers, json=data)print(response.json())const fetch = require('node-fetch');
const url = 'https://api.cookie-api.com/api/discord/guilds';const headers = { 'Authorization': 'API_Key', 'Content-Type': 'application/json'};
const body = JSON.stringify({ bot_token: 'Your Bot Token'});
fetch(url, { method: 'POST', headers: headers, body: body}).then(res => res.json()).then(data => console.log(data)).catch(err => console.error(err));package main
import ( "bytes" "encoding/json" "fmt" "log" "net/http")
func main() { url := "https://api.cookie-api.com/api/discord/guilds" requestBody := map[string]interface{}{ "bot_token": "Your Bot Token", } jsonData, err := json.Marshal(requestBody) if err != nil { log.Fatal(err) }
req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData)) if err != nil { log.Fatal(err) }
req.Header.Set("Authorization", "API_Key") req.Header.Set("Content-Type", "application/json")
client := &http.Client{} resp, err := client.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)}const https = require('https');
const data = JSON.stringify({ bot_token: 'Your Bot Token'});
const options = { hostname: 'api.cookie-api.com', path: '/api/discord/guilds', method: 'POST', headers: { 'Authorization': 'API_Key', 'Content-Type': 'application/json', 'Content-Length': data.length }};
const req = https.request(options, res => { let body = '';
res.on('data', chunk => { body += chunk; });
res.on('end', () => { console.log(JSON.parse(body)); });});
req.on('error', error => { console.error(error);});
req.write(data);req.end();require 'net/http'require 'uri'require 'json'
uri = URI.parse('https://api.cookie-api.com/api/discord/guilds')
headers = { 'Authorization' => 'API_Key', 'Content-Type' => 'application/json'}
request_body = { 'bot_token' => 'Your Bot Token'}.to_json
request = Net::HTTP::Post.new(uri, headers)request.body = request_body
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request)end
puts response.bodyuse reqwest::blocking::Client;use reqwest::header::HeaderMap;use serde_json::json;
fn main() { let url = "https://api.cookie-api.com/api/discord/guilds";
let request_body = json!({ "bot_token": "Your Bot Token" });
let client = Client::new(); let mut headers = HeaderMap::new(); headers.insert("Authorization", "API_Key".parse().unwrap()); headers.insert("Content-Type", "application/json".parse().unwrap());
let res = client .post(url) .json(&request_body) .headers(headers) .send() .unwrap();
println!("{}", res.text().unwrap());}Responses
Section titled “Responses”{ "guilds": [ { "banner": null, "channel_counts": { "0": 6, "1": 0, "2": 0, "3": 0, "4": 2, "5": 0, "10": 0, "11": 0, "12": 0, "13": 0, "15": 1, "16": 0 }, "channels": [ { "id": 1283444078570373142, "name": "Category", "type": 4 }, { "id": 1283444260678402182, "name": "general-chat", "type": 0 }, ], "created_at": "2024-09-11T15:08:33.401000+00:00", "icon_url": "https://cdn.discordapp.com/icons/1283444077865599027/208d06e7f2e853761b9489447719ef89.png?size=1024", "id": 1283444077865599027, "member_count": 4, "name": "Cookie API Beta", "owner_id": 1025427725021872158, "roles": [ "@everyone", "Test-Staff-Role", "test-Role", "Cookie Test", "admin" ], "rules_channel": "rules", "rules_channel_id": 1283876571043729408 } ], "success": true, "total_guilds": 1}Get a guild your Discord bot is in
Section titled “Get a guild your Discord bot is in”Get detailed information about a server your bot is in
POST /api/discord/guild
https://api.cookie-api.com/api/discord/guild Authentication Learn how to get your API Key and use it in your requests!
Responses
Section titled “Responses”{ "bot_token": "Your Bot's Token", "guild_id": "Target Guild ID",}Learn more about why Cookie API needs your Bot’s Token here.
Request examples
Section titled “Request examples”curl --location 'https://api.cookie-api.com/api/discord/guild' \--header 'Authorization: API_Key' \--header 'Content-Type: application/json' \--data '{ "bot_token": "Your Bot Token"}'import requests
url = "https://api.cookie-api.com/api/discord/guild"headers = { "Authorization": "API_Key", "Content-Type": "application/json"}payload = { "bot_token": "Your Bot Token"}
response = requests.post(url, headers=headers, json=payload)print(response.json())fetch('https://api.cookie-api.com/api/discord/guild', { method: 'POST', headers: { 'Authorization': 'API_Key', 'Content-Type': 'application/json' }, body: JSON.stringify({ bot_token: 'Your Bot Token' })}).then(res => res.json()).then(console.log).catch(console.error);package main
import ( "bytes" "encoding/json" "fmt" "net/http")
func main() { url := "https://api.cookie-api.com/api/discord/guild" payload := map[string]string{ "bot_token": "Your Bot Token", }
body, _ := json.Marshal(payload) req, _ := http.NewRequest("POST", url, bytes.NewBuffer(body)) req.Header.Set("Authorization", "API_Key") req.Header.Set("Content-Type", "application/json")
client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)}const https = require('https');
const data = JSON.stringify({ bot_token: 'Your Bot Token'});
const options = { hostname: 'api.cookie-api.com', path: '/api/discord/guild', method: 'POST', headers: { 'Authorization': 'API_Key', 'Content-Type': 'application/json', 'Content-Length': data.length }};
const req = https.request(options, res => { let response = ''; res.on('data', chunk => response += chunk); res.on('end', () => console.log(JSON.parse(response)));});
req.on('error', error => console.error(error));req.write(data);req.end();require 'net/http'require 'uri'require 'json'
uri = URI.parse("https://api.cookie-api.com/api/discord/guild")request = Net::HTTP::Post.new(uri)request["Authorization"] = "API_Key"request["Content-Type"] = "application/json"request.body = { bot_token: "Your Bot Token" }.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request)end
puts response.bodyuse reqwest::blocking::Client;use serde_json::json;
fn main() { let client = Client::new(); let res = client.post("https://api.cookie-api.com/api/discord/guild") .header("Authorization", "API_Key") .header("Content-Type", "application/json") .json(&json!({ "bot_token": "Your Bot Token" })) .send() .unwrap();
println!("{:#?}", res.text().unwrap());}Responses
Section titled “Responses”{ "guild": { "banner": null, "channel_counts": { "0": 6, "1": 0, "2": 0, "3": 0, "4": 2, "5": 0, "10": 0, "11": 0, "12": 0, "13": 0, "15": 1, "16": 0 }, "channels": [ { "id": 1283444078570373142, "name": "Category", "type": 4 }, { "id": 1283444260678402182, "name": "general-chat", "type": 0 }, ], "created_at": "2024-09-11T15:08:33.401000+00:00", "icon_url": "https://cdn.discordapp.com/icons/1283444077865599027/208d06e7f2e853761b9489447719ef89.png?size=1024", "id": 1283444077865599027, "member_count": 4, "name": "Cookie API Beta", "owner_id": 1025427725021872158, "roles": [ "@everyone", "Test-Staff-Role", "test-Role", "Cookie Test", "admin" ], "rules_channel": "rules", "rules_channel_id": 1283876571043729408 }, "success": true}