Trello Blacklist Script Not Working

Script not working it says there is an error on line 7 stating “unauthorized” the script is below. Also, how would I instead of banning from the username, ban from the userid?

trelloID = "6jSjNxP1"
listname = "Blacklists"


HttpServ = game:service('HttpService')
GAsync = HttpServ:GetAsync('https://api.trello.com/1/boards/'.. trelloID ..'/lists',true)
Info = HttpServ:JSONDecode(GAsync)
Blacklist = {}

function UpdateTrello()
	Blacklist = {}
	for i,v in pairs(Info) do
		if v.name:find(listname) then
			local GetTable = HttpServ:GetAsync('https://api.trello.com/1/lists/'..v.id..'/cards',true)
			local Table = HttpServ:JSONDecode(GetTable)
			for j,b in pairs (Table) do
				table.insert(Blacklist,{name=b.name, reason=b.description})
			end
		end
	end
	for i,j in pairs (game.Players:GetChildren()) do
		for i,r in pairs (Blacklist) do
			if j.Name:lower() == r.name:lower() then
				j:Kick(r.reason)
			end
		end
	end
end

game.Players.PlayerAdded:connect(function(Player)
	for i,v in pairs (Blacklist) do
		if Player.Name:lower() == v.name:lower() then
			Player:Kick(v.reason)
		end
	end
end)

UpdateTrello() while wait(100) do UpdateTrello() end

banning can me done much efficiently by using datastores and saving their userid in a table. When the player joins you can get the data from datastore and check if the player’s userid is in the table. If found then kick the player. Here are a few useful resources to learn:

2 Likes

That isn’t useful to me as that is outside my skill level.

There’s already a Trello API, it’s very useful, Roblox-trello | Object Oriented Trello API

1 Like

Looked into this, and you seem to have done this incorrectly.
https://developer.atlassian.com/cloud/trello/rest/api-group-lists/#api-lists-id-cards-get

local HS = game:GetService("HttpService")
Request = HS:GetAsync("https://api.trello.com/1/lists/{listId}/cards?key={Key}&token={Token}")
local Parse = HS:JSONDecode(Request)

This is what I did. I wasn’t able to find the listId, by doing regular methods, so get a card Id, (entering a card and copying URL), then input it into this.

local HS = game:GetService("HttpService")

Request = HS:GetAsync(https://api.trello.com/1/cards/[card id]?attachments=false&attachment_fields=all&checklists=none&checklist_fields=all&sticker_fields=all&key=[“key-insert your key here”]&token=[“token-insert your token here”])

I was then able to track cards using the part of the API that I linked above. It returns a table of numbers, each representing a card, with children, too many to state, but here you go for reference. I just tried to cram this into my head 1 hour ago, so please do more research then me.
image

1 Like

Adding on: This works for me now.

local HS = game:GetService("HttpService")
local BannedPlayers = {}
Request = HS:GetAsync("https://api.trello.com/1/lists/[ListId]/cards?key=[Key]&token=[Token]")
local Parse = HS:JSONDecode(Request)

print(Parse)
for i,v in pairs(Parse) do
	print(v)
	table.insert(BannedPlayers, 1, v.name)
end

game.Players.PlayerAdded:Connect(function(plr)
	print(plr.Name)
	for i,v in pairs(BannedPlayers) do
		print(v)
		if string.lower(plr.Name) == string.lower(v) then
			plr:Kick()
		end
	end
end)

Glad you got it working.

Just wanted to add, I highly recommend using a DataStore for the ban list, like @TheBrainy06 suggested. It’s actually very easy- at least, easier than using HttpSevice and Trello for the same job. In fact it’s so easy, that I guarantee you’ll develop a strong understanding of how DataStores work just by following that hyperlinked tutorial.

Useful information, for sure!

The only exception would be if you were trying to make a ban list accessible across multiple different games, where DataStores were not mutual. Then I can appreciate the Trello approach.

2 Likes

I did this and in turn, It comes to an error: Screen Shot 2021-06-15 at 10.31.25 AM

As I’m trying to make it for multiple different games across my group, this approach would be unnesesary.

Ensure that you have a correct ID of the list, key, and token. The issue is upon for one of them, as it errors with InvalidUrl, defining that the request for the API failed.

1 Like