Is it possible to use JSON or a http protocol to make a TXT file from a string and then send it to Discord?

Hi! I’m trying to send a very large string through my discord server from my game (they’re logs for moderation) and it is over 2000 characters, so the request is rejected. I’m wondering how I could send it in a TXT file for simplicity? I can’t send it in pieces, because if its too long I could get banned. Thanks for answers in advanced!

2 Likes

Upload it to pastebin using their API HttpService:PostAsync. Then send the pastebin link.

2 Likes

Did it work for you? if so please mark it as a solution. :slight_smile:

Discord has blocked Roblox from using their webhook service. You would have to use a proxy such as Hyra if you wanted it to be sent via Discord.

Read the quotes above. The string is over 2K characters a proxy wouldnt work. Also he isnt asking about it not sending he is asking about making it a txt file of some sort

1 Like

Oh my gosh, thanks! I never even thought of that! Sorry for my late response, as I was celebrating my birthday. I’ll try this. This looks promising! Thanks so much!!!

Your welcome, also happy birthday! (Sorry if I am late to say this lol)

Thanks! I’ve looked through multiple resources, and they explained it to an extent. I understand the params, but I’m having trouble actually using it. This is what I’ve got so far:

for _ = 1,5,1 do
		s,e = pcall(function()
			local toEncode = {
				["content"] = str
			}
			local binParams =
				"api_option=show_paste"..
				"&api_dev_key="..urlEncode(module.Settings.PasteBin.Token)..
				"&api_user_name="..urlEncode(module.Settings.PasteBin.User)..
				"&api_user_password="..urlEncode(module.Settings.PasteBin.Pass)..
				"&api_paste_name="..tostring(game.JobId)..
				"&api_paste_private="..tostring(module.Settings.PasteBin.PrivacySetting)
			
			local toSend = http:PostAsync(module.Settings.PasteBin.Target,http:JSONEncode(toEncode))
			local target = module.Settings.Discord.BaseUrl..module.Settings.Discord.ProxyProvider..module.Settings.Discord.Token
			http:PostAsync(target,http:JSONEncode(toSend))
		end)
		if s then break else warn(e) end
	end

How do I finish this script? I’m a bit confused. Thanks!

Ok, so my only problem now is that I can’t get a user key. Everything else works fine. Do you know how to get one, @phyouthcenter1 ? Thanks! Edit: Its all working now, but pastebin has a limit so I need to find an alternative.

Pastebin has a limit. Is there any alternative?

You will always encounter a limit. Try to minimize what you are sending and only send what is really needed.

I have a script for you but I wont release publically dm me please!

I need to send chat logs (for moderation purposes), so there is no way for me to do that. :C

Apologies for my late response! I’ll DM you.