mirror of
https://github.com/ND-Framework/ND_Core.git
synced 2026-08-17 05:56:01 +01:00
fix: user not found in server
This commit is contained in:
@@ -50,12 +50,28 @@ function NDCore.Functions.GetUserDiscordInfo(discordUserId)
|
|||||||
end
|
end
|
||||||
local result = json.decode(resultData)
|
local result = json.decode(resultData)
|
||||||
local roles = {}
|
local roles = {}
|
||||||
for _, roleId in pairs(result.roles) do
|
local nickname = ""
|
||||||
roles[roleId] = roleId
|
local tag = ""
|
||||||
|
if result and result.roles then
|
||||||
|
for _, roleId in pairs(result.roles) do
|
||||||
|
roles[roleId] = roleId
|
||||||
|
end
|
||||||
|
if result.nick then
|
||||||
|
nickname = result.nick
|
||||||
|
end
|
||||||
|
if result.user and result.user.username and result.user.discriminator then
|
||||||
|
tag = tostring(result.user.username) .. "#" .. tostring(result.user.discriminator)
|
||||||
|
end
|
||||||
|
data = {
|
||||||
|
nickname = nickname,
|
||||||
|
discordTag = tag,
|
||||||
|
roles = roles
|
||||||
|
}
|
||||||
|
return
|
||||||
end
|
end
|
||||||
data = {
|
data = {
|
||||||
nickname = result.nick,
|
nickname = nickname,
|
||||||
discordTag = tostring(result.user.username) .. "#" .. tostring(result.user.discriminator),
|
discordTag = tag,
|
||||||
roles = roles
|
roles = roles
|
||||||
}
|
}
|
||||||
end, "GET", "", {["Content-Type"] = "application/json", ["Authorization"] = "Bot " .. server_config.discordServerToken})
|
end, "GET", "", {["Content-Type"] = "application/json", ["Authorization"] = "Bot " .. server_config.discordServerToken})
|
||||||
|
|||||||
Reference in New Issue
Block a user