Alpha documentation. To view the full documentation, go to docs.lurkr.gg
LurkrLurkr Docs
Levels

Update User Level

Update the experience of a user in a guild

PATCH/levels/{guildId}/users/{userId}
X-Api-Key<token>

The user's API key to authenticate requests

In: header

Path Parameters

guildIdSnowflake

A Discord snowflake identifier

Match^[1-9]\d+$
Length17 <= length <= 19
userIdSnowflake

A Discord snowflake identifier

Match^[1-9]\d+$
Length17 <= length <= 19
xpobject & object & integer

The amount to modify the user's XP by. We recommend using the atomic increment/decrement methods, if possible.

triggerCooldown?boolean

Whether to trigger the leveling cooldown for this user, meaning they won't gain XP for the duration of the cooldown after this request

Response Body

curl -X PATCH "https://api.lurkr.gg/v2/levels/stringstringstrin/users/stringstringstrin" \
  -H "Content-Type: application/json" \
  -d '{
    "xp": {
      "increment": 1
    }
  }'
const body = JSON.stringify({
  "xp": {
    "increment": 1
  }
})

fetch("https://api.lurkr.gg/v2/levels/stringstringstrin/users/stringstringstrin", {
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "https://api.lurkr.gg/v2/levels/stringstringstrin/users/stringstringstrin"
  body := strings.NewReader(`{
    "xp": {
      "increment": 1
    }
  }`)
  req, _ := http.NewRequest("PATCH", url, body)
  req.Header.Add("Content-Type", "application/json")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://api.lurkr.gg/v2/levels/stringstringstrin/users/stringstringstrin"
body = {
  "xp": {
    "increment": 1
  }
}
response = requests.request("PATCH", url, json = body, headers = {
  "Content-Type": "application/json"
})

print(response.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import java.time.Duration;
import java.net.http.HttpRequest.BodyPublishers;

var body = BodyPublishers.ofString("""{
  "xp": {
    "increment": 1
  }
}""");
HttpClient client = HttpClient.newBuilder()
  .connectTimeout(Duration.ofSeconds(10))
  .build();

HttpRequest.Builder requestBuilder = HttpRequest.newBuilder()
  .uri(URI.create("https://api.lurkr.gg/v2/levels/stringstringstrin/users/stringstringstrin"))
  .header("Content-Type", "application/json")
  .PATCH(body)
  .build();

try {
  HttpResponse<String> response = client.send(requestBuilder.build(), BodyHandlers.ofString());
  System.out.println("Status code: " + response.statusCode());
  System.out.println("Response body: " + response.body());
} catch (Exception e) {
  e.printStackTrace();
}
using System;
using System.Net.Http;
using System.Text;

var body = new StringContent("""
{
  "xp": {
    "increment": 1
  }
}
""", Encoding.UTF8, "application/json");

var client = new HttpClient();
var response = await client.PatchAsync("https://api.lurkr.gg/v2/levels/stringstringstrin/users/stringstringstrin", body);
var responseBody = await response.Content.ReadAsStringAsync();
{
  "level": {
    "xp": 2147483647,
    "level": 6554,
    "messageCount": 0
  }
}