Create a command to Post a Link to an article

PhantomBot Version: 3.0.0
OS Version: Windows 10
Java Version:
Browser and Version (for Panel Support): Firefox 66
Stock PhantomBot: Yes


i want the bot to do something:

when i write “!wiki Rhino Prime” it should post a link to Rhino Prime | WARFRAME Wiki | FANDOM powered by Wikia
or “!wiki Condition Overload” should result in Condition Overload | WARFRAME Wiki | FANDOM powered by Wikia"

The Bot should be able to post any Link from the wiki i want to. How can i achieve this?


Custom commands aren’t really designed to take parameters.

That said, two ways I suppose I could see this. You could have a custom script that parses parameters to determine what page to go to. You could possibly use keywords as well.

I put that into chat, this is my Console:

[04-08-2019 @ 08:59:21.952 MDT] illusionaryone: !wiki rhino prime
[04-08-2019 @ 08:59:21.961 MDT] [MUTED] Something something link to some other web page.

There are hundreds of articles i want/have to link. So i have to create hundreds of keywords. Thats not very comfortable.
Sadly, i also can’t script myself.

Try this:

!addcom wiki (customapijson$1&limit=1&minArticleQuality=0 {Wiki for } items.0.title {: } items.0.url)

As far as I know, unfortunately (customapijson) works only for a single word as a search query. You need to use + between the words to get proper result. Maybe devs will fix this in the future. I’m not really sure if this is a bot problem at all.

User: !wiki rhino
Bot: Wiki for Rhino:
User: !wiki rhino prime
Bot: Wiki for Rhino:
User: !wiki rhino+prime
Bot: Wiki for Rhino:

To fine-tune the query, you can add/change some parameters, see here: Wikia API V1 documentation

Thnx @Dakoda for the assistance.

Wow thanks! It’s working. I guess i can live with the “+” between the words and hope the devs can change it, so that i can use it without the “+” in the future.

The tag is meant to be as generic as possible and not handle specific APIs. The trouble comes in where someone may want to group together items and link those parameters together anywhere in the command line. As the documentation for customapijson says, it is made for very simple use cases, otherwise a script is required.

That said, we more than likely will not look at trying to handle edge cases with customapijson. If you delete that command and add this script to scripts/custom:

[04-10-2019 @ 21:49:07.865 MDT] [MUTED] usage: !wiki [search term]
wiki rhino prime
[04-10-2019 @ 21:49:11.734 MDT] [MUTED] Wiki for rhino prime:
wiki alpha beta gamma
[04-10-2019 @ 21:49:45.455 MDT] [MUTED] Wiki for alpha beta gamma:
wiki prime
[04-10-2019 @ 21:55:38.338 MDT] [MUTED] Wiki for prime:
wiki asdasdf
[04-10-2019 @ 21:58:40.827 MDT] [MUTED] Nothing found for asdasdf

Note that you will have to reboot PhantomBot after dropping in the script. Make sure you delete the custom command first.

Holy Moly!
Thank you very much for this script!

1 Like

Welcome. I misunderstood the original request - I thought you wanted fixed “commands” to fixed URLs. The clarifying points helped a lot. Hopefully this fits the need. It does what Dokada and BantomPhot did with the (customapijson) essentially, it just calls the lower-level stuff directly and checks to make sure something comes back, and if not, at least tosses a message at the user.


PS - I put it into custom so that when you upgrade the bot, you just need to remember to copy the scripts/custom directory over to the new bot. Cheers again.

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