beginner ii: using simple functions
let's learn how functions work in mimu's autoresponders so we can make commands that do actions!
Last updated
let's learn how functions work in mimu's autoresponders so we can make commands that do actions!
Last updated
a function is something that manipulates, or does an action.
these variables allow your autoresponders to have more than just a static response/reply.
let's try out a simple autoresponder that gives the user 10 currency with a cooldown of 1 minute.
/autoresponder add trigger:give me 10 reply:{modifybal:+10} {cooldown:60} okay, i've given you 10 {server_currency}, you have {user_balance} now!
in this above autoresponder, {modifybal:}
takes an amount, and modifies the user's balance by +10
.
the {cooldown:}
function accepts a number in seconds as the cooldown.
finally, we have a simple response and placeholder as the response.
it is good practice / habit for you to run functions before the response. this is because in order for some placeholders to be updated, you have to use the function early on. here's an example:
/autoresponder add trigger: mimu give me money! reply: your old balance: {user_balance} {server_currency} {modifybal:1000}
your new balance: {user_balance} {server_currency}
in this scenario, it will provide the old balance, then show the new balance after the balance has been modified.
in addition, in the future, when using chooses, ranges, you will find you have to use the functions before the placeholder, to define the choice / range, etc.
if you did it right, you should now have something like below!
let's try out another example! this time, we want to make mimu give us a role and respond in a colored embed when the user types +admirer
.
/autoresponder add trigger:+admirer reply:{embed:#ec948a}{addrole: @mimu admirer} hi cutie! i've given you the @mimu admirer role !
in the above response, {embed:}
accepts either no input, a color (we put in #ec948a
), or a premade embed. since we put in an embed with a specified color, the text hi cutie! i've given you the @mimu admirer role
will be embedded
{addrole:}
accepts an input of a role for you to add to the user. in this case, we're adding the "mimu admirer" role! this input also accepts role IDs as well c:
the remaining text is the textual response.
finally, let's try another example! let's make a mod only command that pings the @chat revive role with a cooldown of 5 minutes.
using cooldowns in your ARs? please note they will show up in the user's/cooldowns
!
/autoresponder add trigger:.chatrevive reply:{requirerole: @𐐚 ┇ moddies}{cooldown:300} @chat revive
the {requirerole:}
function allows you to limit it to people with the inputted role. if they don't have the role, the autoresponder will respond with the below error.
you can then create a cooldown with the {cooldown:}
function. we put 300 because 300 seconds = 5 minutes.
there are A LOT of functions for different purposes, from embedding, to redirecting to channels. check out our variable functions list for a full list!