Functions was the first step to a completely dynamic storage system in attempts to simplify bigger A.R.S Rules with specific changes.
Local functions can be created on your server to help minify long A.R.S Rules that you use repeatedly with small changes..define func HelloUser():Hello {/user}!!
.auto .hello={init}
call::HelloUser();
Now when you type .hello you will get your pre-defined function's response.
.define func HelloUser(ChannelID, Message):{redirect:{0}}{1}
Alright now before we teach you how to use this function in your A.R.S Rules let's explain..
What we're doing here is creating a function with Two parameters. And than defining those parameters
using the {0}
for ChannelID and {1}
for Message.
{0}=Param1, {1}=Params2, {2}=Params3, {3}=Params4
.auto &.hello {params}={init}
call::HelloUser({params}, This message is pre-defined);
.hello CHANNELID-HERE
the predfined message will be sent to the channel id they type..auto &.hello {params}={init}
call::HelloUser(1268555466456789, {params});
.hello What is up guys!
Their message will be redirected to the channel: 1268555466456789
And since the {redirect} key requires the channel id. We need to make sure to place the channel ID not the name.
.delfunc HelloUser
Pretty easy right? Now the HelloUser function is no longer available to use..deflist
.wipedefs
system/messages
package which is available to everyone.
{
"Defines": [
{
"Name": "UserMessageSend",
"Params": [
"UserID",
"Message"
],
"Content": "{pm:{0}}{1}"
}
}
}
Alright now what you're looking at above is a function to send a custom user a custom message.
Make sure you have read up on the Github Main README.md if you don't understand the {0},{1}
{
"Defines": [
{
"Name": "UserMessageSend",
"Params": [
"UserID",
"Message"
],
"Content": "{pm:{0}}{1}"
},
{
"Name": "ActiveMessageSend",
"Params": [
"Message"
],
"Content": "{pm}{0}"
}
}
Now your package will include the UserMessageSend & ActiveMessageSend. What's the difference?
UserMessageSend will direct message a defined user. or you can set it up to pm multiple.
ActiveMessageSend will message the user who triggers the function. Or whoever is mentioned in the trigger.
proxikal/EchoRepository/packagename
.auto &.giveme {params}={init}
import "githubaccount/reponame/packagefile"
call::GiveMeRole(Admin, {params});
Ok now we are using the GiveMeRole example in the Secure Commands Example.