Creating a decent topic. - SirMangler/PrimeHackBot GitHub Wiki
This is a Guide on how to create Topics.
Step 1 - Adding your topic.
Add your topic. The topic name will be the same as the command used to trigger it. Example:
!addtopic piracy
This can now be triggered by typing !piracy
.
Step 2 - Setting a response/answer.
Setting the topic response/answer. This 'answer' will be given when the topic is triggered. Example:
!setanswer piracy Piracy is not very nice.
This will accept newlines (you can enter them in discord with Shift+Enter
)
(Optional) Step 3 - Auto detection/patterns.
Adding a pattern. This pattern is written in Regex. The bot will check incoming messages with this pattern, and if they are matched it shall give a response. I recommend using https://regexr.com/ to test your pattern. Example:
!addpattern piracy (how\s|where\s|can\s)(can\s)?(i\s|you\s)(download\s|install\s|get|\s)(the\s|a\s)?(iso|game|rom)
Now when somebody types "where can you download the rom", the piracy message will be triggered!
(Optional) Step 4 - Restricting pattern detection to certain channels
This is incredibly useful when your regex pattern is too broad for an entire server and might have false-positives. For instance having a topic on 'where to download the game' misfiring in a general gaming channel. Example:
!addChannel piracy 521711544925552642
(Optional) Step 5 - Aliases
Aliases are good when topics cover multiple points, or need a shorter and quicker name.
Example for topic settings
:
!setaliases settings s options
(Optional) Step 6 - Adding an image.
You can also make it embed an image in your topic. Be sure to scale the image appropriately. Example:
!setImage piracy https://en.wikipedia.org/wiki/Piracy#/media/File:British_sailors_boarding_an_Algerine_pirate_ship.jpg