Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Not sending to discord webhook?

Asked by 5 years ago
Edited 5 years ago
events.LogArrest.OnServerEvent:Connect(function(player, t, reason, username)
    ap:AddCard(username,username..' was arrested for '..reason..' by '.. tostring(player)..' and sentenced to jail for '..t..' seconds.',ListID)
local feedbackEmbed = discord.RichEmbed.new()
    :setTitle("Arrestee Information")
    :addField("Name:", username)
    :addField("Reason of Arrest:", reason)
    :addField("Time of Sentence:", t)
    :addField("Arresting Officer Information", '')
    :addField("Name:", player)
    :addField("Department:", player.Team)
    :setFooter("Powered by devARREST")
    :setColor(3066993)
    webhook:send(feedbackEmbed, {username = "Lucerne Arrest Log"})
end)

It never goes to the discord and has no errors but if I change the script to be like this it sends it, please help if you know anything about the NitroDiscordAPI

events.LogArrest.OnServerEvent:Connect(function(player, t, reason, username)
    ap:AddCard(username,username..' was arrested for '..reason..' by '.. tostring(player)..' and sentenced to jail for '..t..' seconds.',ListID)
local feedbackEmbed = discord.RichEmbed.new()
    :setTitle("Arrestee Information")
    :addField("Name:", 'Test' -- Changed part)
    :addField("Reason of Arrest:", 'Test'-- Changed part)
    :addField("Time of Sentence:", 'Test'-- Changed part)
    :addField("Arresting Officer Information", '')
    :addField("Name:", 'Test'-- Changed part)
    :addField("Department:", 'Test'-- Changed part)
    :setFooter("Powered by devARREST")
    :setColor(3066993)
    webhook:send(feedbackEmbed, {username = "Lucerne Arrest Log"})
end)

addField Info that is inside the NitroDiscordAPI Module Script

function RichEmbed:addField(name, value, inline)
    if name == nil or value == nil then error("You can't add a field with an empty name or value.") end
    if inline == nil then inline = false end
    self.fields[#self.fields + 1] = {
        ["name"] = name,
        ["value"] = value,
        ["inline"] = inline
    }
    return self
end

setTitle Info that is inside the NitroDiscordAPI Module Script

function RichEmbed:setTitle(title)
    if title == nil then error("You must specify the title.") end
    self.title = title
    return self
end

If you need anymore information from any of the other script please let me know!

0
Could you show the full script? I don't know where you're getting your Discord API module from. joritochip 705 — 5y
0
Fixed it DeveloperAtWork 14 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

ANSWERED

Ad

Answer this question