Skip to content

Commit 06bcb1e

Browse files
committed
Merge branch 'main' of https://github.com/raspdevpy/ccdoc into main
2 parents 467958e + 44b7d40 commit 06bcb1e

4 files changed

Lines changed: 13 additions & 15 deletions

File tree

guide/Guide/7.array.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ $arrayPush[Cat]
6464
$arrayPush[Mouse]
6565
$arrayPush[Elephant]
6666

67-
// Remove and return the last element
67+
// Return the first and last elements
6868
$arrayGet[1], $arrayGet[4]
6969
```
7070

guide/Message/messagePublish.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# $messagePublish
2-
Publishs message to an annoucemnet channel
2+
Publishes message to an announcement channel
33

44
#### Usage: `$messagePublish or $messagePublish[messageID] or $messagePublish[channelID;messageID]`
55

guide/Trigger/button.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ In regex ^ and $ are used to match the start and end of the string.
4040

4141
### Related Functions
4242
* [$button](../Text/Components/button.md) - sends a button
43-
* [$buttonID](../Text/Components/button.md) - returns the button id
43+
* [$buttonID](../Text/Components/buttonID.md) - returns the button id
4444
* [$buttonEmoji](../Text/Components/buttonEmoji.md) - returns the button emoji
4545
* [$buttonLabel](../Text/Components/buttonLabel.md) - returns the button label
4646
* [$buttonURL](../Text/Components/buttonURL.md) - returns the button url

guide/Trigger/library.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,34 @@
11
# Library
22

33
## Basic Information
4-
Library is one of the unique triggers, that doesn't get triggered by events in your server. It can be included in other commands so you can use the code in it by calling `$includeLibrary[Library name]`
4+
Library is one of the unique triggers, that doesn't get triggered by events in your server. A library can be included (referenced) in other commands so you can use the code in it after calling `$includeLibrary[Library name]`.
55

6-
The goal of this trigger is simply sharing code or functions between custom commands (you will understand in the examples)
6+
The goal of this trigger is simply sharing code, functions or objects across multiple custom commands (see the example below).
77

88
## Syntax
9-
the value of the trigger is the `Library name`
9+
The value of the trigger is the `Library name`.
1010

1111
## Example
1212
### Create your library that contains users' information
13-
> note that the library name is `users`. We will use it in next step.
13+
> Note that the library name is `users`. We will use it in next step.
1414
1515
![](https://i.imgur.com/93WZesG.png)
1616

1717
### Create a normal word command `whois`
18-
First let's include the library, with `$includeLibrary`
19-
after including, we can directly use the object and retrieve some information to display.
18+
First, let's include the library, with `$includeLibrary`.
19+
After including, we can directly use the object defined in the library and retrieve some information to display.
2020

2121
![](https://i.imgur.com/KQbkjrS.png)
2222

2323
### Output
2424
![](https://i.imgur.com/v9DT5xR.png)
2525

2626
## What is the point?
27-
Here we only included this library in 1 commands
28-
what if we have 10 or 50 commands that uses this information, you can easily use it without copying the user information for each command,
29-
besides if you plan to add a new user, with libraries you will only add it to the `users` library
30-
but without libraries, you would have to add the same users 50 times, to every command
27+
In this example the object is only used in a single custom command. But at some point you might want to add another custom command using the same object, e.g. `listusers` sending a message with all users in it. When the object changes, e.g. you want to add another user to it, then you'll have to update the object in all custom commands accordingly. This takes time and there's a chance errors get introduced or one of the custom commands using this object is missed and now uses a different object. With a library you can use the same object across all these commands without having to copy it to each. Updating the object is done in a single place and all custom commands referencing (including) the library `users` will use the updated object at the same time.
3128

32-
That demonstrates Library's usefulness.
29+
In the same way you can also define functions in a library to share code across multiple custom commands.
3330

31+
That demonstrates a library's usefulness.
3432

3533
## Some functions related to Library
36-
[$includeLibrary](../Unclassified/includeLibrary.md): Include your library
34+
[$includeLibrary](../Useful/includeLibrary.md): Include your library

0 commit comments

Comments
 (0)