-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5fbffe1
commit e508ace
Showing
7 changed files
with
216 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# CommandClass | ||
|
||
**Noir.Classes.CommandClass**: `NoirClass` | ||
|
||
Represents a command. | ||
|
||
*** | ||
|
||
```lua | ||
Noir.Classes.CommandClass:Init(name, aliases, requiredPermissions, requiresAuth, requiresAdmin, capsSensitive, description) | ||
``` | ||
|
||
Initializes command class objects. | ||
|
||
#### Parameters | ||
|
||
* `name`: string | ||
* `aliases`: table\<integer, string> | ||
* `requiredPermissions`: table\<integer, string> | ||
* `requiresAuth`: boolean | ||
* `requiresAdmin`: boolean | ||
* `capsSensitive`: boolean | ||
* `description`: string | ||
|
||
*** | ||
|
||
```lua | ||
Noir.Classes.CommandClass:_Use(player, message, args) | ||
``` | ||
|
||
Trigger this command. | ||
|
||
Used internally. Do not use in your code. | ||
|
||
#### Parameters | ||
|
||
* `player`: NoirPlayer | ||
* `message`: string | ||
* `args`: table | ||
|
||
*** | ||
|
||
```lua | ||
Noir.Classes.CommandClass:_Matches(query) | ||
``` | ||
|
||
Returns whether or not the string matches this command. | ||
|
||
Used internally. Do not use in your code. | ||
|
||
#### Parameters | ||
|
||
* `query`: string | ||
|
||
#### Returns | ||
|
||
* `boolean` | ||
|
||
*** | ||
|
||
```lua | ||
Noir.Classes.CommandClass:CanUse(player) | ||
``` | ||
|
||
Returns whether or not the player can use this command. | ||
|
||
#### Parameters | ||
|
||
* `player`: NoirPlayer | ||
|
||
#### Returns | ||
|
||
* `boolean` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
docs/api-reference/noir/built-ins/services/commandservice.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# CommandService | ||
|
||
**Noir.Services.CommandService**: `NoirService` | ||
|
||
A service for easily creating commands with support for command aliases, permissions, etc. | ||
|
||
*** | ||
|
||
```lua | ||
Noir.Services.CommandService:FindCommand(query) | ||
``` | ||
|
||
Get a command by the name or alias. | ||
|
||
#### Parameters | ||
|
||
* `query`: string | ||
|
||
#### Returns | ||
|
||
* `NoirCommand|nil` | ||
|
||
*** | ||
|
||
```lua | ||
Noir.Services.CommandService:CreateCommand(name, aliases, requiredPermissions, requiresAuth, requiresAdmin, capsSensitive, description, callback) | ||
``` | ||
|
||
Create a new command. | ||
|
||
#### Parameters | ||
|
||
* `name`: string - The name of the command (eg: if you provided "help", the player would need to type "?help" in chat) | ||
* `aliases`: table\<integer, string> - The aliases of the command | ||
* `requiredPermissions`: table\<integer, string>|nil - The required permissions for this command | ||
* `requiresAuth`: boolean|nil - Whether or not this command requires auth | ||
* `requiresAdmin`: boolean|nil - Whether or not this command requires admin | ||
* `capsSensitive`: boolean|nil - Whether or not this command is case-sensitive | ||
* `description`: string|nil - The description of this command | ||
* `callback`: fun(player: - NoirPlayer, message: string, args: table\<integer, string>, hasPermission: boolean) | ||
|
||
#### Returns | ||
|
||
* `NoirCommand` | ||
|
||
*** | ||
|
||
```lua | ||
Noir.Services.CommandService:GetCommand(name) | ||
``` | ||
|
||
Get a command by the name. | ||
|
||
#### Parameters | ||
|
||
* `name`: string | ||
|
||
#### Returns | ||
|
||
* `NoirCommand|nil` | ||
|
||
*** | ||
|
||
```lua | ||
Noir.Services.CommandService:RemoveCommand(name) | ||
``` | ||
|
||
Remove a command. | ||
|
||
#### Parameters | ||
|
||
* `name`: string | ||
|
||
*** | ||
|
||
```lua | ||
Noir.Services.CommandService:GetCommands() | ||
``` | ||
|
||
Returns all commands. | ||
|
||
#### Returns | ||
|
||
* `table<string, NoirCommand>` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters