Ridiculously simple auto-chat reply with catch hooks

Discussion in 'Archived: Plugin Requests' started by xeology, Mar 28, 2011.

  1. Offline

    xeology

    Java is not something I know so I am looking for someone to be able to revive this but in a simpler way.

    http://forums.bukkit.org/threads/in...2-its-like-an-irc-bot-for-minecraft-430.3458/

    All I would like to see the new plugin to be able to do is search each chat line for *the catch hook* and reply with a set phrase. I would also love to see it work with the {p} or {player} still.

    Example

    YML Config file:

    bot:
    how do i register:Register on mukkit.


    Chat:


    Person: Hey guys, how do i register, i want to join.
    Bot: Register on mukkit.


    Simple enough right?

    All this basically has to do is get the chat. Load it into a variable and then search the variable for this sentence.


    Why?

    People ask the same question to many times. This would server the purpose of eliminating the need of Mods and Admins to answer the same questions over and over while they are trying to work.

    I am willing to help with the logic half if needed.

    Thanks for your time.
     
  2. Offline

    wjykk

    Indeed, it does seem easy to program, but I already see three quirks with this:
    1. It might get problematic if the person says something that has two entries in the config. Referring to the example, what would happen if you have both "how do I register" and "I want to join" defined? Which one are you going to show, the former, latter, both? Or do you want to set specific priorities?
    2. In order to get a response, the phrase the user enters must be exactly like the one defined. This nullifies the entire purpose of this plugin if said player asks "how does one register?", since it's not in the config.
    3. This program would probably either need to utilize databases or some extreme optimizations. If you have a list of a couple phrases, it's not too bad, but once you have a list of 5000 phrases, it gets really slow.
    So, I think before anyone gets working on this (hell, I could do it if nobody wants to), these issues need to be resolved.
     
  3. Offline

    xeology

    1. Only one and only the FIRST catch should hook into a response per chat msg.
    2. The use of wildcards would settle this. such as "*how*register*" I use this method for my IRC bot that is doing this exact thing right now.
    3. Yes a DB would be nice for this but not for size and optimization but for convenience. But not required, my IRC bot runs fine off of .txt flatfiles.
    4. If someone has 5000 commonly asked questions, or even 500, then the people on their server are stupid and they need to get some moron walls up lol. I currently only use 50 or so.
    The IRC bot is a really crappy and messy way to do it, that's why I am really look for something integratable with bukkit. Another option would be to possibly have the actual processing of sentences on it's own thread to reduce the lag this would generate (if possible).
     
  4. Offline

    feverdream

    This looks interesting.. give it some simple AI, a history queue dedicated to each person so it can complain if the user ass the same thing over and over..
     
  5. I CAN give it a try, this doesn't look too hard - it'd be my first plugin, however I do know Java from other games, etc.

    - Should we just save the player history in the memory, is my only question :)
     
  6. Offline

    xeology

    I think it would be best to search the config.yml for a set "timeout" period. If someone asks a question they have to wait 30 minutes to be able to trigger that question again. If they ask a configurable amount of questions in a row they would have to wait a configurable amount of time before being able to trigger ANY response.

    Also an option to make all responses respond directly to the player in the form of a /msg would also be ideal.

    I have a basic idea I was thinking about for how sentence recognition would work.

    1. Take entire chat line, store it in a variable.
    2. Read each letter of it one char at a time placing it into a variable for storing (for this example, letter.)
    3. If character is a space or punctuation add 1 to a counter (ctr for this example)
    4. Dump each character into an ARRAY (ie array[ctr]=array[ctr]+letter; array[ctr]=array[ctr]+letter)
    5. Terminate with storing a EOF
    6. Do the same process for each catch hook.
    7. Compare EACH part of the array with the first word of ever catch hook array.
    8. If a word matches see if the next word matches (or if it is a wildcard (*) then scan the rest of the array to see if any of the following words match the next word in the catch array)
    9. If it is a full match do the proper checks and then the proper result.
    If any other logic is needed I am here . . . Just thought this might help and encourage as this would be an insanely useful plugin.

    Also has promise for some possible AI integratable features into bukkit later on such as grief pattern recognition and automatic resolutions (even though this is unlikely lol)
     
  7. Hey again. I've fixed the text recognition part pretty much. So I just need to figure how to do the config files properly, but I believe I got that down already. So there shouldn't really be a problem!
    I'm just using regex to catch the words, I believe that works better than splitting each char into an array ;)

    I'll add a timeout to the config file - the reason I came back was because I wanted to know what configuration options you wanted?
    I currently have it set to only IM the player that send the sentence, so that it wont spam everyone just in case. I'm working on the spam blocking - but that'll be after I'm done.

    Do we need any chat commands - permissions/group manager support, etc?
     
  8. Offline

    Eddiekins

    This would work brilliantly if we just made it search for key words, rather than full phrases.
    I love the idea of logging the user's history so they can't spam the system.
    An idea: have the server's responses broadcast to all online players (and maybe even the log files). This would also reduce the amount of questions asked, as if one user asked "What plugins do you use?" the server could reply to all players which would in turn prevent the question being asked by a different player five minutes later.
    Brilliant idea, I'm sorry I don't know Java to be of more help.
     
  9. As it is now, the only person they'd spam would be themselves.
    I didn't set it to actually remove the chat message, but thinking I might want it to do that?
    Though I guess that could go for configurations.
    I need to get the spam prevention to work first though :p

    Released: http://forums.bukkit.org/threads/ch...about-answering-noob-questions-594-602.10509/
     
  10. Offline

    xeology

    A few possibilities if they are possible would be to have an option in the config to,

    • Use herochat channels and post responses to a particular channel but take catches from any channel.
    • Timeouts as you said you managed
    • An option to whisper it or to announce the response would be nice as well
    Thats about it lol.
     
  11. Please just post in the plugin thread :) And thanks.
    Doesn't the timeout work for you?
     
  12. Offline

    xeology

    wait what? Its done?

    Sorry missed that bit . . . :confused:

    You know I also just wanted to say thank you in behalf of all admins. Great job. Definitely beats using a IRC bot lol.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 13, 2016
  13. Yeah :p
    Lol :D
    And yeah, it kinda does XD Though an IRC bot will let you chat with people in the IRC Channel too :D
    Glad you think it's cool :)
     

Share This Page