-
-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add commands for Roblox Ban API #327
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
return { | ||
Name = "ban"; | ||
Description = "Bans a player or set of players."; | ||
Group = "DefaultAdmin"; | ||
Args = { | ||
{ | ||
Type = "playerIds"; | ||
Name = "players"; | ||
Description = "The players to ban."; | ||
}, | ||
{ | ||
Type = "duration"; | ||
Name = "duration"; | ||
Description = "How long the ban should last. A negative value means a permanent ban."; | ||
}, | ||
{ | ||
Type = "string"; | ||
Name = "reason"; | ||
Description = "The reason for the ban. This is shown to the player(s) and saved in history."; | ||
}, | ||
}; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
local Players = game:GetService("Players") | ||
|
||
return function (_, players, duration, reason) | ||
if duration <= 0 then | ||
duration = -1 | ||
end | ||
|
||
Players:BanAsync({ | ||
UserIds = players, | ||
Duration = duration, | ||
DisplayReason = reason, | ||
PrivateReason = reason, | ||
ExcludeAltAccounts = true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should ExcludeAltAccounts be set to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for noticing this. I originally assumed that enabling that option would also ban alternative accounts, not keep them unbanned. I'll correct this now. |
||
ApplyToUniverse = true, | ||
}) | ||
|
||
return ("Banned %d players."):format(#players) | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
return { | ||
Name = "unban"; | ||
Description = "Unbans a player or set of players."; | ||
Group = "DefaultAdmin"; | ||
Args = { | ||
{ | ||
Type = "playerIds"; | ||
Name = "players"; | ||
Description = "The players to unban."; | ||
}, | ||
}; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
local Players = game:GetService("Players") | ||
|
||
return function (_, players) | ||
Players:UnbanAsync({ | ||
UserIds = players, | ||
ApplyToUniverse = true, | ||
}) | ||
|
||
return ("Unbanned %d players."):format(#players) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there should be a more explicit way to specify permanence; negative durations in general seem quite silly. In my game, we do this through the absence of a duration, but that can be confusing to people new to Cmdr.
tempban
andpermban
commands?!
means permanent. (In practice, this could be something likeduration ! string
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with this. I believe we could just keep the existing command and use a prefixed union type. Though, with a type of
"duration ! string"
and a value of just!
, the type validator for primitive strings would flag it, as it's considered a nil value.Maybe this could be resolved by requiring the user to use
!permanent
as the value?