Git Product home page Git Product logo

Comments (5)

robsdedude avatar robsdedude commented on June 8, 2024

The first task of randomly picking an answer can be realized with using (readfilerandom …) and having a text file with all possible answers.

The second one isn't as trivial. But could probably be solved with regexps indeed.

from phantombot.

robsdedude avatar robsdedude commented on June 8, 2024

^((?!@\w+).)*your keyword((?!@\w+).)*$ here is a draft for ignoring messages with mentions. Considerations: 1) it might fail if there are user accounts with any other symbols but a-z, A-Z, _, or -. 2) If you have characters in your keyword that have a meaning in regexps, you need to escape them.

I recommend regex101.com for developing, analyzing, and testing of regexps.

from phantombot.

taradinoc avatar taradinoc commented on June 8, 2024

The first task of randomly picking an answer can be realized with using (readfilerandom …) and having a text file with all possible answers.

It'd be nice if there were an easy way for mods to set up commands like this, without access to the bot's filesystem.

from phantombot.

robsdedude avatar robsdedude commented on June 8, 2024

I agree. I see two ways:

  • Try to work around with a command using (writefile …)
  • In the long run it would be nice to have a command variable like (eval …) that actually executes javascript. I've talked about this with some people on Discord and I'm not sure a PR like that would be accepted. Besides the fact that it could be a pain to implement without opening a bunch of security holes.

from phantombot.

taradinoc avatar taradinoc commented on June 8, 2024

Other possibilities:

  • Add a tag handler to pick from a set of strings, and include all the options as part of the command response:
!addcom !hackername Your hacker name is (pickrandom Trinity|Darkweb|Neo) (pickrandom Bladerunner|Gattaca|Anonymous)
  • Add an editable "quip system", with commands to create/delete named sets of quips or add/remove/edit individual quips in a set, and a tag handler to pick quips from a set:
!addquipset hackerfirst Trinity|Darkweb|Neo
!addquipset hackerlast Bladerunner|Gattaca
!addquip hackerlast Anonymous

!addcom !hackername Your hacker name is (randomquip hackerfirst) (randomquip hackerlast).

from phantombot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.