i am making an admin system. and whenever someone kicks or bans a player i either want to create a new thread with the title of the user
or post a message inside an existing thread.
creating a new thread with webhooks is easy.
but how do i figure out if a thread with a name already exist.
and if it does. post inside of it
added my code so you cna see how far i got.
i isolated this part of code from the rest and made it stand alone.
if this part works ill move on to the next
--[[
+------------------+-------------------------------------------------------------------------------+
| tag | item |
+------------------+-------------------------------------------------------------------------------+
| content | the message contents (up to 2000 characters) |
| username | override the default username of the webhook |
| avatar_url | override the default avatar of the webhook |
| tts | true if this is a TTS message |
| embeds | embedded rich content |
| allowed_mentions | allowed mentions for the message |
| components * | the components to include with the message |
| files[n] ** | the contents of the file being sent |
| payload_json ** | JSON encoded body of non-file params |
| attachments ** | attachment objects with filename and description |
| flags | message flags combined as a bitfield (only SUPPRESS_EMBEDS can be set) |
| thread_name | name of thread to create (requires the webhook channel to be a forum channel) |
+------------------+-------------------------------------------------------------------------------+
]]
return function (player,msg,otherplayer)
if not otherplayer then
if player ~= "Server" then
local Data = {
["username"] = "["..string.format("%0.3i",player:GetRankInGroup(game.CreatorId)).."]".."["..player.UserId.."]"..player.Name;
["content"] = msg;
}
Data=HttpService:JSONEncode(Data)
local response = HttpService:PostAsync(discordUrl,Data)
end
else
if player ~= "Server" then
local Data = {
["username"] = "["..string.format("%0.3i",player:GetRankInGroup(game.CreatorId)).."]".."["..player.UserId.."]"..player.Name;
["content"] = msg;
["thread_name"] = otherplayer.UserId
}
Data=HttpService:JSONEncode(Data)
local response = HttpService:PostAsync(ForumdiscordUrl,Data)
end
end
end