Ciastuuś
Truck soon...
Wiek: 26 Na forum: 3071 dni Posty: 799
Nick w MP: Ciastuuś
Piwa : 4297
c-side:
Kod:
getTableDiscord = {
discordTable = {
["colorEmbed"] = **,
["botImage"] = **,
["botName"] = **,
["staffName"] = **,
["titleType"] = **,
["titleDate"] = **,
["iconType"] = **,
["staffImage"]= **,
["logoImage"] = **,
},
urlTable = {
["discordHook"] = **,
},
}
s-side:
Kod: function messageToDiscord(mess, nick, player)
local cdate, ctime = getCurrentDateTime()
local data = {
content = "",
username = getTableDiscord.discordTable["botName"],
avatar_url = getTableDiscord.discordTable["botImage"],
embeds = {
{
color = getTableDiscord.discordTable["colorEmbed"],
description = mess,
footer = {
text = "Data: ".. cdate .. " | Czas: " .. ctime .."",
icon_url = getTableDiscord.discordTable["iconType"],
},
author = {
name = ""..nick.."",
icon_url = getTableDiscord.discordTable["staffImage"],
},
thumbnail = {
url = **,
},
}
}
}
local jsonData = toJSON(data)
jsonData = string.sub(jsonData, 3, #jsonData - 2)
local sendOptions = {
headers = {
["Content-Type"] = "application/json"
},
postData = jsonData,
}
fetchRemote(getTableDiscord.urlTable["discordHook"], sendOptions, WebhookCallback)
end
function WebhookCallback()
end
function getCurrentDateTime()
local time = getRealTime()
local year = time.year + 1900
local month = time.month + 1
local day = time.monthday
local hour = time.hour
local minute = time.minute
local second = time.second
local formattedDate = string.format("%02d.%02d.%04d", day, month, year)
local formattedTime = string.format("%02d:%02d:%02d", hour, minute, second)
return formattedDate, formattedTime
end
** uzupe?nij sam
Dopisz sobie sam w jaki spos?b ma by? pobierane zab?jstwo gracza. W razie problemu pisz pod tym postem.