Family sharing ban/sourcebans callback's question

So I tried getting help for this on ulyssesmod but the developer’s corner there is a bit dead, slightly.

Anyway, I’m using lexi’s sourcebans module for garry’s mod. It works just fine. I would like to integrate family sharing detection as people can easily avoid steamID bans via family sharing. Here is where I grabbed the code from:

The code works 100% for ULX bans, but we’re using a mysql connection here with sourcebans. Fortunately, lexi’s module has a built in function called CheckForBan. It’s at about line 691 here:

Here is how far I’ve gotten with changing it to a ban with sourcebans.

local APIKey = "stuff"

local function HandleSharedPlayer(ply, lenderSteamID)
    print(string.format("FamilySharing: %s | %s has been lent Garry's Mod by %s",
    if sourcebans.CheckForBan(lenderSteamID, callback) then
		RunConsoleCommand("ulx","sbanid",ply:SteamID(),0,"Sharing account with banned SteamID: "..lenderSteamID)

local function CheckFamilySharing(ply)
            body = util.JSONToTable(body)
            if not body or not body.response or not body.response.lender_steamid then
                error(string.format("FamilySharing: Invalid Steam API response for %s | %s
", ply:Nick(), ply:SteamID()))
            local lender = body.response.lender_steamid
            if lender ~= "0" then
                HandleSharedPlayer(ply, util.SteamIDFrom64(lender))
            error(string.format("FamilySharing: Failed API call for %s | %s (Error: %s)
", ply:Nick(), ply:SteamID(), code))
hook.Add("PlayerAuthed", "CheckFamilySharing", CheckFamilySharing)

That’s set to ban by sbanid, because I use ULX integration for sourcebans. I figured just running the console command sbanid would be simpler.
As for the callback, what do I need to set there? Just checking “if sourcebans.CheckForBan(lenderSteamID) then” doesn’t work and errors with callback missing, so what would I put here?

Hopefully someone has an answer to this, thanks in advance.

CheckForBan takes in a function as its second argument for the callback. The callback is called with one argument: a boolean indicating whether the user was banned or not. If the person lending out the game is not banned, we don’t do anything. If they are banned, we then check the connecting account to make sure that they’re not already banned before banning them to avoid duplicates.

local steamid = ply:SteamID()  -- Save this in case we lose the player object between the two callbacks

sourcebans.CheckForBan(lenderSteamID, function(banned)
	if not banned then return end  -- The sharer is not banned, no need to do anything else.
	sourcebans.CheckForBan(steamid, function(banned)
		if banned then return end  -- The person receiving the shared game is already banned, don't ban then again
		RunConsoleCommand("ulx", "sbanid", ply:SteamID(), 0, "Sharing account with banned SteamID: "..lenderSteamID)

Worked great! Thanks a ton!