As a Roblox developer, it is currently too hard to retrieve the current ban status of a user using the new ban API.
Currently, you have to do this in order to get the ban status of a player:
local banStatus = Players:GetBanHistoryAsync(123456789):GetCurrentPage()[1]
While this works and can be done on a single line, it’s a bit confusing looking at it, no? I suppose I understand why the BanHistoryPages object was created, but calling a method that returns a table with just one element and having to index the first element of that table in order to get the ban action dictionary is a bit odd.
It would be nice if we could do something like this:
local banStatus = Players:GetBanStatusAsync(123456789)
Where a method returns a dictionary representing the most recent ban action taken on this user.
Use cases:
- Let’s say a moderator is trying to unban someone, but we only want moderators to be able to remove temporary bans, and need to do a quick check on the Duration field of their most recent ban action dictionary.
- Let’s also say a moderator is trying to temporarily ban someone but we do not want them to be able to overwrite any permanent bans. A simple check for their ban duration would also be nice in this scenario.
I’m not entirely sure whether a method like this would be more performant for use cases like these, but my main reason for requesting this is that it’d improve readability in my code if I’m just trying to get the ban status of a player, and am not interested in the entire ban history of the player.