NightDev Community Forums

[SOLVED] Need some help with an 8-Ball-esque command (ping the user and have a default message)

The Pastebin file that the command is using has been edited, apparently. Check it out: https://pastebin.com/raw/WURvJ4MR

Follow Dimentive’s instructions on creating a new Pastebin file:

When you’re done, copy your new Pastebin file URL. Then set up the !8ball command with this response:

@$(user) $(eval a=$(urlfetch json https://pastebin.com/raw/XXXXXXXX).split(`;`);decodeURIComponent(`$(querystring)`)?a[Math.floor(Math.random()*a.length)]:`Please ask a question: !ask *question*`)

Replace the URL https://pastebin.com/raw/XXXXXXXX with your raw Pastebin file link.

its MrBored theres a 9 reply max i guess. Do you know how to make more responses.

Just add more lines to the file; make sure each line (except the last line) has a semicolon at the end.

It wouldn’t be possible to make the syntax even shorter so you can add it as a mod, would it? Or would you have to get rid of the no-query response?

It wouldn’t be possible to make the syntax even shorter so you can add it as a mod, would it? Or would you have to get rid of the no-query response?

One way to shorten the syntax for adding commands is, I use an alias of !addcom instead of !addcom itself. I’ve set up a command !ac that does the same thing:

!addcom !ac -a=!addcom -cd=5 $(query)

Now just shorten the no query response such that the whole message, including !ac and the command name, is 200 or less characters. I’ve shortened it to “Usage: !8ball [question]”:

!ac !8ball @$(user) $(eval a=$(urlfetch json https://pastebin.com/raw/XXXXXXXX).split(`;`);decodeURIComponent(`$(querystring)`)?a[Math.floor(Math.random()*a.length)]:`Usage: !8ball [question]`)
1 Like

Thank you so much!

I’ve one more question: I’m trying to make another command similar to this 8ball command, but I don’t want this one to have a special response if there’s no query.

Do you know how I’d go about that? I’ve tried several different things but to no avail.

Use a single space for the no query response.

Thank you so much!

By the way, I don’t want to keep bothering you with all these questions, but do you know how I’d go about making a command that, in its response, says “they” by default, “he” if the query is either “he” or “male,” and “she” if the query is either “she” or “female”? While I’m aware of arguments, I’m not sure how to do something like this.

Thank you again for all the help! I can’t stress enough how much I appreciate all this.

(Perhaps I should have created a new thread for this question.)

This code will return the pronoun corresponding to the user query, ie “she” for she/female and “he” for he/male, defaulting to “they” for all other cases.

$(eval a={"he":"he","male":"he","she":"she","female":"she"};a[decodeURIComponent(`$(querystring)`).toLowerCase()]||`they`)
1 Like

I’d like to add a different command that gives you a random response from a list and doesn’t require a query.

I tried this:

!addcom -cd=5 !example @$(user), $(eval a=$(urlfetch json https://pastebin.com/raw/WURvJ4MR).split(`;`);decodeURIComponent(`$(querystring)`)?a[Math.floor(Math.random()*a.length)]:` `)

However, it doesn’t work without a query. I tried other things but to no avail. Do you know how I could accomplish this? Thanks again for all the help you’ve given me!

!addcom -cd=5 !example @$(user), $(eval a=$(urlfetch json https://pastebin.com/raw/WURvJ4MR).split(`;`);a[Math.floor(Math.random()*a.length)])
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.