REST API v1 · למפתחים · מדריך עיון ל-API
מדריך עיון ל-API: ניהול
כל 9 נקודות הקצה של ניהול ב-REST API v1 של BotGG: הרשאות, פרמטרים, שדות, שגיאות ודוגמאות מוכנות ב-curl, JavaScript ו-Python.
תיעוד למפתחים
בעמוד הזה
נקודות קצה
הנתיבים יחסיים ל-https://console.botgg.app/api/v1. שלחו את מפתח ה-API בכותרת Authorization: Bearer botgg_…; מזהים הם מחרוזות.
| נקודת קצה | הרשאה | תיאור |
|---|---|---|
GET/guilds/{guildId}/moderation/cases | moderation:read | List moderation cases |
GET/guilds/{guildId}/moderation/cases/{number} | moderation:read | Get a moderation case |
POST/guilds/{guildId}/moderation/users/{userId}/warn | moderation:write | Warn a member |
POST/guilds/{guildId}/moderation/users/{userId}/timeout | moderation:write | Time out a member |
POST/guilds/{guildId}/moderation/users/{userId}/untimeout | moderation:write | Remove a member’s timeout |
POST/guilds/{guildId}/moderation/users/{userId}/kick | moderation:write | Kick a member |
POST/guilds/{guildId}/moderation/users/{userId}/ban | moderation:write | Ban a user |
POST/guilds/{guildId}/moderation/users/{userId}/unban | moderation:write | Unban a user |
GET/guilds/{guildId}/moderation/actions/{actionId} | moderation:write | Get the result of a moderation action |
מלבד השגיאות הייחודיות שלה (בהמשך), כל נקודת קצה יכולה להחזיר את השגיאות הכלליות האלה:
List moderation cases
GET/guilds/{guildId}/moderation/cases
Newest first (deleted cases are left out). Pass before=<nextCursor> for the next page.
נדרש שהפיצ׳ר הזה יהיה מופעל בשרת: ניהול
| שם | מיקום | סוג | חובה | תיאור |
|---|---|---|---|---|
guildId | נתיב | string | כן | המזהה של השרת שלכם · מזהה דיסקורד (מחרוזת) |
action | query | string | לא | אחד מ: warn, timeout, untimeout, kick, ban, tempban, softban, unban, note, purge |
source | query | string | לא | אחד מ: command, automod, escalation, antiraid, antinuke, console, api |
userId | query | string | לא | Only cases against this user מזהה דיסקורד (מחרוזת) |
moderatorId | query | string | לא | מזהה דיסקורד (מחרוזת) |
active | query | string | לא | 1 = only running warnings / timeouts / tempbans אחד מ: 1, 0, true, false |
limit | query | integer | לא | 1–100 · ברירת מחדל 25 |
before | query | integer | לא | 1–999,999,999 |
תשובה
| שדה | סוג | חובה | תיאור |
|---|---|---|---|
items | array of object | כן | |
items[].number | integer | כן | |
items[].action | string | כן | אחד מ: warn, timeout, untimeout, kick, ban, tempban, softban, unban, note, purge |
items[].userId | string | כן | The target |
items[].userTag | string | null | כן | |
items[].moderatorId | string | כן | |
items[].reason | string | null | כן | |
items[].durationSeconds | integer | null | כן | |
items[].evidence | array of string | כן | |
items[].source | string | כן | אחד מ: command, automod, escalation, antiraid, antinuke, console, api |
items[].active | boolean | כן | |
items[].expiresAt | string | null | כן | ISO 8601 date-time |
items[].resolvedAt | string | null | כן | ISO 8601 date-time |
items[].dmStatus | string | null | כן | אחד מ: sent, failed, off |
items[].apiKey | object | null | כן | Set when the action was made with an API key |
items[].apiKey.id | integer | null | כן | |
items[].apiKey.name | string | null | כן | |
items[].createdAt | string | null | כן | ISO 8601 date-time |
nextCursor | string | null | כן |
{
"items": [
{
"number": 7,
"action": "warn",
"userId": "876543210987654321",
"userTag": "example",
"moderatorId": "234567890123456789",
"reason": "Tournament prize",
"durationSeconds": 3600,
"evidence": [
"example"
],
"source": "command",
"active": true,
"expiresAt": "2026-10-07T12:00:00.000Z",
"resolvedAt": "2026-10-07T12:00:00.000Z",
"dmStatus": "sent",
"apiKey": {
"id": 98765,
"name": "Example"
},
"createdAt": "2026-10-07T12:00:00.000Z"
}
],
"nextCursor": "98700"
}דוגמאות
curl -s "https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/cases?limit=25" \
-H "Authorization: Bearer $BOTGG_API_KEY"// Node.js 18+ (built-in fetch) — on your server, never in a browser
const res = await fetch('https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/cases?limit=25', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.BOTGG_API_KEY}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(`${res.status} ${data.error}: ${data.message}`);
console.log(data);import os
import requests
res = requests.get(
"https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/cases",
headers={
"Authorization": f"Bearer {os.environ['BOTGG_API_KEY']}",
},
params={
"limit": 25,
},
timeout=10,
)
data = res.json()
if not res.ok:
raise RuntimeError(f"{res.status_code} {data['error']}: {data['message']}")
print(data)שגיאות
| HTTP | קודים |
|---|---|
| 409 | FEATURE_DISABLED |
| 503 | SERVICE_UNAVAILABLE |
Get a moderation case
GET/guilds/{guildId}/moderation/cases/{number}
With its timeline (created, reason / evidence edits, DM, expired, revoked, escalated).
נדרש שהפיצ׳ר הזה יהיה מופעל בשרת: ניהול
| שם | מיקום | סוג | חובה | תיאור |
|---|---|---|---|---|
guildId | נתיב | string | כן | המזהה של השרת שלכם · מזהה דיסקורד (מחרוזת) |
number | נתיב | string | כן |
תשובה
| שדה | סוג | חובה | תיאור |
|---|---|---|---|
number | integer | כן | |
action | string | כן | אחד מ: warn, timeout, untimeout, kick, ban, tempban, softban, unban, note, purge |
userId | string | כן | The target |
userTag | string | null | כן | |
moderatorId | string | כן | |
reason | string | null | כן | |
durationSeconds | integer | null | כן | |
evidence | array of string | כן | |
source | string | כן | אחד מ: command, automod, escalation, antiraid, antinuke, console, api |
active | boolean | כן | |
expiresAt | string | null | כן | ISO 8601 date-time |
resolvedAt | string | null | כן | ISO 8601 date-time |
dmStatus | string | null | כן | אחד מ: sent, failed, off |
apiKey | object | null | כן | Set when the action was made with an API key |
apiKey.id | integer | null | כן | |
apiKey.name | string | null | כן | |
createdAt | string | null | כן | ISO 8601 date-time |
events | array of object | כן | |
events[].type | string | כן | |
events[].actorId | string | null | כן | |
events[].data | any | כן | |
events[].createdAt | string | null | כן | ISO 8601 date-time |
{
"number": 7,
"action": "warn",
"userId": "876543210987654321",
"userTag": "example",
"moderatorId": "234567890123456789",
"reason": "Tournament prize",
"durationSeconds": 3600,
"evidence": [
"example"
],
"source": "command",
"active": true,
"expiresAt": "2026-10-07T12:00:00.000Z",
"resolvedAt": "2026-10-07T12:00:00.000Z",
"dmStatus": "sent",
"apiKey": {
"id": 98765,
"name": "Example"
},
"createdAt": "2026-10-07T12:00:00.000Z",
"events": [
{
"type": "example",
"actorId": "234567890123456789",
"data": null,
"createdAt": "2026-10-07T12:00:00.000Z"
}
]
}דוגמאות
curl -s "https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/cases/234567890123456789" \
-H "Authorization: Bearer $BOTGG_API_KEY"// Node.js 18+ (built-in fetch) — on your server, never in a browser
const res = await fetch('https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/cases/234567890123456789', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.BOTGG_API_KEY}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(`${res.status} ${data.error}: ${data.message}`);
console.log(data);import os
import requests
res = requests.get(
"https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/cases/234567890123456789",
headers={
"Authorization": f"Bearer {os.environ['BOTGG_API_KEY']}",
},
timeout=10,
)
data = res.json()
if not res.ok:
raise RuntimeError(f"{res.status_code} {data['error']}: {data['message']}")
print(data)שגיאות
| HTTP | קודים |
|---|---|
| 404 | CASE_NOT_FOUND |
| 409 | FEATURE_DISABLED |
| 503 | SERVICE_UNAVAILABLE |
Warn a member
POST/guilds/{guildId}/moderation/users/{userId}/warn
Same as /warn: a warning case (counts toward escalation), DM per the Moderation settings. Acts in the name of the key’s creator, who must still have the matching Discord permission; the target must be below their and the bot’s highest role (never the owner, the bot or the creator). The bot runs it within a few seconds — poll GET …/moderation/actions/{actionId}. At most 10 actions a minute per key. Written to the audit log.
נדרש שהפיצ׳ר הזה יהיה מופעל בשרת: ניהול
| שם | מיקום | סוג | חובה | תיאור |
|---|---|---|---|---|
guildId | נתיב | string | כן | המזהה של השרת שלכם · מזהה דיסקורד (מחרוזת) |
userId | נתיב | string | כן | מזהה הדיסקורד של החבר/ה · מזהה דיסקורד (מחרוזת) |
Idempotency-Key | כותרת | string | לא | לא חובה. שלחו ערך ייחודי (UUID) והשתמשו בו שוב בניסיונות חוזרים — השינוי יקרה פעם אחת בלבד. איך זה עובד |
גוף הבקשה
| שדה | סוג | חובה | תיאור |
|---|---|---|---|
reason | string | כן | Required. Shown in the case, the mod log and the member’s DM 1–500 תווים |
evidence | array of string | לא | Up to 5 links עד 5 פריטים |
תשובה
| שדה | סוג | חובה | תיאור |
|---|---|---|---|
actionId | string | כן | |
action | string | כן | אחד מ: warn, timeout, untimeout, kick, ban, unban |
userId | string | כן | |
status | string | כן | אחד מ: pending, running, done, failed |
caseNumber | integer | null | כן | |
error | string | null | כן | Refusal code when failed (e.g. HIERARCHY_HIGHER, MODERATOR_MISSING_PERMISSION, NOT_BANNED, BOT_MISSING_PERMISSIONS) |
requestedAt | string | null | כן | ISO 8601 date-time |
{
"actionId": "234567890123456789",
"action": "warn",
"userId": "876543210987654321",
"status": "pending",
"caseNumber": 10,
"error": "example",
"requestedAt": "2026-10-07T12:00:00.000Z"
}דוגמאות
curl -s -X POST "https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/warn" \
-H "Authorization: Bearer $BOTGG_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"reason":"Tournament prize","evidence":["example"]}'// Node.js 18+ (built-in fetch) — on your server, never in a browser
const res = await fetch('https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/warn', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.BOTGG_API_KEY}`,
'Content-Type': 'application/json',
'Idempotency-Key': crypto.randomUUID(), // reuse it when you retry this request
},
body: JSON.stringify({
reason: 'Tournament prize',
evidence: [
'example',
],
}),
});
const data = await res.json();
if (!res.ok) throw new Error(`${res.status} ${data.error}: ${data.message}`);
console.log(data);import os, uuid
import requests
res = requests.post(
"https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/warn",
headers={
"Authorization": f"Bearer {os.environ['BOTGG_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()), # reuse it when you retry this request
},
json={
"reason": "Tournament prize",
"evidence": [
"example",
],
},
timeout=10,
)
data = res.json()
if not res.ok:
raise RuntimeError(f"{res.status_code} {data['error']}: {data['message']}")
print(data)שגיאות
Time out a member
POST/guilds/{guildId}/moderation/users/{userId}/timeout
Same as /timeout: Discord timeout for durationSeconds, a case, DM per the settings. Acts in the name of the key’s creator, who must still have the matching Discord permission; the target must be below their and the bot’s highest role (never the owner, the bot or the creator). The bot runs it within a few seconds — poll GET …/moderation/actions/{actionId}. At most 10 actions a minute per key. Written to the audit log.
נדרש שהפיצ׳ר הזה יהיה מופעל בשרת: ניהול
| שם | מיקום | סוג | חובה | תיאור |
|---|---|---|---|---|
guildId | נתיב | string | כן | המזהה של השרת שלכם · מזהה דיסקורד (מחרוזת) |
userId | נתיב | string | כן | מזהה הדיסקורד של החבר/ה · מזהה דיסקורד (מחרוזת) |
Idempotency-Key | כותרת | string | לא | לא חובה. שלחו ערך ייחודי (UUID) והשתמשו בו שוב בניסיונות חוזרים — השינוי יקרה פעם אחת בלבד. איך זה עובד |
גוף הבקשה
| שדה | סוג | חובה | תיאור |
|---|---|---|---|
reason | string | כן | Required. Shown in the case, the mod log and the member’s DM 1–500 תווים |
durationSeconds | integer | כן | 1 minute to 28 days 60–2,419,200 |
evidence | array of string | לא | Up to 5 links עד 5 פריטים |
תשובה
| שדה | סוג | חובה | תיאור |
|---|---|---|---|
actionId | string | כן | |
action | string | כן | אחד מ: warn, timeout, untimeout, kick, ban, unban |
userId | string | כן | |
status | string | כן | אחד מ: pending, running, done, failed |
caseNumber | integer | null | כן | |
error | string | null | כן | Refusal code when failed (e.g. HIERARCHY_HIGHER, MODERATOR_MISSING_PERMISSION, NOT_BANNED, BOT_MISSING_PERMISSIONS) |
requestedAt | string | null | כן | ISO 8601 date-time |
{
"actionId": "234567890123456789",
"action": "warn",
"userId": "876543210987654321",
"status": "pending",
"caseNumber": 10,
"error": "example",
"requestedAt": "2026-10-07T12:00:00.000Z"
}דוגמאות
curl -s -X POST "https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/timeout" \
-H "Authorization: Bearer $BOTGG_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"reason":"Tournament prize","durationSeconds":3600,"evidence":["example"]}'// Node.js 18+ (built-in fetch) — on your server, never in a browser
const res = await fetch('https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/timeout', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.BOTGG_API_KEY}`,
'Content-Type': 'application/json',
'Idempotency-Key': crypto.randomUUID(), // reuse it when you retry this request
},
body: JSON.stringify({
reason: 'Tournament prize',
durationSeconds: 3600,
evidence: [
'example',
],
}),
});
const data = await res.json();
if (!res.ok) throw new Error(`${res.status} ${data.error}: ${data.message}`);
console.log(data);import os, uuid
import requests
res = requests.post(
"https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/timeout",
headers={
"Authorization": f"Bearer {os.environ['BOTGG_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()), # reuse it when you retry this request
},
json={
"reason": "Tournament prize",
"durationSeconds": 3600,
"evidence": [
"example",
],
},
timeout=10,
)
data = res.json()
if not res.ok:
raise RuntimeError(f"{res.status_code} {data['error']}: {data['message']}")
print(data)שגיאות
Remove a member’s timeout
POST/guilds/{guildId}/moderation/users/{userId}/untimeout
Same as /untimeout. Acts in the name of the key’s creator, who must still have the matching Discord permission; the target must be below their and the bot’s highest role (never the owner, the bot or the creator). The bot runs it within a few seconds — poll GET …/moderation/actions/{actionId}. At most 10 actions a minute per key. Written to the audit log.
נדרש שהפיצ׳ר הזה יהיה מופעל בשרת: ניהול
| שם | מיקום | סוג | חובה | תיאור |
|---|---|---|---|---|
guildId | נתיב | string | כן | המזהה של השרת שלכם · מזהה דיסקורד (מחרוזת) |
userId | נתיב | string | כן | מזהה הדיסקורד של החבר/ה · מזהה דיסקורד (מחרוזת) |
Idempotency-Key | כותרת | string | לא | לא חובה. שלחו ערך ייחודי (UUID) והשתמשו בו שוב בניסיונות חוזרים — השינוי יקרה פעם אחת בלבד. איך זה עובד |
גוף הבקשה
| שדה | סוג | חובה | תיאור |
|---|---|---|---|
reason | string | כן | Required. Shown in the case, the mod log and the member’s DM 1–500 תווים |
תשובה
| שדה | סוג | חובה | תיאור |
|---|---|---|---|
actionId | string | כן | |
action | string | כן | אחד מ: warn, timeout, untimeout, kick, ban, unban |
userId | string | כן | |
status | string | כן | אחד מ: pending, running, done, failed |
caseNumber | integer | null | כן | |
error | string | null | כן | Refusal code when failed (e.g. HIERARCHY_HIGHER, MODERATOR_MISSING_PERMISSION, NOT_BANNED, BOT_MISSING_PERMISSIONS) |
requestedAt | string | null | כן | ISO 8601 date-time |
{
"actionId": "234567890123456789",
"action": "warn",
"userId": "876543210987654321",
"status": "pending",
"caseNumber": 10,
"error": "example",
"requestedAt": "2026-10-07T12:00:00.000Z"
}דוגמאות
curl -s -X POST "https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/untimeout" \
-H "Authorization: Bearer $BOTGG_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"reason":"Tournament prize"}'// Node.js 18+ (built-in fetch) — on your server, never in a browser
const res = await fetch('https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/untimeout', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.BOTGG_API_KEY}`,
'Content-Type': 'application/json',
'Idempotency-Key': crypto.randomUUID(), // reuse it when you retry this request
},
body: JSON.stringify({
reason: 'Tournament prize',
}),
});
const data = await res.json();
if (!res.ok) throw new Error(`${res.status} ${data.error}: ${data.message}`);
console.log(data);import os, uuid
import requests
res = requests.post(
"https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/untimeout",
headers={
"Authorization": f"Bearer {os.environ['BOTGG_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()), # reuse it when you retry this request
},
json={
"reason": "Tournament prize",
},
timeout=10,
)
data = res.json()
if not res.ok:
raise RuntimeError(f"{res.status_code} {data['error']}: {data['message']}")
print(data)שגיאות
Kick a member
POST/guilds/{guildId}/moderation/users/{userId}/kick
Same as /kick: DM (before the kick) per the settings, then the kick and a case. Acts in the name of the key’s creator, who must still have the matching Discord permission; the target must be below their and the bot’s highest role (never the owner, the bot or the creator). The bot runs it within a few seconds — poll GET …/moderation/actions/{actionId}. At most 10 actions a minute per key. Written to the audit log.
נדרש שהפיצ׳ר הזה יהיה מופעל בשרת: ניהול
| שם | מיקום | סוג | חובה | תיאור |
|---|---|---|---|---|
guildId | נתיב | string | כן | המזהה של השרת שלכם · מזהה דיסקורד (מחרוזת) |
userId | נתיב | string | כן | מזהה הדיסקורד של החבר/ה · מזהה דיסקורד (מחרוזת) |
Idempotency-Key | כותרת | string | לא | לא חובה. שלחו ערך ייחודי (UUID) והשתמשו בו שוב בניסיונות חוזרים — השינוי יקרה פעם אחת בלבד. איך זה עובד |
גוף הבקשה
| שדה | סוג | חובה | תיאור |
|---|---|---|---|
reason | string | כן | Required. Shown in the case, the mod log and the member’s DM 1–500 תווים |
evidence | array of string | לא | Up to 5 links עד 5 פריטים |
תשובה
| שדה | סוג | חובה | תיאור |
|---|---|---|---|
actionId | string | כן | |
action | string | כן | אחד מ: warn, timeout, untimeout, kick, ban, unban |
userId | string | כן | |
status | string | כן | אחד מ: pending, running, done, failed |
caseNumber | integer | null | כן | |
error | string | null | כן | Refusal code when failed (e.g. HIERARCHY_HIGHER, MODERATOR_MISSING_PERMISSION, NOT_BANNED, BOT_MISSING_PERMISSIONS) |
requestedAt | string | null | כן | ISO 8601 date-time |
{
"actionId": "234567890123456789",
"action": "warn",
"userId": "876543210987654321",
"status": "pending",
"caseNumber": 10,
"error": "example",
"requestedAt": "2026-10-07T12:00:00.000Z"
}דוגמאות
curl -s -X POST "https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/kick" \
-H "Authorization: Bearer $BOTGG_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"reason":"Tournament prize","evidence":["example"]}'// Node.js 18+ (built-in fetch) — on your server, never in a browser
const res = await fetch('https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/kick', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.BOTGG_API_KEY}`,
'Content-Type': 'application/json',
'Idempotency-Key': crypto.randomUUID(), // reuse it when you retry this request
},
body: JSON.stringify({
reason: 'Tournament prize',
evidence: [
'example',
],
}),
});
const data = await res.json();
if (!res.ok) throw new Error(`${res.status} ${data.error}: ${data.message}`);
console.log(data);import os, uuid
import requests
res = requests.post(
"https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/kick",
headers={
"Authorization": f"Bearer {os.environ['BOTGG_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()), # reuse it when you retry this request
},
json={
"reason": "Tournament prize",
"evidence": [
"example",
],
},
timeout=10,
)
data = res.json()
if not res.ok:
raise RuntimeError(f"{res.status_code} {data['error']}: {data['message']}")
print(data)שגיאות
Ban a user
POST/guilds/{guildId}/moderation/users/{userId}/ban
Same as /ban: with durationSeconds a temporary ban the bot lifts automatically; deleteMessageSeconds deletes recent messages. Works for users who already left. Acts in the name of the key’s creator, who must still have the matching Discord permission; the target must be below their and the bot’s highest role (never the owner, the bot or the creator). The bot runs it within a few seconds — poll GET …/moderation/actions/{actionId}. At most 10 actions a minute per key. Written to the audit log.
נדרש שהפיצ׳ר הזה יהיה מופעל בשרת: ניהול
| שם | מיקום | סוג | חובה | תיאור |
|---|---|---|---|---|
guildId | נתיב | string | כן | המזהה של השרת שלכם · מזהה דיסקורד (מחרוזת) |
userId | נתיב | string | כן | מזהה הדיסקורד של החבר/ה · מזהה דיסקורד (מחרוזת) |
Idempotency-Key | כותרת | string | לא | לא חובה. שלחו ערך ייחודי (UUID) והשתמשו בו שוב בניסיונות חוזרים — השינוי יקרה פעם אחת בלבד. איך זה עובד |
גוף הבקשה
| שדה | סוג | חובה | תיאור |
|---|---|---|---|
reason | string | כן | Required. Shown in the case, the mod log and the member’s DM 1–500 תווים |
deleteMessageSeconds | integer | לא | Delete the user’s messages of the last N seconds (≤ 7 days) 0–604,800 |
durationSeconds | integer | null | לא | Temporary ban (≤ 365 days); omit for a permanent ban 60–31,536,000 |
evidence | array of string | לא | Up to 5 links עד 5 פריטים |
תשובה
| שדה | סוג | חובה | תיאור |
|---|---|---|---|
actionId | string | כן | |
action | string | כן | אחד מ: warn, timeout, untimeout, kick, ban, unban |
userId | string | כן | |
status | string | כן | אחד מ: pending, running, done, failed |
caseNumber | integer | null | כן | |
error | string | null | כן | Refusal code when failed (e.g. HIERARCHY_HIGHER, MODERATOR_MISSING_PERMISSION, NOT_BANNED, BOT_MISSING_PERMISSIONS) |
requestedAt | string | null | כן | ISO 8601 date-time |
{
"actionId": "234567890123456789",
"action": "warn",
"userId": "876543210987654321",
"status": "pending",
"caseNumber": 10,
"error": "example",
"requestedAt": "2026-10-07T12:00:00.000Z"
}דוגמאות
curl -s -X POST "https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/ban" \
-H "Authorization: Bearer $BOTGG_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"reason":"Tournament prize","deleteMessageSeconds":3600,"durationSeconds":3600,"evidence":["example"]}'// Node.js 18+ (built-in fetch) — on your server, never in a browser
const res = await fetch('https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/ban', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.BOTGG_API_KEY}`,
'Content-Type': 'application/json',
'Idempotency-Key': crypto.randomUUID(), // reuse it when you retry this request
},
body: JSON.stringify({
reason: 'Tournament prize',
deleteMessageSeconds: 3600,
durationSeconds: 3600,
evidence: [
'example',
],
}),
});
const data = await res.json();
if (!res.ok) throw new Error(`${res.status} ${data.error}: ${data.message}`);
console.log(data);import os, uuid
import requests
res = requests.post(
"https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/ban",
headers={
"Authorization": f"Bearer {os.environ['BOTGG_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()), # reuse it when you retry this request
},
json={
"reason": "Tournament prize",
"deleteMessageSeconds": 3600,
"durationSeconds": 3600,
"evidence": [
"example",
],
},
timeout=10,
)
data = res.json()
if not res.ok:
raise RuntimeError(f"{res.status_code} {data['error']}: {data['message']}")
print(data)שגיאות
Unban a user
POST/guilds/{guildId}/moderation/users/{userId}/unban
Same as /unban (ends a running tempban). 409 NOT_BANNED when the user isn’t banned. Acts in the name of the key’s creator, who must still have the matching Discord permission; the target must be below their and the bot’s highest role (never the owner, the bot or the creator). The bot runs it within a few seconds — poll GET …/moderation/actions/{actionId}. At most 10 actions a minute per key. Written to the audit log.
נדרש שהפיצ׳ר הזה יהיה מופעל בשרת: ניהול
| שם | מיקום | סוג | חובה | תיאור |
|---|---|---|---|---|
guildId | נתיב | string | כן | המזהה של השרת שלכם · מזהה דיסקורד (מחרוזת) |
userId | נתיב | string | כן | מזהה הדיסקורד של החבר/ה · מזהה דיסקורד (מחרוזת) |
Idempotency-Key | כותרת | string | לא | לא חובה. שלחו ערך ייחודי (UUID) והשתמשו בו שוב בניסיונות חוזרים — השינוי יקרה פעם אחת בלבד. איך זה עובד |
גוף הבקשה
| שדה | סוג | חובה | תיאור |
|---|---|---|---|
reason | string | כן | Required. Shown in the case, the mod log and the member’s DM 1–500 תווים |
תשובה
| שדה | סוג | חובה | תיאור |
|---|---|---|---|
actionId | string | כן | |
action | string | כן | אחד מ: warn, timeout, untimeout, kick, ban, unban |
userId | string | כן | |
status | string | כן | אחד מ: pending, running, done, failed |
caseNumber | integer | null | כן | |
error | string | null | כן | Refusal code when failed (e.g. HIERARCHY_HIGHER, MODERATOR_MISSING_PERMISSION, NOT_BANNED, BOT_MISSING_PERMISSIONS) |
requestedAt | string | null | כן | ISO 8601 date-time |
{
"actionId": "234567890123456789",
"action": "warn",
"userId": "876543210987654321",
"status": "pending",
"caseNumber": 10,
"error": "example",
"requestedAt": "2026-10-07T12:00:00.000Z"
}דוגמאות
curl -s -X POST "https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/unban" \
-H "Authorization: Bearer $BOTGG_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"reason":"Tournament prize"}'// Node.js 18+ (built-in fetch) — on your server, never in a browser
const res = await fetch('https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/unban', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.BOTGG_API_KEY}`,
'Content-Type': 'application/json',
'Idempotency-Key': crypto.randomUUID(), // reuse it when you retry this request
},
body: JSON.stringify({
reason: 'Tournament prize',
}),
});
const data = await res.json();
if (!res.ok) throw new Error(`${res.status} ${data.error}: ${data.message}`);
console.log(data);import os, uuid
import requests
res = requests.post(
"https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/unban",
headers={
"Authorization": f"Bearer {os.environ['BOTGG_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()), # reuse it when you retry this request
},
json={
"reason": "Tournament prize",
},
timeout=10,
)
data = res.json()
if not res.ok:
raise RuntimeError(f"{res.status_code} {data['error']}: {data['message']}")
print(data)שגיאות
Get the result of a moderation action
GET/guilds/{guildId}/moderation/actions/{actionId}
Only actions made with the same API key. done → caseNumber; failed → error (the bot re-checks everything right before acting).
נדרש שהפיצ׳ר הזה יהיה מופעל בשרת: ניהול
| שם | מיקום | סוג | חובה | תיאור |
|---|---|---|---|---|
guildId | נתיב | string | כן | המזהה של השרת שלכם · מזהה דיסקורד (מחרוזת) |
actionId | נתיב | string | כן |
תשובה
| שדה | סוג | חובה | תיאור |
|---|---|---|---|
actionId | string | כן | |
action | string | כן | אחד מ: warn, timeout, untimeout, kick, ban, unban |
userId | string | כן | |
status | string | כן | אחד מ: pending, running, done, failed |
caseNumber | integer | null | כן | |
error | string | null | כן | Refusal code when failed (e.g. HIERARCHY_HIGHER, MODERATOR_MISSING_PERMISSION, NOT_BANNED, BOT_MISSING_PERMISSIONS) |
requestedAt | string | null | כן | ISO 8601 date-time |
{
"actionId": "234567890123456789",
"action": "warn",
"userId": "876543210987654321",
"status": "pending",
"caseNumber": 10,
"error": "example",
"requestedAt": "2026-10-07T12:00:00.000Z"
}דוגמאות
curl -s "https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/actions/234567890123456789" \
-H "Authorization: Bearer $BOTGG_API_KEY"// Node.js 18+ (built-in fetch) — on your server, never in a browser
const res = await fetch('https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/actions/234567890123456789', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.BOTGG_API_KEY}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(`${res.status} ${data.error}: ${data.message}`);
console.log(data);import os
import requests
res = requests.get(
"https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/actions/234567890123456789",
headers={
"Authorization": f"Bearer {os.environ['BOTGG_API_KEY']}",
},
timeout=10,
)
data = res.json()
if not res.ok:
raise RuntimeError(f"{res.status_code} {data['error']}: {data['message']}")
print(data)שגיאות
| HTTP | קודים |
|---|---|
| 404 | MODERATION_ACTION_NOT_FOUND |
| 409 | FEATURE_DISABLED |
| 503 | SERVICE_UNAVAILABLE |