Coder Social home page Coder Social logo

javabot's Introduction

testing fix me

SCP-ZH-9288-EX

github stats

Top Langs

javabot's People

Contributors

geisterfurz007 avatar jenna1337 avatar justin42 avatar mangstadt avatar ravirupareliya avatar unihedro avatar vogel612 avatar waffle-iron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

javabot's Issues

Allow Site-Configuration using the bot.properties

Currently the only way to change the chatserver is getting your hands dirty and editing the code available in the main-method.

This shouldn't be so hard and static. The used Domain should be configurable using the properties file (and have a reasonable default)

Extract config from Class into configuration file

Currently we are all ignoring the BotConfig.java. That locks down the class into a specific position and adds needless hindrances for moving it around.

It would be beneficial to allow parsing the bot configurations from a config-file on startup and then just keep them in memory. The configuration should be plain-text and at least be explained in the ABOUT (possibly including example configuration)

Tell Command

Allow users to use the bot to invoke commands for other users or just notify them.

Syntax:

!!tell [username] [command invocation / plaintext]

Sending messages with the mechanize approach fails

Mechanize doesn't let us send messages yet. It seems that the Login to chat isn't succesfully mimicked yet, as the response is: "you must login to send messages"

A login to the SE-OpenId has been confirmed by checking the result page after login for the class "profile-me", that's given to the topbar overview of logged in account

Branch "development" uses HTMLUnit over Mechanize

In commit aa81230 I've went through and cherry-picked partial of each commit starting from fd0ed87, and the branch "development" has been created - Please push development in features to that branch instead, as it is the only version which I can get working, namely HTMLUnit which behaves.

This fixes #7 and is a temporary solution. The target is to get Mechanize to work properly, then both tickets can be marked as resolved.

However, until Mechanize finally behaves this will be put on hold until progression can resume. Maybe @Vogel612 would be able to make progress over the weekends, we'll have to wait and see. :)

Make Commands return a String

Currently commands are done using a Consumer, which ends up returning nothing and taking a ChatInterface. This makes implementing replies and substituting commands a little... incoherent.

To "prevent" this from happening we should remove the connection Command -> ChatInterface, by having commands return their message output as a String instead of directly sending it. This also may allow us to just pass a String to the commands instead of the whole ChatMessage, but this may be unsuitable for commands requiring certain permissions

This would give the DefaultBot another responsibility, namely using the commands' "response" to create a message from them, that can be sent using the ChatInterface. In turn this would couple the bot with the ChatInterface, and that's not a nice way to do things... it might be interesting to extract the whole command processing to a separate class and have the bot act as a proxy / filter of sorts for the mindjail. I'd like to solicit discussion on a properly decoupled design for this before any implementation is carried out

Processes previously processed messages

The bot will attempt to respond to the same message multiple times. Sometimes it succeeds and you find yourself with three replies for one that one command.

Timer Command

Implement a Timer command to nudge the caller with an automatic or prespecified message.

!!timer timespan(in minutes) {message}

optionally the timespan could be specified in different formats (1h20m)

Timers should be internally managed with a number so they can be aborted if necessary:

!!timer abort number 

Maven compiler plugin version is missing

[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.gmail.inversecon
duit:javabot:jar:0.0.1
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missi
ng. @ line 14, column 12

Fix is simple. provide a version for the build-plugin

Gson Dependency is broken

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Unable to get dependency information: Unable to read the metadata file for artifact 'com.google.code.gson:gson:jar': Invalid JDK version in profile 'doclint-java8-disable': Unbounded range: [1.8, for project com.google.code.gson:gson
com.google.code.gson:gson:jar:2.3

from the specified remote repositories:
central (http://repo1.maven.org/maven2)

Path to dependency:
1) com.gmail.inverseconduit:javabot:jar:0.0.1

[INFO] ------------------------------------------------------------------------

This issue is known and referenced in: https://code.google.com/p/google-gson/issues/detail?id=588

There the suggested workaround is to fall back to version 2.2.4 until the issue is fixed

Avoid System.exit

Even though this question is about Swing, it applies here too: http://stackoverflow.com/a/3281935/1310566

As I plan on incorporating this in a web-based application, using System.exit would be devastating for me. Using System.exit is a mean way of terminating applications. Throw exceptions and/or interrupt threads instead.

Make the Bot reply to command messages

It would be awesome if the bot could reply to command messages, just like Fox9k replies to the WAG word.

For that it would be required to keep the timestamp inside a ChatMessage, since that is what is passed around.

Execute Java code instead of groovy: !!eval-javac:

Compiles and runs code, be it Java statements or Java classes.

!!eval-javac: (code)

We need this because Groovy isn't of Java syntax, plus it doesn't support JDK8. Using Java code execution will allow running code of the same Java compliance level as the runtime, using JavaCompiler.

Plus, this will be a great opportunity for me to take a break from Vincentyification/JChatExchange, so I'm going to self-assign this and work on it.


  • Execute Java code command: !!eval-javac:
  • Learn a command from the user: !!learn
  • Execute code from online

JavaBot does not log in!

Following error message:


$ java -jar javabot.jar
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 
May 03, 2015 2:32:00 PM com.gmail.inverseconduit.BotConfig 
INFO: Setting loginEmail to [email protected]
May 03, 2015 2:32:00 PM com.gmail.inverseconduit.BotConfig 
INFO: Setting password
May 03, 2015 2:32:00 PM com.gmail.inverseconduit.BotConfig 
INFO: Setting trigger to !!
May 03, 2015 2:32:00 PM com.gmail.inverseconduit.BotConfig 
INFO: Setting javadocs dir to javadocs
May 03, 2015 2:32:00 PM com.gmail.inverseconduit.BotConfig 
INFO: Setting rooms to [1]
May 03, 2015 2:32:04 PM com.gmail.inverseconduit.chat.StackExchangeChat getLoginPage
SEVERE: Couldn't fetch Login Page / IOException when logging in
javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:208)
    at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1937)
    at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1894)
    at sun.security.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1877)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1398)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1375)
    at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:275)
    at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:254)
    at com.gargoylesoftware.htmlunit.HtmlUnitSSLConnectionSocketFactory.connectSocket(HtmlUnitSSLConnectionSocketFactory.java:155)
    at org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:123)
    at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:318)
    at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:363)
    at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:219)
    at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
    at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86)
    at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
    at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
    at com.gargoylesoftware.htmlunit.HttpWebConnection.getResponse(HttpWebConnection.java:178)
    at com.gargoylesoftware.htmlunit.util.WebConnectionWrapper.getResponse(WebConnectionWrapper.java:68)
    at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(WebClient.java:1313)
    at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(WebClient.java:1371)
    at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(WebClient.java:1363)
    at com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:1230)
    at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:338)
    at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:407)
    at com.gmail.inverseconduit.chat.StackExchangeChat.getLoginPage(StackExchangeChat.java:90)
    at com.gmail.inverseconduit.chat.StackExchangeChat.login(StackExchangeChat.java:62)
    at com.gmail.inverseconduit.Main.main(Main.java:45)
Caused by: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
    at sun.security.validator.PKIXValidator.(PKIXValidator.java:90)
    at sun.security.validator.Validator.getInstance(Validator.java:179)
    at sun.security.ssl.X509TrustManagerImpl.getValidator(X509TrustManagerImpl.java:312)
    at sun.security.ssl.X509TrustManagerImpl.checkTrustedInit(X509TrustManagerImpl.java:171)
    at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:184)
    at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:124)
    at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1460)
    at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:212)
    at sun.security.ssl.Handshaker.processLoop(Handshaker.java:979)
    at sun.security.ssl.Handshaker.process_record(Handshaker.java:914)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1050)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1363)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1391)
    ... 24 more
Caused by: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
    at java.security.cert.PKIXParameters.setTrustAnchors(PKIXParameters.java:200)
    at java.security.cert.PKIXParameters.(PKIXParameters.java:120)
    at java.security.cert.PKIXBuilderParameters.(PKIXBuilderParameters.java:104)
    at sun.security.validator.PKIXValidator.(PKIXValidator.java:88)
    ... 36 more
May 03, 2015 2:32:04 PM com.gmail.inverseconduit.Main main
SEVERE: Login failed!
Exception in thread "main" java.lang.RuntimeException: Login failure
    at com.gmail.inverseconduit.Main.main(Main.java:47)

Runtime flags for doing specific stuffs.

It would be great if we can setup temporary runtime flags that gets reset on every reload so it helps with testing / messing around, without having a lasting effect. For example, we might have:

!!~privreq"0" ~owneradd Vogel612

Modularize the framework we have

Our code is very messy at the moment. AbstractBot holds both the message queue and manages the listeners, while the code that handles the connection is spread everywhere. Reliable development is hindered, so I propose that we take some time to fix up the spaghetti code and improve the object-oriented design of JavaBot, bearing in mind the following concepts from SOLID:

  • Single responsibility
  • Open/closed
  • Liskov substitution
  • Interface segregation
  • Dependency inversion

Yeah... That's all I have to say for now.

Warn users not to ask to ask

When users show an asking pattern that appears to be enquiring for topic experts, whether they can ask a question, or if anyone's active, the bot should warn them not to ask to ask, as having chat users to reply with that reduces efficiency.

A sample message might look like a derivative of this:

Don't ask to ask. Don't ask for topic experts. Don't ask if anyone's online.

Overlong messages get split "incorrectly"

Prime example: javadoc of FunctionalInterface, to be seen here

@unihedron annotation java.lang.FunctionalInterface: An informative annotation type used to indicate that an interface type declaration is intended to be a functional interface as defined by the Java Language Specification. Conceptually, a functional interface has exactly one abstract method. Since [default...

methods](docs.oracle.com/javase/8/docs/…) have an implementation, they are not abstract. If an interface declares an abstract method overriding one of the public methods of java.lang.Object, that also does not count toward the interface's abstract method count since any implementation of the interface will have an implementation from java.lang.Object or elsewhere.

Allow sending a message with a shutdown-request

Currently invoking the shutdown command only has the bot print ~going down to all rooms it's currently in.

It might be beneficial to allow a proper notification for users, like:

!!shutdown Restarting with latest changes

~going down: Restarting with latest changes

!!ddg command for querying duckduckgo

Queries the DuckDuckGo API and returns more appealing results, posting them in chat.
I've convinced the Javascript room to add this feature to Caprica, so we might as well as (try to) get it for our own bot as well. :P

Proposed command:

!!ddg
alias: [!!duckduckgo]

As a demonstration, this query of 'duck' on duckduckgo API returns pretty json:

{
   "DefinitionSource" : "",
   "Heading" : "Duck",
   "ImageWidth" : 0,
   "RelatedTopics" : [
      {
         "Result" : "<a href=\"https://duckduckgo.com/Duck\">Duck</a> The common name for a large number of species in the Anatidae family of birds, which also...",
         "Icon" : {
            "URL" : "",
            "Height" : "",
            "Width" : ""
         },
         "FirstURL" : "https://duckduckgo.com/Duck",
         "Text" : "Duck The common name for a large number of species in the Anatidae family of birds, which also..."
      },
      {
         "Result" : "<a href=\"https://duckduckgo.com/Anaheim_Ducks\">Anaheim Ducks</a>A professional ice hockey team based in Anaheim, California, United States.",
         "Icon" : {
            "URL" : "",
            "Height" : "",
            "Width" : ""
         },
         "FirstURL" : "https://duckduckgo.com/Anaheim_Ducks",
         "Text" : "Anaheim DucksA professional ice hockey team based in Anaheim, California, United States."
      },
      {
         "Result" : "<a href=\"https://duckduckgo.com/Ducati\">Ducati</a>Ducati Motor Holding S.p.A. is an Italian company that designs and manufactures motorcycles.",
         "Icon" : {
            "URL" : "https://duckduckgo.com/i/8d3cf6a1.png",
            "Height" : "",
            "Width" : ""
         },
         "FirstURL" : "https://duckduckgo.com/Ducati",
         "Text" : "DucatiDucati Motor Holding S.p.A. is an Italian company that designs and manufactures motorcycles."
      },
      {
         "Topics" : [
            {
               "Result" : "<a href=\"https://duckduckgo.com/don_Manley\">Duck (crossword compiler)</a>A long-serving setter of crosswords in the UK. He has supplied puzzles for the Radio Times, The...",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/don_Manley",
               "Text" : "Duck (crossword compiler)A long-serving setter of crosswords in the UK. He has supplied puzzles for the Radio Times, The..."
            }
         ],
         "Name" : "People"
      },
      {
         "Topics" : [
            {
               "Result" : "<a href=\"https://duckduckgo.com/Duck%2C_North_Carolina\">Duck, North Carolina</a>A town in Dare County, North Carolina, United States.",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/Duck%2C_North_Carolina",
               "Text" : "Duck, North CarolinaA town in Dare County, North Carolina, United States."
            },
            {
               "Result" : "<a href=\"https://duckduckgo.com/Duck%2C_West_Virginia\">Duck, West Virginia</a>An unincorporated community in Clay County, West Virginia, United States. Duck is northeast of Clay.",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/Duck%2C_West_Virginia",
               "Text" : "Duck, West VirginiaAn unincorporated community in Clay County, West Virginia, United States. Duck is northeast of Clay."
            },
            {
               "Result" : "<a href=\"https://duckduckgo.com/Monte_Creek\">Monte Creek</a>A rural locality on the South Thompson River east of Kamloops, British Columbia, Canada...",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/Monte_Creek",
               "Text" : "Monte CreekA rural locality on the South Thompson River east of Kamloops, British Columbia, Canada..."
            }
         ],
         "Name" : "Places"
      },
      {
         "Topics" : [
            {
               "Result" : "<a href=\"https://duckduckgo.com/Duck_(bridge)\">Duck (bridge)</a>In the card game of contract bridge, to duck means to play low to a trick to which one has led...",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/Duck_(bridge)",
               "Text" : "Duck (bridge)In the card game of contract bridge, to duck means to play low to a trick to which one has led..."
            },
            {
               "Result" : "<a href=\"https://duckduckgo.com/Duck_(cricket)\">Duck (cricket)</a> A batsman's dismissal for a score of zero.",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/Duck_(cricket)",
               "Text" : "Duck (cricket) A batsman's dismissal for a score of zero."
            },
            {
               "Result" : "<a href=\"https://duckduckgo.com/Oregon_Ducks\">Oregon Ducks</a>The Oregon Ducks refers to the sports teams of the University of Oregon, located in Eugene...",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/Oregon_Ducks",
               "Text" : "Oregon DucksThe Oregon Ducks refers to the sports teams of the University of Oregon, located in Eugene..."
            },
            {
               "Result" : "<a href=\"https://duckduckgo.com/Long_Island_Ducks\">Long Island Ducks</a>An American professional baseball team based in Central Islip, New York.",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/Long_Island_Ducks",
               "Text" : "Long Island DucksAn American professional baseball team based in Central Islip, New York."
            }
         ],
         "Name" : "Sports and games"
      },
      {
         "Topics" : [
            {
               "Result" : "<a href=\"https://duckduckgo.com/Duck_(Alice's_Adventures_in_Wonderland)\">Duck (Alice's Adventures in Wonderland)</a>A fictional character appearing in Chapters 2 and 3 of the book Alice's Adventures in Wonderland...",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/Duck_(Alice's_Adventures_in_Wonderland)",
               "Text" : "Duck (Alice's Adventures in Wonderland)A fictional character appearing in Chapters 2 and 3 of the book Alice's Adventures in Wonderland..."
            },
            {
               "Result" : "<a href=\"https://duckduckgo.com/Duck_the_Great_Western_Engine\">Duck the Great Western Engine</a>A fictional steam engine from The Railway Series by the Rev.",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/Duck_the_Great_Western_Engine",
               "Text" : "Duck the Great Western EngineA fictional steam engine from The Railway Series by the Rev."
            },
            {
               "Result" : "<a href=\"https://duckduckgo.com/Aflac_duck\">Aflac duck</a> The brand and mascot of Aflac Incorporated.",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/Aflac_duck",
               "Text" : "Aflac duck The brand and mascot of Aflac Incorporated."
            }
         ],
         "Name" : "Fictional characters"
      },
      {
         "Topics" : [
            {
               "Result" : "<a href=\"https://duckduckgo.com/Duck_(film)\">Duck (film)</a>A 2005 film by director/writer/producer Nic Bettauer.",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/Duck_(film)",
               "Text" : "Duck (film)A 2005 film by director/writer/producer Nic Bettauer."
            },
            {
               "Result" : "<a href=\"https://duckduckgo.com/Duck!_The_Carbine_High_Massacre\">Duck! The Carbine High Massacre</a> Duck! The Carbine High Massacre is a 1999 American comedy-drama film about a fictional school...",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/Duck!_The_Carbine_High_Massacre",
               "Text" : "Duck! The Carbine High Massacre Duck! The Carbine High Massacre is a 1999 American comedy-drama film about a fictional school..."
            },
            {
               "Result" : "\"<a href=\"https://duckduckgo.com/?q=Duck!%20%2F%20Aren%27t%20You%20Chupacabra%20To%20See%20Me%3F\">Duck! / Aren't You Chupacabra To See Me?</a>\" An episode of The Grim Adventures of Billy and Mandy.",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/?q=Duck!%20%2F%20Aren%27t%20You%20Chupacabra%20To%20See%20Me%3F",
               "Text" : "\"Duck! / Aren't You Chupacabra To See Me?\" An episode of The Grim Adventures of Billy and Mandy."
            }
         ],
         "Name" : "Film and television"
      },
      {
         "Topics" : [
            {
               "Result" : "<a href=\"https://duckduckgo.com/American_Canyon_Transit\">American Canyon Transit</a> Also known as \"The Duck\".",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/American_Canyon_Transit",
               "Text" : "American Canyon Transit Also known as \"The Duck\"."
            },
            {
               "Result" : "<a href=\"https://duckduckgo.com/Citro%C3%ABn_2CV\">Citro\u00ebn 2CV</a>A front-engine, front wheel drive, air-cooled economy car introduced at the 1948 Paris Mondial de...",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/Citro%C3%ABn_2CV",
               "Text" : "Citro\u00ebn 2CVA front-engine, front wheel drive, air-cooled economy car introduced at the 1948 Paris Mondial de..."
            },
            {
               "Result" : "<a href=\"https://duckduckgo.com/Ducati\">Ducati</a>Ducati Motor Holding S.p.A. is an Italian company that designs and manufactures motorcycles.",
               "Icon" : {
                  "URL" : "https://duckduckgo.com/i/8d3cf6a1.png",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/Ducati",
               "Text" : "DucatiDucati Motor Holding S.p.A. is an Italian company that designs and manufactures motorcycles."
            },
            {
               "Result" : "<a href=\"https://duckduckgo.com/Goodyear_Duck\">Goodyear Duck</a>A 1940s American three-seat light amphibian built by the Goodyear Aircraft Corporation.",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/Goodyear_Duck",
               "Text" : "Goodyear DuckA 1940s American three-seat light amphibian built by the Goodyear Aircraft Corporation."
            },
            {
               "Result" : "<a href=\"https://duckduckgo.com/Grumman_JF_Duck\">Grumman JF Duck</a> A single-engine amphibious biplane, built by Grumman for the United States Navy during the 1930s.",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/Grumman_JF_Duck",
               "Text" : "Grumman JF Duck A single-engine amphibious biplane, built by Grumman for the United States Navy during the 1930s."
            },
            {
               "Result" : "<a href=\"https://duckduckgo.com/grumman_J2F_Duck\">J2F Duck</a>An American single-engine amphibious biplane.",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/grumman_J2F_Duck",
               "Text" : "J2F DuckAn American single-engine amphibious biplane."
            },
            {
               "Result" : "<a href=\"https://duckduckgo.com/DUKW\">DUKW</a>A six-wheel-drive modification of the 2-ton capacity \"deuce\" trucks used by the U.S. military in...",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/DUKW",
               "Text" : "DUKWA six-wheel-drive modification of the 2-ton capacity \"deuce\" trucks used by the U.S. military in..."
            }
         ],
         "Name" : "Transportation"
      },
      {
         "Topics" : [
            {
               "Result" : "<a href=\"https://duckduckgo.com/On2_Technologies\">On2 Technologies</a>A small publicly traded company, headquartered in Clifton Park, New York, that designed video...",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/On2_Technologies",
               "Text" : "On2 TechnologiesA small publicly traded company, headquartered in Clifton Park, New York, that designed video..."
            },
            {
               "Result" : "<a href=\"https://duckduckgo.com/Duck_Records\">Duck Records</a>The record label of Eric Clapton.",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/Duck_Records",
               "Text" : "Duck RecordsThe record label of Eric Clapton."
            },
            {
               "Result" : "<a href=\"https://duckduckgo.com/Duck_Studios\">Duck Studios</a>A production studio based in Los Angeles, California, USA. It focuses primarily on producing...",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/Duck_Studios",
               "Text" : "Duck StudiosA production studio based in Los Angeles, California, USA. It focuses primarily on producing..."
            }
         ],
         "Name" : "Businesses"
      },
      {
         "Topics" : [
            {
               "Result" : "<a href=\"https://duckduckgo.com/Duck_(food)\">Duck (food)</a>A common livestock bird in many parts of the world. Duck is eaten in many cuisines around the world.",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/Duck_(food)",
               "Text" : "Duck (food)A common livestock bird in many parts of the world. Duck is eaten in many cuisines around the world."
            },
            {
               "Result" : "<a href=\"https://duckduckgo.com/Cotton_duck\">Cotton duck</a> A heavy, plain woven cotton fabric. There is also linen duck, which is less often used.",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/Cotton_duck",
               "Text" : "Cotton duck A heavy, plain woven cotton fabric. There is also linen duck, which is less often used."
            },
            {
               "Result" : "<a href=\"https://duckduckgo.com/Duck_Samford_Stadium\">Duck Samford Stadium</a>A stadium in Auburn, Alabama.",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/Duck_Samford_Stadium",
               "Text" : "Duck Samford StadiumA stadium in Auburn, Alabama."
            },
            {
               "Result" : "<a href=\"https://duckduckgo.com/cairn\">Ducks (hiking)</a> A man-made pile of stones. The word cairn comes from the c\u00e0rn.",
               "Icon" : {
                  "URL" : "https://duckduckgo.com/i/8a9ad1c0.jpg",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/cairn",
               "Text" : "Ducks (hiking) A man-made pile of stones. The word cairn comes from the c\u00e0rn."
            }
         ],
         "Name" : "Other uses"
      },
      {
         "Topics" : [
            {
               "Result" : "<a href=\"https://duckduckgo.com/Waterfowl\">Waterfowl</a>Waterfowl are certain wildfowl of the order Anseriformes, especially members of the family...",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/Waterfowl",
               "Text" : "WaterfowlWaterfowl are certain wildfowl of the order Anseriformes, especially members of the family..."
            },
            {
               "Result" : "<a href=\"https://duckduckgo.com/d/Duct\">Duct Meanings</a>  See related meanings for the word 'Duct'.",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/d/Duct",
               "Text" : "Duct Meanings  See related meanings for the word 'Duct'."
            },
            {
               "Result" : "<a href=\"https://duckduckgo.com/d/Duckie\">Duckie Meanings</a>  See related meanings for the word 'Duckie'.",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/d/Duckie",
               "Text" : "Duckie Meanings  See related meanings for the word 'Duckie'."
            },
            {
               "Result" : "<a href=\"https://duckduckgo.com/d/Ducky\">Ducky Meanings</a>  See related meanings for the word 'Ducky'.",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/d/Ducky",
               "Text" : "Ducky Meanings  See related meanings for the word 'Ducky'."
            },
            {
               "Result" : "<a href=\"https://duckduckgo.com/d/Duck_Island\">Duck Island Meanings</a>  See related meanings for the phrase 'Duck Island'.",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/d/Duck_Island",
               "Text" : "Duck Island Meanings  See related meanings for the phrase 'Duck Island'."
            },
            {
               "Result" : "<a href=\"https://duckduckgo.com/d/Duck_Lake\">Duck Lake Meanings</a>  See related meanings for the phrase 'Duck Lake'.",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/d/Duck_Lake",
               "Text" : "Duck Lake Meanings  See related meanings for the phrase 'Duck Lake'."
            },
            {
               "Result" : "<a href=\"https://duckduckgo.com/d/Duck_River\">Duck River Meanings</a>  See related meanings for the phrase 'Duck River'.",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/d/Duck_River",
               "Text" : "Duck River Meanings  See related meanings for the phrase 'Duck River'."
            },
            {
               "Result" : "<a href=\"https://duckduckgo.com/d/Duck_Creek\">Duck Creek Meanings</a>  See related meanings for the phrase 'Duck Creek'.",
               "Icon" : {
                  "URL" : "",
                  "Height" : "",
                  "Width" : ""
               },
               "FirstURL" : "https://duckduckgo.com/d/Duck_Creek",
               "Text" : "Duck Creek Meanings  See related meanings for the phrase 'Duck Creek'."
            }
         ],
         "Name" : "See also"
      }
   ],
   "Entity" : "",
   "Type" : "D",
   "Redirect" : "",
   "DefinitionURL" : "",
   "AbstractURL" : "https://en.wikipedia.org/wiki/Duck_(disambiguation)",
   "Definition" : "",
   "AbstractSource" : "Wikipedia",
   "Infobox" : "",
   "Image" : "",
   "ImageIsLogo" : 0,
   "Abstract" : "",
   "AbstractText" : "",
   "AnswerType" : "",
   "ImageHeight" : 0,
   "Results" : [],
   "Answer" : ""
}

Cleaning up `AbstractBot`

There are currently two Executors in the AbstractBot class.

protected final ScheduledExecutorService   executor         = Executors.newSingleThreadScheduledExecutor();
protected final ExecutorService            processingThread = Executors.newSingleThreadExecutor();

One of them (executor) is shutdown inside the finalize method, which is a bad idea to rely on

The other one, processingThread is never shutdown at all, which makes a process running the JavaBot continue running because there is one or more threads that hasn't shutdown completely.

StackApps announcement

Announce JavaBot on stackapps.com when the integration of JCE is finished and the bot is running stable. It might be beneficial to have a packed release for this, but alas

Queue seems to always be full.

Querying responses seems to crash the bot. The queue appears to be full. The behaviour is consistent on my environment. Using a build from branch development.

十一月 09, 2014 5:30:26 下午 com.gmail.inverseconduit.chat.StackExchangeChat joinChat
資訊: Joined room.
STACK_OVERFLOW:null(139) / overexchange(3317808): but i have question here
java.lang.IllegalStateException: Queue full
    at java.util.AbstractQueue.add(AbstractQueue.java:98)
    at com.gmail.inverseconduit.bot.JavaBot.queueMessage(JavaBot.java:89)
    at com.gmail.inverseconduit.chat.StackExchangeChat.handleChatEvents(StackExchangeChat.java:116)
    at com.gmail.inverseconduit.chat.JSONChatConnection.getResponse(JSONChatConnection.java:35)
    at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(WebClient.java:1313)
    at com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:1230)
    at com.gargoylesoftware.htmlunit.javascript.host.xml.XMLHttpRequest.doSend(XMLHttpRequest.java:694)
    at com.gargoylesoftware.htmlunit.javascript.host.xml.XMLHttpRequest.access$000(XMLHttpRequest.java:102)
    at com.gargoylesoftware.htmlunit.javascript.host.xml.XMLHttpRequest$1.run(XMLHttpRequest.java:611)
    at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:620)
    at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:513)
    at com.gargoylesoftware.htmlunit.javascript.background.JavascriptXMLHttpRequestJob.run(JavascriptXMLHttpRequestJob.java:36)
    at com.gargoylesoftware.htmlunit.javascript.background.JavaScriptJobManagerImpl.runSingleJob(JavaScriptJobManagerImpl.java:328)
    at com.gargoylesoftware.htmlunit.javascript.background.DefaultJavaScriptExecutor.run(DefaultJavaScriptExecutor.java:162)
    at java.lang.Thread.run(Thread.java:745)

java.nio.file.NoSuchFileException: bot.properties

I had this file along with src, javadoc, pom.xml and other files. But still it is showing me that NoSuchFileException for bot.properties.

and here what i have inside bot.properties:

LOGIN-EMAIL=myEmailAddressPASSWORD=accountPasswordROOMS=TRIGGER=**
SITE=stackoverflow

Where should i put that?

Special characters when using tell command

I tried using the tell command with
**tell geisterfurz007 "Hello!"
and got pinged with the message
&quotHello!&quot (with ; after &quot, but this editor would make them a " if this was there...)
I think, it would be great to add support for special characters / prevent this encoding if it is not required elsewhere.

Shorthand "Paste to ..." message

It's a pain to always write "Don't paste code, use [favorite pasting provider] instead"

How about a simple series of things we can tell people as an expansion to the tell command.
The series could be configurable using a properties file.

Also it would be nice to be able to add and edit messages for that. I imagine the following:

!!tell user pasting

!!canned-messages edit pasting "Don't paste code ..."
!!canned-messages add asking "Don't ask to ask ..."
!!canned-messages remove asking

Response for unsummoning.

Currently despite having the return line in the unsummon command there is no response when unsummoning the bot from a channel. This is something minor but I could not find how to solve this on my own so I opened this issue.

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.