Skip to content
Joshua Cleland edited this page Jan 7, 2017 · 9 revisions

Information

This is the Wiki about building a custom Package.
We will need to follow a few steps, and make sure you remember. Security!
You don't want to offer someone a module that has {role:} Where it's open to all.
Make sure you add a {req} or {exc} key to any moderation commands!

Table of Contents.

  1. Package Structure
  2. Secure Admin Commands
  3. Importing \ Using Your Package

The purpose of A.R.S Functions

There are a lot of keys out there that can get huge, and people (including myself)
Get tired of having to re-write the same big rule and only make one or two changes to it
For example say you want to have a bunch of secure commands, but all for different channels.

.auto .test={init}
use | 265348251266449409
{if(ischannel):
    This command will work!
} (else) {
    {/user} this command is restricted from this channel.
}

Now, wouldn't you want to make that easier to use? Why copy that 10 times to only change a few things?
Let's look at how Functions can better the way you use A.R.S Now let's say we have a function defined and it's named RestrictCommand
We're going to add 3 Parameters to this function, however you can add more!
We're going to limit 1 Channel in this example, What to do if it's the right channel.
And what to do if it's the wrong channel.

use | 265348251266449409
{if(ischannel):
    This command will work!
} (else) {
    {/user} this command is restricted from this channel.
}

Ok now the example below we are going to Define the package Locally

.define func RestrictCommand(ChannelID, Command, BadResponse):
use | {0}
{if(ischannel):
    {1}
} (else) {
    {2}
}

And you would use the above function in your a.r.s using:

.auto &.joke={init}
call::RestrictCommand(265885246057218048, {joke}, {/user} This isn't the right channel for that.);

When using local functions you don't import anything unless you're using
a function from an external package in your rule.

Defining above function in your package

You can compact the code above so you can easily add it to your package.
As you can with all of our keys.

use | {0}{if(ischannel):{1}} (else) {{2}}