mirror of https://github.com/bvn13/JIrcBot.git
documentation added
parent
e4a55d5714
commit
973cea4b3c
|
@ -0,0 +1,428 @@
|
|||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>JIrcBot documentation</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>JIrcBot documentation</h1>
|
||||
|
||||
<h4>view project sources at <a href="https://github.com/bvn13/jircbot">GitHub repo</a></h4>
|
||||
|
||||
<hr/>
|
||||
|
||||
|
||||
<div>
|
||||
<h3 id="AdminListener">MODULE: <span>AdminListener</span></h3>
|
||||
<p>
|
||||
<i>
|
||||
<span>Admin commands of the bot<br/>Must be send in private dialog<br/>You must be the owner of the bot (config.json) and your nick must be registered and verified at server</span>
|
||||
</i>
|
||||
</p>
|
||||
|
||||
<p>COMMANDS:</p>
|
||||
|
||||
<ol>
|
||||
|
||||
<li>
|
||||
<p>
|
||||
<b>
|
||||
<span>cmd</span>
|
||||
</b>
|
||||
</p>
|
||||
<p>
|
||||
Description: <span>send RAW command to server (be careful with that shit!)</span>
|
||||
</p>
|
||||
<p><b>
|
||||
Example: <span>?cmd [ANY COMMAND WITH PARAMS]</span>
|
||||
</b></p>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p>
|
||||
<b>
|
||||
<span>join</span>
|
||||
</b>
|
||||
</p>
|
||||
<p>
|
||||
Description: <span>joins given channel on current server</span>
|
||||
</p>
|
||||
<p><b>
|
||||
Example: <span>?join [#CHANNEL_NAME]</span>
|
||||
</b></p>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p>
|
||||
<b>
|
||||
<span>kick</span>
|
||||
</b>
|
||||
</p>
|
||||
<p>
|
||||
Description: <span>kick user from channel</span>
|
||||
</p>
|
||||
<p><b>
|
||||
Example: <span>?kick [#CHANNEL_NAME] [YOUR_HOSTILE_NICK]</span>
|
||||
</b></p>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p>
|
||||
<b>
|
||||
<span>leave</span>
|
||||
</b>
|
||||
</p>
|
||||
<p>
|
||||
Description: <span>joins given channel on current server</span>
|
||||
</p>
|
||||
<p><b>
|
||||
Example: <span>?leave [#CHANNEL_NAME]</span>
|
||||
</b></p>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p>
|
||||
<b>
|
||||
<span>op|deop</span>
|
||||
</b>
|
||||
</p>
|
||||
<p>
|
||||
Description: <span>give / take away OP user status</span>
|
||||
</p>
|
||||
<p><b>
|
||||
Example: <span>?op [#CHANNEL_NAME] [YOUR_FRIEND_NICK]<br/>?deop [#CHANNEL_NAME] [YOUR_HOSTILE_NICK]</span>
|
||||
</b></p>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p>
|
||||
<b>
|
||||
<span>privmsg</span>
|
||||
</b>
|
||||
</p>
|
||||
<p>
|
||||
Description: <span>send private message</span>
|
||||
</p>
|
||||
<p><b>
|
||||
Example: <span>?privmsg [YOUR_FRIEND_NICK]</span>
|
||||
</b></p>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p>
|
||||
<b>
|
||||
<span>restart</span>
|
||||
</b>
|
||||
</p>
|
||||
<p>
|
||||
Description: <span>trying to restart the bot on current server</span>
|
||||
</p>
|
||||
<p><b>
|
||||
Example: <span>?restart</span>
|
||||
</b></p>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p>
|
||||
<b>
|
||||
<span>set</span>
|
||||
</b>
|
||||
</p>
|
||||
<p>
|
||||
Description: <span>set ON|OFF any of bot opportunity for channel<br/><br/>Opportunities: <br/><br/>autorejoin | auto-rejoin - auto rejoin channel on kicking<br/>bash | bashorg - bach.org quoting<br/>deferredmessages | deferred-messages | tell - saving and delivering deferred messages<br/>gs | googlesearch | google-search - search in Google<br/>grammar | grammarcorrection | grammar-correction - grammar checker (does not work in current version)<br/>hello | helloonjoin | hello-on-join - sending your phrase on user joins<br/>links | linkpreview | links-preview - sending titles of web pages by given URL<br/>logging | log - logging for channel<br/>regex | regexp | regexchecker | regexpchecker | regex-checker | regexp-checker - regular expression checker<br/>advice | advices - give yor friend advices<br/>calc | calculator - calculator<br/>quiz - quiz<br/></span>
|
||||
</p>
|
||||
<p><b>
|
||||
Example: <span>?set [#CHANNEL_NAME] [OPPORTUNITY] [ON|OFF]</span>
|
||||
</b></p>
|
||||
</li>
|
||||
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
|
||||
<div>
|
||||
<h3 id="BashOrgListener">MODULE: <span>BashOrgListener</span></h3>
|
||||
<p>
|
||||
<i>
|
||||
<span>Send bash.org quotes in channel on your request</span>
|
||||
</i>
|
||||
</p>
|
||||
|
||||
<p>COMMANDS:</p>
|
||||
|
||||
<ol>
|
||||
|
||||
<li>
|
||||
<p>
|
||||
<b>
|
||||
<span>bash</span>
|
||||
</b>
|
||||
</p>
|
||||
<p>
|
||||
Description: <span>Send random quote from bash.org to channel</span>
|
||||
</p>
|
||||
<p><b>
|
||||
Example: <span>?bash</span>
|
||||
</b></p>
|
||||
</li>
|
||||
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
|
||||
<div>
|
||||
<h3 id="DeferredMessagesListener">MODULE: <span>DeferredMessagesListener</span></h3>
|
||||
<p>
|
||||
<i>
|
||||
<span>This module is like answerphone - it stores your speech to any opponent into bot's database and when your opponent becomes online (joins channel and starts to speak) the bot notice him/her with your deferred messages.</span>
|
||||
</i>
|
||||
</p>
|
||||
|
||||
<p>COMMANDS:</p>
|
||||
|
||||
<ol>
|
||||
|
||||
<li>
|
||||
<p>
|
||||
<b>
|
||||
<span>forget</span>
|
||||
</b>
|
||||
</p>
|
||||
<p>
|
||||
Description: <span>If you do not want to read all messages deferred to you this command tells the bot do not disturb you this time</span>
|
||||
</p>
|
||||
<p><b>
|
||||
Example: <span>?forget</span>
|
||||
</b></p>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p>
|
||||
<b>
|
||||
<span>read</span>
|
||||
</b>
|
||||
</p>
|
||||
<p>
|
||||
Description: <span>Let the bot send you all the messages deferred to you this time in private dialogue</span>
|
||||
</p>
|
||||
<p><b>
|
||||
Example: <span>?read</span>
|
||||
</b></p>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p>
|
||||
<b>
|
||||
<span>tell</span>
|
||||
</b>
|
||||
</p>
|
||||
<p>
|
||||
Description: <span>Let the bot keep in mind your message to any opponent</span>
|
||||
</p>
|
||||
<p><b>
|
||||
Example: <span>?tell [YOUR_FRIEND] [YOUR MESSAGE]</span>
|
||||
</b></p>
|
||||
</li>
|
||||
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
|
||||
<div>
|
||||
<h3 id="GoogleSearchListener">MODULE: <span>GoogleSearchListener</span></h3>
|
||||
<p>
|
||||
<i>
|
||||
<span>Make a search in Google for you</span>
|
||||
</i>
|
||||
</p>
|
||||
|
||||
<p>COMMANDS:</p>
|
||||
|
||||
<ol>
|
||||
|
||||
<li>
|
||||
<p>
|
||||
<b>
|
||||
<span>gs</span>
|
||||
</b>
|
||||
</p>
|
||||
<p>
|
||||
Description: <span>Search it</span>
|
||||
</p>
|
||||
<p><b>
|
||||
Example: <span>?gs [WHAT YOU WANT TO SEARCH]</span>
|
||||
</b></p>
|
||||
</li>
|
||||
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
|
||||
<div>
|
||||
<h3 id="HelloOnJoinListener">MODULE: <span>HelloOnJoinListener</span></h3>
|
||||
<p>
|
||||
<i>
|
||||
<span>The bot greets everyone joining the channel<br/>You can set the greeting text using <a href='/docs#AdminListener'>Admin module</a></span>
|
||||
</i>
|
||||
</p>
|
||||
|
||||
<p>COMMANDS:</p>
|
||||
|
||||
<ol>
|
||||
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
|
||||
<div>
|
||||
<h3 id="LinkPreviewListener">MODULE: <span>LinkPreviewListener</span></h3>
|
||||
<p>
|
||||
<i>
|
||||
<span>With this module enabled into <a href='/docs#AdminListener'>Admin module</a> the bot will send the title of every URL found in messages posted in channel</span>
|
||||
</i>
|
||||
</p>
|
||||
|
||||
<p>COMMANDS:</p>
|
||||
|
||||
<ol>
|
||||
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
|
||||
<div>
|
||||
<h3 id="LoggerListener">MODULE: <span>LoggerListener</span></h3>
|
||||
<p>
|
||||
<i>
|
||||
<span>This module logs all the messages into database for being able to observe in Web</span>
|
||||
</i>
|
||||
</p>
|
||||
|
||||
<p>COMMANDS:</p>
|
||||
|
||||
<ol>
|
||||
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
|
||||
<div>
|
||||
<h3 id="PingPongListener">MODULE: <span>PingPongListener</span></h3>
|
||||
<p>
|
||||
<i>
|
||||
<span>Try to play ping-pong if you not aware of is the bot here</span>
|
||||
</i>
|
||||
</p>
|
||||
|
||||
<p>COMMANDS:</p>
|
||||
|
||||
<ol>
|
||||
|
||||
<li>
|
||||
<p>
|
||||
<b>
|
||||
<span>ping</span>
|
||||
</b>
|
||||
</p>
|
||||
<p>
|
||||
Description: <span>Returns pong</span>
|
||||
</p>
|
||||
<p><b>
|
||||
Example: <span>?ping</span>
|
||||
</b></p>
|
||||
</li>
|
||||
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
|
||||
<div>
|
||||
<h3 id="RegexCheckerListener">MODULE: <span>RegexCheckerListener</span></h3>
|
||||
<p>
|
||||
<i>
|
||||
<span></span>
|
||||
</i>
|
||||
</p>
|
||||
|
||||
<p>COMMANDS:</p>
|
||||
|
||||
<ol>
|
||||
|
||||
<li>
|
||||
<p>
|
||||
<b>
|
||||
<span>regex</span>
|
||||
</b>
|
||||
</p>
|
||||
<p>
|
||||
Description: <span>Checks if given message with given regular expression</span>
|
||||
</p>
|
||||
<p><b>
|
||||
Example: <span>?regex</span>
|
||||
</b></p>
|
||||
</li>
|
||||
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
|
||||
<div>
|
||||
<h3 id="StatisticsListener">MODULE: <span>StatisticsListener</span></h3>
|
||||
<p>
|
||||
<i>
|
||||
<span></span>
|
||||
</i>
|
||||
</p>
|
||||
|
||||
<p>COMMANDS:</p>
|
||||
|
||||
<ol>
|
||||
|
||||
<li>
|
||||
<p>
|
||||
<b>
|
||||
<span>stats</span>
|
||||
</b>
|
||||
</p>
|
||||
<p>
|
||||
Description: <span>Provides statistics for channel</span>
|
||||
</p>
|
||||
<p><b>
|
||||
Example: <span>?stats [D(ay)|M(onth)|Y(ear)|A(ll)] [ALL]</span>
|
||||
</b></p>
|
||||
</li>
|
||||
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
|
||||
|
||||
<p>
|
||||
(c) bvn13<br/>
|
||||
powered with PircBotX
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
98
jircbot.iml
98
jircbot.iml
|
@ -34,73 +34,73 @@
|
|||
<orderEntry type="library" name="Maven: org.pircbotx:pircbotx:2.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.11" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.guava:guava:19.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.0.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.0.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.0.4.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.0.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.0.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.0.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.0.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.0.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.0.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.0.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.10.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.10.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.25" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.3.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.0.4.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.0.4.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.0.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.0.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.19" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.0.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.0.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.0.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.0.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.9.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.9.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.0.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:8.5.28" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:8.5.28" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:8.5.28" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.0.7.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.9.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.9.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.0.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:8.5.34" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:8.5.34" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:8.5.34" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.0.13.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.validation:validation-api:2.0.1.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.3.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.0.4.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.0.4.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.0.4.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.0.4.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-thymeleaf:2.0.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.thymeleaf:thymeleaf-spring5:3.0.9.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.thymeleaf:thymeleaf:3.0.9.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.attoparser:attoparser:2.0.4.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.unbescape:unbescape:1.1.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.0.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.0.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.0.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.0.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-thymeleaf:2.0.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.thymeleaf:thymeleaf-spring5:3.0.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.thymeleaf:thymeleaf:3.0.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.attoparser:attoparser:2.0.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.unbescape:unbescape:1.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.thymeleaf.extras:thymeleaf-extras-java8time:3.0.1.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-jpa:2.0.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:2.0.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-devtools:2.0.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-jpa:2.0.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:2.0.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.8.13" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.0.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hibernate:hibernate-core:5.2.14.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.0.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.transaction:javax.transaction-api:1.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hibernate:hibernate-core:5.2.17.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: antlr:antlr:2.7.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jboss:jandex:2.0.3.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.transaction:javax.transaction-api:1.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-jpa:2.0.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.0.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-aspects:5.0.4.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:2.7.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hibernate:hibernate-entitymanager:5.2.14.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-jpa:2.0.11.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.0.11.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-aspects:5.0.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:2.7.9" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hibernate:hibernate-entitymanager:5.2.17.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.2.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: dom4j:dom4j:1.6.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hibernate.common:hibernate-commons-annotations:5.0.1.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.2.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.javassist:javassist:3.22.0-GA" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy:1.7.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy:1.7.11" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:1.0.1.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-orm:5.0.4.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.0.4.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.0.4.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.0.4.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-orm:5.0.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.0.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.0.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.0.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.postgresql:postgresql:42.1.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: mysql:mysql-connector-java:6.0.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hibernate:hibernate-spatial:5.1.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.geolatte:geolatte-geom:1.0.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hibernate:hibernate-spatial:5.2.17.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.geolatte:geolatte-geom:1.2.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.vividsolutions:jts:1.13" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apfloat:apfloat:1.8.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.objecthunter:exp4j:0.4.8" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jsoup:jsoup:1.11.2" level="project" />
|
||||
|
@ -108,8 +108,8 @@
|
|||
<orderEntry type="library" name="Maven: com.google.api-client:google-api-client:1.23.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.oauth-client:google-oauth-client:1.23.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.http-client:google-http-client:1.23.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.9" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:1.3.9" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.http-client:google-http-client-jackson2:1.23.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.guava:guava-jdk5:17.0" level="project" />
|
||||
|
|
16
pom.xml
16
pom.xml
|
@ -6,13 +6,13 @@
|
|||
|
||||
<groupId>ru.bvn13</groupId>
|
||||
<artifactId>jircbot</artifactId>
|
||||
<version>2.0.7</version>
|
||||
<version>2.0.8</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.0.0.RELEASE</version>
|
||||
<version>2.0.6.RELEASE</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
|
@ -24,10 +24,6 @@
|
|||
|
||||
<pircbotx.version>2.1</pircbotx.version>
|
||||
|
||||
<spring.framework.version>2.0.0.RELEASE</spring.framework.version>
|
||||
<spring.orm.version>5.0.4.RELEASE</spring.orm.version>
|
||||
<hibernate.version>5.2.14.Final</hibernate.version>
|
||||
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
|
@ -78,7 +74,10 @@
|
|||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Dependencies for Database, Hibernate and ORM -->
|
||||
<dependency>
|
||||
|
@ -88,12 +87,10 @@
|
|||
<dependency>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
<artifactId>HikariCP</artifactId>
|
||||
<version>2.7.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-entitymanager</artifactId>
|
||||
<version>${hibernate.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
|
@ -114,7 +111,6 @@
|
|||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-spatial</artifactId>
|
||||
<version>5.1.0.Final</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package ru.bvn13.jircbot.documentation;
|
||||
|
||||
/**
|
||||
* Created by bvn13 on 28.10.2018.
|
||||
*/
|
||||
public interface DescriptionProvided {
|
||||
|
||||
ListenerDescription getDescription();
|
||||
default void registerDescription(DocumentationProvider documentationProvider) {
|
||||
documentationProvider.register(this);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package ru.bvn13.jircbot.documentation;
|
||||
|
||||
import javafx.collections.transformation.SortedList;
|
||||
import lombok.Getter;
|
||||
import org.modelmapper.internal.util.Lists;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Created by bvn13 on 28.10.2018.
|
||||
*/
|
||||
@Component
|
||||
public class DocumentationProvider {
|
||||
|
||||
@Getter
|
||||
private Map<String, DescriptionProvided> descriptors = new HashMap<>();
|
||||
|
||||
public void register(DescriptionProvided descriptionProvided) {
|
||||
descriptors.put(descriptionProvided.getDescription().getModuleName(), descriptionProvided);
|
||||
}
|
||||
|
||||
public List<String> getModuleNames() {
|
||||
List<String> names = Lists.from(descriptors.keySet().iterator());
|
||||
names.sort(String.CASE_INSENSITIVE_ORDER);
|
||||
return names;
|
||||
}
|
||||
|
||||
public DescriptionProvided getModuleDescriptor(String moduleName) {
|
||||
return descriptors.getOrDefault(moduleName, null);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package ru.bvn13.jircbot.documentation;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import org.modelmapper.internal.util.Lists;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by bvn13 on 28.10.2018.
|
||||
*/
|
||||
public class ListenerDescription {
|
||||
|
||||
@Builder
|
||||
public static class CommandDescription {
|
||||
|
||||
@Getter
|
||||
private String command = "";
|
||||
@Getter
|
||||
private String description = "";
|
||||
@Getter
|
||||
private String example = "";
|
||||
|
||||
}
|
||||
|
||||
@Getter
|
||||
private String moduleName = "";
|
||||
@Getter
|
||||
private String moduleDescription = "";
|
||||
|
||||
private Map<String, CommandDescription> commandsDescription = new HashMap<>();
|
||||
|
||||
|
||||
private ListenerDescription() {}
|
||||
|
||||
public static ListenerDescription create() {
|
||||
return new ListenerDescription();
|
||||
}
|
||||
|
||||
public ListenerDescription setModuleName(String moduleName) {
|
||||
this.moduleName = moduleName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ListenerDescription setModuleDescription(String moduleDescription) {
|
||||
this.moduleDescription = moduleDescription;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ListenerDescription addCommand(CommandDescription description) {
|
||||
commandsDescription.put(description.getCommand(), description);
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<String> getCommandNames() {
|
||||
List<String> names = Lists.from(commandsDescription.keySet().iterator());
|
||||
names.sort(String.CASE_INSENSITIVE_ORDER);
|
||||
return names;
|
||||
}
|
||||
|
||||
public CommandDescription getCommandDescription(String command) {
|
||||
return commandsDescription.getOrDefault(command, null);
|
||||
}
|
||||
|
||||
}
|
|
@ -3,7 +3,6 @@ package ru.bvn13.jircbot.listeners;
|
|||
import org.pircbotx.hooks.events.JoinEvent;
|
||||
import org.pircbotx.hooks.events.MessageEvent;
|
||||
import org.pircbotx.hooks.events.PrivateMessageEvent;
|
||||
import org.pircbotx.hooks.types.GenericEvent;
|
||||
import org.pircbotx.hooks.types.GenericMessageEvent;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -14,15 +13,20 @@ import ru.bvn13.jircbot.bot.JircBot;
|
|||
import ru.bvn13.jircbot.config.JircBotConfiguration;
|
||||
import ru.bvn13.jircbot.database.entities.ChannelSettings;
|
||||
import ru.bvn13.jircbot.database.services.ChannelSettingsService;
|
||||
import ru.bvn13.jircbot.documentation.DescriptionProvided;
|
||||
import ru.bvn13.jircbot.documentation.DocumentationProvider;
|
||||
import ru.bvn13.jircbot.documentation.ListenerDescription;
|
||||
import ru.bvn13.jircbot.model.Config;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import static ru.bvn13.jircbot.documentation.ListenerDescription.CommandDescription;
|
||||
|
||||
/**
|
||||
* Created by bvn13 on 27.03.2018.
|
||||
*/
|
||||
@Component
|
||||
public class AdminListener extends ImprovedListenerAdapter {
|
||||
public class AdminListener extends ImprovedListenerAdapter implements DescriptionProvided {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(AdminListener.class);
|
||||
|
||||
|
@ -34,6 +38,81 @@ public class AdminListener extends ImprovedListenerAdapter {
|
|||
@Autowired
|
||||
private ChannelSettingsService channelSettingsService;
|
||||
|
||||
@Autowired
|
||||
public AdminListener(DocumentationProvider documentationProvider) {
|
||||
this.registerDescription(documentationProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListenerDescription getDescription() {
|
||||
return ListenerDescription.create()
|
||||
.setModuleName("AdminListener")
|
||||
.setModuleDescription("Admin commands of the bot\nMust be send in private dialog\nYou must be the owner of the bot (config.json) and your nick must be registered and verified at server")
|
||||
.addCommand(CommandDescription.builder()
|
||||
.command("join")
|
||||
.description("joins given channel on current server")
|
||||
.example("?join [#CHANNEL_NAME]")
|
||||
.build()
|
||||
)
|
||||
.addCommand(CommandDescription.builder()
|
||||
.command("leave")
|
||||
.description("joins given channel on current server")
|
||||
.example("?leave [#CHANNEL_NAME]")
|
||||
.build()
|
||||
)
|
||||
.addCommand(CommandDescription.builder()
|
||||
.command("restart")
|
||||
.description("trying to restart the bot on current server")
|
||||
.example("?restart")
|
||||
.build()
|
||||
)
|
||||
.addCommand(CommandDescription.builder()
|
||||
.command("privmsg")
|
||||
.description("send private message")
|
||||
.example("?privmsg [YOUR_FRIEND_NICK]")
|
||||
.build()
|
||||
)
|
||||
.addCommand(CommandDescription.builder()
|
||||
.command("cmd")
|
||||
.description("send RAW command to server (be careful with that shit!)")
|
||||
.example("?cmd [ANY COMMAND WITH PARAMS]")
|
||||
.build()
|
||||
)
|
||||
.addCommand(CommandDescription.builder()
|
||||
.command("op|deop")
|
||||
.description("give / take away OP user status")
|
||||
.example("?op [#CHANNEL_NAME] [YOUR_FRIEND_NICK]\n?deop [#CHANNEL_NAME] [YOUR_HOSTILE_NICK]")
|
||||
.build()
|
||||
)
|
||||
.addCommand(CommandDescription.builder()
|
||||
.command("kick")
|
||||
.description("kick user from channel")
|
||||
.example("?kick [#CHANNEL_NAME] [YOUR_HOSTILE_NICK]")
|
||||
.build()
|
||||
)
|
||||
.addCommand(CommandDescription.builder()
|
||||
.command("set")
|
||||
.description("set ON|OFF any of bot opportunity for channel\n\n"+
|
||||
"Opportunities: \n\n"+
|
||||
"autorejoin | auto-rejoin - auto rejoin channel on kicking\n"+
|
||||
"bash | bashorg - bach.org quoting\n"+
|
||||
"deferredmessages | deferred-messages | tell - saving and delivering deferred messages\n"+
|
||||
"gs | googlesearch | google-search - search in Google\n"+
|
||||
"grammar | grammarcorrection | grammar-correction - grammar checker (does not work in current version)\n"+
|
||||
"hello | helloonjoin | hello-on-join - sending your phrase on user joins\n"+
|
||||
"links | linkpreview | links-preview - sending titles of web pages by given URL\n"+
|
||||
"logging | log - logging for channel\n"+
|
||||
"regex | regexp | regexchecker | regexpchecker | regex-checker | regexp-checker - regular expression checker\n"+
|
||||
"advice | advices - give yor friend advices\n"+
|
||||
"calc | calculator - calculator\n"+
|
||||
"quiz - quiz\n")
|
||||
.example("?set [#CHANNEL_NAME] [OPPORTUNITY] [ON|OFF]")
|
||||
.build()
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onJoin(JoinEvent event) throws Exception {
|
||||
if (event.getChannel().getName().startsWith("#")) {
|
||||
|
@ -48,8 +127,6 @@ public class AdminListener extends ImprovedListenerAdapter {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onMessage(MessageEvent event) throws Exception {
|
||||
Config config = getBotConfig(event);
|
||||
|
@ -247,8 +324,8 @@ public class AdminListener extends ImprovedListenerAdapter {
|
|||
case "bashorg":
|
||||
settings.setBashOrgEnabled(mode);
|
||||
break;
|
||||
case "defferedmessages":
|
||||
case "deffered-messages":
|
||||
case "deferredmessages":
|
||||
case "deferred-messages":
|
||||
case "tell" :
|
||||
settings.setDeferredMessagesEnabled(mode);
|
||||
break;
|
||||
|
@ -302,4 +379,5 @@ public class AdminListener extends ImprovedListenerAdapter {
|
|||
channelSettingsService.save(settings);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,25 +4,28 @@ import org.jsoup.Jsoup;
|
|||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.nodes.Element;
|
||||
import org.jsoup.select.Elements;
|
||||
import org.pircbotx.hooks.ListenerAdapter;
|
||||
import org.pircbotx.hooks.events.MessageEvent;
|
||||
import org.pircbotx.hooks.types.GenericMessageEvent;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.bvn13.jircbot.bot.ImprovedListenerAdapter;
|
||||
import ru.bvn13.jircbot.bot.JircBot;
|
||||
import ru.bvn13.jircbot.database.services.ChannelSettingsService;
|
||||
import ru.bvn13.jircbot.documentation.DescriptionProvided;
|
||||
import ru.bvn13.jircbot.documentation.DocumentationProvider;
|
||||
import ru.bvn13.jircbot.documentation.ListenerDescription;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
|
||||
import static ru.bvn13.jircbot.documentation.ListenerDescription.CommandDescription;
|
||||
|
||||
/**
|
||||
* Created by bvn13 on 26.01.2018.
|
||||
*/
|
||||
@Component
|
||||
public class BashOrgListener extends ImprovedListenerAdapter {
|
||||
public class BashOrgListener extends ImprovedListenerAdapter implements DescriptionProvided {
|
||||
|
||||
private static final String COMMAND = "?bash";
|
||||
private static final String USER_AGENT = "Mozilla/5.0";
|
||||
|
@ -30,6 +33,24 @@ public class BashOrgListener extends ImprovedListenerAdapter {
|
|||
@Autowired
|
||||
private ChannelSettingsService channelSettingsService;
|
||||
|
||||
@Autowired
|
||||
public BashOrgListener(DocumentationProvider documentationProvider) {
|
||||
this.registerDescription(documentationProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListenerDescription getDescription() {
|
||||
return ListenerDescription.create()
|
||||
.setModuleName("BashOrgListener")
|
||||
.setModuleDescription("Send bash.org quotes in channel on your request")
|
||||
.addCommand(CommandDescription.builder()
|
||||
.command("bash")
|
||||
.description("Send random quote from bash.org to channel")
|
||||
.example("?bash")
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessage(final MessageEvent event) throws Exception {
|
||||
|
||||
|
@ -79,7 +100,7 @@ public class BashOrgListener extends ImprovedListenerAdapter {
|
|||
|
||||
int responseCode = con.getResponseCode();
|
||||
if (responseCode != 200) {
|
||||
throw new Exception("Не удалось получить цитату!");
|
||||
throw new Exception("Could not get a random quote!");
|
||||
}
|
||||
String response = getDataFromConnection(con);
|
||||
|
||||
|
@ -87,7 +108,7 @@ public class BashOrgListener extends ImprovedListenerAdapter {
|
|||
Elements quotes = doc.select(".quote .text");
|
||||
|
||||
if (quotes.size() == 0) {
|
||||
throw new Exception("Не получено ни одной цитаты!");
|
||||
throw new Exception("Nothing was received from bash.org!");
|
||||
}
|
||||
|
||||
Element quote = quotes.get(0);
|
||||
|
|
|
@ -11,15 +11,20 @@ import ru.bvn13.jircbot.bot.JircBot;
|
|||
import ru.bvn13.jircbot.database.entities.DeferredMessage;
|
||||
import ru.bvn13.jircbot.database.services.ChannelSettingsService;
|
||||
import ru.bvn13.jircbot.database.services.DeferredMessageService;
|
||||
import ru.bvn13.jircbot.documentation.DescriptionProvided;
|
||||
import ru.bvn13.jircbot.documentation.DocumentationProvider;
|
||||
import ru.bvn13.jircbot.documentation.ListenerDescription;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
|
||||
import static ru.bvn13.jircbot.documentation.ListenerDescription.CommandDescription;
|
||||
|
||||
/**
|
||||
* Created by bvn13 on 31.01.2018.
|
||||
*/
|
||||
@Component
|
||||
public class DeferredMessagesListener extends ImprovedListenerAdapter {
|
||||
public class DeferredMessagesListener extends ImprovedListenerAdapter implements DescriptionProvided {
|
||||
|
||||
private static final String COMMAND = "?tell";
|
||||
private static final String COMMAND_FORGET = "?forget";
|
||||
|
@ -33,6 +38,37 @@ public class DeferredMessagesListener extends ImprovedListenerAdapter {
|
|||
@Autowired
|
||||
private DeferredMessageService deferredMessageService;
|
||||
|
||||
@Autowired
|
||||
public DeferredMessagesListener(DocumentationProvider documentationProvider) {
|
||||
registerDescription(documentationProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListenerDescription getDescription() {
|
||||
return ListenerDescription.create()
|
||||
.setModuleName("DeferredMessagesListener")
|
||||
.setModuleDescription("This module is like answerphone - it stores your speech to any opponent into bot's database and when your opponent becomes online (joins channel and starts to speak) the bot notice him/her with your deferred messages.")
|
||||
.addCommand(CommandDescription.builder()
|
||||
.command("tell")
|
||||
.description("Let the bot keep in mind your message to any opponent")
|
||||
.example("?tell [YOUR_FRIEND] [YOUR MESSAGE]")
|
||||
.build()
|
||||
)
|
||||
.addCommand(CommandDescription.builder()
|
||||
.command("forget")
|
||||
.description("If you do not want to read all messages deferred to you this command tells the bot do not disturb you this time")
|
||||
.example("?forget")
|
||||
.build()
|
||||
)
|
||||
.addCommand(CommandDescription.builder()
|
||||
.command("read")
|
||||
.description("Let the bot send you all the messages deferred to you this time in private dialogue")
|
||||
.example("?read")
|
||||
.build()
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onMessage(final MessageEvent event) throws Exception {
|
||||
|
|
|
@ -11,6 +11,9 @@ import org.springframework.stereotype.Component;
|
|||
import ru.bvn13.jircbot.bot.ImprovedListenerAdapter;
|
||||
import ru.bvn13.jircbot.bot.JircBot;
|
||||
import ru.bvn13.jircbot.database.services.ChannelSettingsService;
|
||||
import ru.bvn13.jircbot.documentation.DescriptionProvided;
|
||||
import ru.bvn13.jircbot.documentation.DocumentationProvider;
|
||||
import ru.bvn13.jircbot.documentation.ListenerDescription;
|
||||
import ru.bvn13.jircbot.services.InternetAccessor;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
@ -18,11 +21,14 @@ import java.net.URLDecoder;
|
|||
import java.net.URLEncoder;
|
||||
import java.util.List;
|
||||
|
||||
import static ru.bvn13.jircbot.documentation.ListenerDescription.CommandDescription;
|
||||
|
||||
|
||||
/**
|
||||
* Created by bvn13 on 06.02.2018.
|
||||
*/
|
||||
@Component
|
||||
public class GoogleSearchListener extends ImprovedListenerAdapter {
|
||||
public class GoogleSearchListener extends ImprovedListenerAdapter implements DescriptionProvided {
|
||||
|
||||
private static final String COMMAND = "?gs";
|
||||
|
||||
|
@ -32,6 +38,24 @@ public class GoogleSearchListener extends ImprovedListenerAdapter {
|
|||
@Autowired
|
||||
private ChannelSettingsService channelSettingsService;
|
||||
|
||||
@Autowired
|
||||
public GoogleSearchListener(DocumentationProvider documentationProvider) {
|
||||
this.registerDescription(documentationProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListenerDescription getDescription() {
|
||||
return ListenerDescription.create()
|
||||
.setModuleName("GoogleSearchListener")
|
||||
.setModuleDescription("Make a search in Google for you")
|
||||
.addCommand(CommandDescription.builder()
|
||||
.command("gs")
|
||||
.description("Search it")
|
||||
.example("?gs [WHAT YOU WANT TO SEARCH]")
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onMessage(final MessageEvent event) throws Exception {
|
||||
|
@ -91,5 +115,4 @@ public class GoogleSearchListener extends ImprovedListenerAdapter {
|
|||
return String.format("%s / %s / %s", URLDecoder.decode(destinationUrl, "utf-8"), linkTitle, description);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,20 +1,24 @@
|
|||
package ru.bvn13.jircbot.listeners;
|
||||
|
||||
import org.pircbotx.hooks.ListenerAdapter;
|
||||
import org.pircbotx.hooks.events.JoinEvent;
|
||||
import org.pircbotx.hooks.events.MessageEvent;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.bvn13.jircbot.bot.ImprovedListenerAdapter;
|
||||
import ru.bvn13.jircbot.bot.JircBot;
|
||||
import ru.bvn13.jircbot.database.entities.ChannelSettings;
|
||||
import ru.bvn13.jircbot.database.services.ChannelSettingsService;
|
||||
import ru.bvn13.jircbot.documentation.DescriptionProvided;
|
||||
import ru.bvn13.jircbot.documentation.DocumentationProvider;
|
||||
import ru.bvn13.jircbot.documentation.ListenerDescription;
|
||||
|
||||
import static ru.bvn13.jircbot.documentation.ListenerDescription.CommandDescription;
|
||||
|
||||
|
||||
/**
|
||||
* Created by bvn13 on 25.01.2018.
|
||||
*/
|
||||
@Component
|
||||
public class HelloOnJoinListener extends ImprovedListenerAdapter {
|
||||
public class HelloOnJoinListener extends ImprovedListenerAdapter implements DescriptionProvided {
|
||||
|
||||
@Autowired
|
||||
private ChannelSettingsService channelSettingsService;
|
||||
|
@ -35,9 +39,22 @@ public class HelloOnJoinListener extends ImprovedListenerAdapter {
|
|||
if (channelSettings.getOnJoinMessage() != null && !channelSettings.getOnJoinMessage().isEmpty()) {
|
||||
event.respond(channelSettings.getOnJoinMessage().replace("%nick%", event.getUser().getNick()));
|
||||
} else {
|
||||
event.respond("Привет, " + event.getUser().getNick() + "!");
|
||||
event.respond("Welcome, " + event.getUser().getNick() + "!");
|
||||
}
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public HelloOnJoinListener(DocumentationProvider documentationProvider) {
|
||||
registerDescription(documentationProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListenerDescription getDescription() {
|
||||
return ListenerDescription.create()
|
||||
.setModuleName("HelloOnJoinListener")
|
||||
.setModuleDescription("The bot greets everyone joining the channel\n"+
|
||||
"You can set the greeting text using <a href='/docs#AdminListener'>Admin module</a>")
|
||||
;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,34 +1,29 @@
|
|||
package ru.bvn13.jircbot.listeners;
|
||||
|
||||
import org.pircbotx.hooks.ListenerAdapter;
|
||||
import org.pircbotx.hooks.events.MessageEvent;
|
||||
import org.pircbotx.hooks.types.GenericMessageEvent;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.bvn13.jircbot.bot.ImprovedListenerAdapter;
|
||||
import ru.bvn13.jircbot.bot.JircBot;
|
||||
import ru.bvn13.jircbot.database.services.ChannelSettingsService;
|
||||
import ru.bvn13.jircbot.documentation.DescriptionProvided;
|
||||
import ru.bvn13.jircbot.documentation.DocumentationProvider;
|
||||
import ru.bvn13.jircbot.documentation.ListenerDescription;
|
||||
import ru.bvn13.jircbot.services.InternetAccessor;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLDecoder;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static java.lang.System.out;
|
||||
import static ru.bvn13.jircbot.documentation.ListenerDescription.CommandDescription;
|
||||
|
||||
/**
|
||||
* Created by bvn13 on 23.01.2018.
|
||||
*/
|
||||
@Component
|
||||
public class LinkPreviewListener extends ImprovedListenerAdapter {
|
||||
public class LinkPreviewListener extends ImprovedListenerAdapter implements DescriptionProvided {
|
||||
|
||||
@Autowired
|
||||
private InternetAccessor internetAccessor;
|
||||
|
@ -38,6 +33,20 @@ public class LinkPreviewListener extends ImprovedListenerAdapter {
|
|||
@Autowired
|
||||
private ChannelSettingsService channelSettingsService;
|
||||
|
||||
@Autowired
|
||||
public LinkPreviewListener(DocumentationProvider documentationProvider) {
|
||||
registerDescription(documentationProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListenerDescription getDescription() {
|
||||
return ListenerDescription.create()
|
||||
.setModuleName("LinkPreviewListener")
|
||||
.setModuleDescription("With this module enabled into <a href='/docs#AdminListener'>Admin module</a> the bot will send the title of every URL found in messages posted in channel")
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onMessage(final MessageEvent event) throws Exception {
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@ package ru.bvn13.jircbot.listeners;
|
|||
|
||||
import org.pircbotx.hooks.Event;
|
||||
import org.pircbotx.hooks.events.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.bvn13.jircbot.bot.ImprovedListenerAdapter;
|
||||
|
@ -11,14 +9,20 @@ import ru.bvn13.jircbot.bot.JircBot;
|
|||
import ru.bvn13.jircbot.database.entities.IrcMessage;
|
||||
import ru.bvn13.jircbot.database.services.ChannelSettingsService;
|
||||
import ru.bvn13.jircbot.database.services.IrcMessageService;
|
||||
import ru.bvn13.jircbot.documentation.DescriptionProvided;
|
||||
import ru.bvn13.jircbot.documentation.DocumentationProvider;
|
||||
import ru.bvn13.jircbot.documentation.ListenerDescription;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static ru.bvn13.jircbot.documentation.ListenerDescription.CommandDescription;
|
||||
|
||||
|
||||
/**
|
||||
* Created by bvn13 on 10.03.2018.
|
||||
*/
|
||||
@Component
|
||||
public class LoggerListener extends ImprovedListenerAdapter {
|
||||
public class LoggerListener extends ImprovedListenerAdapter implements DescriptionProvided {
|
||||
|
||||
|
||||
@Autowired
|
||||
|
@ -29,7 +33,18 @@ public class LoggerListener extends ImprovedListenerAdapter {
|
|||
|
||||
private Map<String, Set<String>> onlineUsers = new HashMap<>();
|
||||
|
||||
@Autowired
|
||||
public LoggerListener(DocumentationProvider documentationProvider) {
|
||||
registerDescription(documentationProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListenerDescription getDescription() {
|
||||
return ListenerDescription.create()
|
||||
.setModuleName("LoggerListener")
|
||||
.setModuleDescription("This module logs all the messages into database for being able to observe in Web")
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
public boolean isEnabled(Event event) throws Exception {
|
||||
|
|
|
@ -2,11 +2,16 @@ package ru.bvn13.jircbot.listeners;
|
|||
|
||||
import org.pircbotx.hooks.ListenerAdapter;
|
||||
import org.pircbotx.hooks.events.MessageEvent;
|
||||
import org.pircbotx.hooks.types.GenericMessageEvent;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.bvn13.jircbot.documentation.DescriptionProvided;
|
||||
import ru.bvn13.jircbot.documentation.DocumentationProvider;
|
||||
import ru.bvn13.jircbot.documentation.ListenerDescription;
|
||||
|
||||
import static ru.bvn13.jircbot.documentation.ListenerDescription.CommandDescription;
|
||||
|
||||
@Component
|
||||
public class PingPongListener extends ListenerAdapter {
|
||||
public class PingPongListener extends ListenerAdapter implements DescriptionProvided {
|
||||
|
||||
private static final String COMMAND = "?ping";
|
||||
|
||||
|
@ -25,4 +30,22 @@ public class PingPongListener extends ListenerAdapter {
|
|||
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public PingPongListener(DocumentationProvider documentationProvider) {
|
||||
registerDescription(documentationProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListenerDescription getDescription() {
|
||||
return ListenerDescription.create()
|
||||
.setModuleName("PingPongListener")
|
||||
.setModuleDescription("Try to play ping-pong if you not aware of is the bot here")
|
||||
.addCommand(CommandDescription.builder()
|
||||
.command("ping")
|
||||
.description("Returns pong")
|
||||
.example("?ping")
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,22 +1,26 @@
|
|||
package ru.bvn13.jircbot.listeners;
|
||||
|
||||
import org.pircbotx.hooks.ListenerAdapter;
|
||||
import org.pircbotx.hooks.WaitForQueue;
|
||||
import org.pircbotx.hooks.events.MessageEvent;
|
||||
import org.pircbotx.hooks.types.GenericMessageEvent;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.bvn13.jircbot.bot.ImprovedListenerAdapter;
|
||||
import ru.bvn13.jircbot.bot.JircBot;
|
||||
import ru.bvn13.jircbot.database.services.ChannelSettingsService;
|
||||
import ru.bvn13.jircbot.documentation.DescriptionProvided;
|
||||
import ru.bvn13.jircbot.documentation.DocumentationProvider;
|
||||
import ru.bvn13.jircbot.documentation.ListenerDescription;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static ru.bvn13.jircbot.documentation.ListenerDescription.CommandDescription;
|
||||
|
||||
|
||||
@Component
|
||||
public class RegexCheckerListener extends ImprovedListenerAdapter {
|
||||
public class RegexCheckerListener extends ImprovedListenerAdapter implements DescriptionProvided {
|
||||
|
||||
private static final String COMMAND = "?regex ";
|
||||
|
||||
|
@ -25,6 +29,24 @@ public class RegexCheckerListener extends ImprovedListenerAdapter {
|
|||
@Autowired
|
||||
private ChannelSettingsService channelSettingsService;
|
||||
|
||||
@Autowired
|
||||
public RegexCheckerListener(DocumentationProvider documentationProvider) {
|
||||
registerDescription(documentationProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListenerDescription getDescription() {
|
||||
return ListenerDescription.create()
|
||||
.setModuleName("RegexCheckerListener")
|
||||
.setModuleDescription("")
|
||||
.addCommand(CommandDescription.builder()
|
||||
.command("regex")
|
||||
.description("Checks if given message with given regular expression")
|
||||
.example("?regex")
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessage(final MessageEvent event) throws Exception {
|
||||
|
||||
|
|
|
@ -4,21 +4,25 @@ import org.pircbotx.hooks.events.MessageEvent;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.bvn13.jircbot.bot.ImprovedListenerAdapter;
|
||||
import ru.bvn13.jircbot.bot.JircBot;
|
||||
import ru.bvn13.jircbot.database.entities.dto.StatisticsDTO;
|
||||
import ru.bvn13.jircbot.database.services.IrcMessageService;
|
||||
import ru.bvn13.jircbot.documentation.DescriptionProvided;
|
||||
import ru.bvn13.jircbot.documentation.DocumentationProvider;
|
||||
import ru.bvn13.jircbot.documentation.ListenerDescription;
|
||||
import ru.bvn13.jircbot.utilities.DateTimeUtility;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static ru.bvn13.jircbot.documentation.ListenerDescription.CommandDescription;
|
||||
|
||||
|
||||
/**
|
||||
* Created by bvn13 on 11.04.2018.
|
||||
*/
|
||||
@Component
|
||||
public class StatisticsListener extends ImprovedListenerAdapter {
|
||||
public class StatisticsListener extends ImprovedListenerAdapter implements DescriptionProvided {
|
||||
|
||||
private static final String COMMAND = "?stats";
|
||||
|
||||
|
@ -30,6 +34,24 @@ public class StatisticsListener extends ImprovedListenerAdapter {
|
|||
@Autowired
|
||||
private IrcMessageService ircMessageService;
|
||||
|
||||
@Autowired
|
||||
public StatisticsListener(DocumentationProvider documentationProvider) {
|
||||
registerDescription(documentationProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListenerDescription getDescription() {
|
||||
return ListenerDescription.create()
|
||||
.setModuleName("StatisticsListener")
|
||||
.setModuleDescription("")
|
||||
.addCommand(CommandDescription.builder()
|
||||
.command("stats")
|
||||
.description("Provides statistics for channel")
|
||||
.example("?stats [D(ay)|M(onth)|Y(ear)|A(ll)] [ALL]")
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessage(MessageEvent event) throws Exception {
|
||||
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
package ru.bvn13.jircbot.web.controllers;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import ru.bvn13.jircbot.documentation.DocumentationProvider;
|
||||
|
||||
/**
|
||||
* Created by bvn13 on 28.10.2018.
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/docs")
|
||||
public class DocumentationController {
|
||||
|
||||
@Autowired
|
||||
private DocumentationProvider documentationProvider;
|
||||
|
||||
@GetMapping
|
||||
public String get(Model model) {
|
||||
|
||||
model.addAttribute("modules", documentationProvider.getModuleNames());
|
||||
model.addAttribute("descriptions", documentationProvider.getDescriptors());
|
||||
|
||||
return "documentation";
|
||||
}
|
||||
|
||||
}
|
|
@ -32,4 +32,6 @@ spring.jpa.show-sql=false
|
|||
spring.jpa.properties.hibernate.use_sql_comments=true
|
||||
spring.jpa.properties.hibernate.format_sql=true
|
||||
|
||||
|
||||
#hot restart
|
||||
#spring.devtools.restart.additional-paths=resources/
|
||||
spring.devtools.restart.additional-exclude=templates/**
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<title>JIrcBot documentation</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>JIrcBot documentation</h1>
|
||||
|
||||
<h4>view project sources at <a href="https://github.com/bvn13/jircbot">GitHub repo</a></h4>
|
||||
|
||||
<hr/>
|
||||
|
||||
<th:block th:each="module : ${modules}">
|
||||
<div th:with="provider=${descriptions.get(module)}">
|
||||
<h3 th:id="${module}">MODULE: <span th:text="${module}"></span></h3>
|
||||
<p>
|
||||
<i>
|
||||
<span th:utext="${provider.description.moduleDescription.replaceAll('\n', '<br/>')}"></span>
|
||||
</i>
|
||||
</p>
|
||||
|
||||
<p>COMMANDS:</p>
|
||||
|
||||
<ol>
|
||||
<th:block th:each="commandName : ${provider.description.commandNames}">
|
||||
<li th:with="command=${provider.description.getCommandDescription(commandName)}">
|
||||
<p>
|
||||
<b>
|
||||
<span th:text="${command.command}"></span>
|
||||
</b>
|
||||
</p>
|
||||
<p>
|
||||
Description: <span th:utext="${command.description.replaceAll('\n', '<br/>')}"></span>
|
||||
</p>
|
||||
<p><b>
|
||||
Example: <span th:utext="${command.example.replaceAll('\n', '<br/>')}"></span>
|
||||
</b></p>
|
||||
</li>
|
||||
</th:block>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
</th:block>
|
||||
|
||||
<p>
|
||||
(c) bvn13<br/>
|
||||
powered with PircBotX
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue