Compare commits

...

107 Commits

Author SHA1 Message Date
89321c9203 doc(build): add instructions 2021-12-31 12:01:12 +01:00
4f7f9902e8 doc(build): add instructions 2021-12-31 11:59:42 +01:00
13abc16e41 Build 2.11.7 2021-12-31 11:53:21 +01:00
fbd6543aa2 Build 2.11.5 2021-05-08 05:36:27 +02:00
959d947563 Added alexandrie hook. 2021-05-08 05:36:02 +02:00
d0bedf3d31 Added !help hebdobot feature. 2021-05-08 05:26:42 +02:00
ba417d60d8 Improved wording about GNU AGPLv3+. 2021-04-21 19:09:42 +02:00
e04bfdcf84 Build 2.11.4 2021-04-21 16:27:07 +02:00
8b3784e7d5 Fixed wording. 2021-04-21 16:18:52 +02:00
5f449b66e5 Replaced foo in displayed messages (#5348). 2021-04-21 16:12:03 +02:00
03103efa35 Build 2.11.3 2021-04-19 04:56:08 +02:00
ef22bbc593 Fixed private messages feature. 2021-04-19 04:32:47 +02:00
d00ba4c40a Made Javadoc review. 2021-04-18 03:17:44 +02:00
9f0e09b8e6 Build 2.11.2 2021-04-18 03:16:16 +02:00
31bca36d49 Improved !help feature. 2021-04-18 01:25:59 +02:00
cbdef8e674 Improved exception management about connection. 2021-04-17 22:12:35 +02:00
483732382b Improved typography. 2021-04-17 22:12:07 +02:00
925bc0a805 Added !anniv feature (#5343). 2021-04-17 22:08:55 +02:00
d709328666 Improved !help feature. 2021-04-17 19:53:05 +02:00
54669590ab Improved !help message. 2021-04-16 19:35:37 +02:00
66bb09ef87 Simplified !chrono message. 2021-04-16 19:29:06 +02:00
f5da3a6ae4 Fixed typography in chrono messages. 2021-04-16 19:26:25 +02:00
534d335df1 Improve wording for !licence. 2021-04-16 19:25:33 +02:00
216db84883 Remove starting % in !record message. 2021-04-16 19:20:48 +02:00
47fd4b58e8 Improved !chrono feature. 2021-04-16 18:04:28 +02:00
c469fd5c7b Modified label in synthese. 2021-04-16 10:51:58 +02:00
4382db9e8b Build 2.11.1 2021-04-15 00:15:04 +02:00
de0d8a4d5e Fixed !oups feature. Improved stats display. 2021-04-15 00:13:33 +02:00
58d8bcc3a8 Added review anniversary feature. 2021-04-15 00:11:46 +02:00
caba69fc75 Improved stats command. 2021-04-14 21:51:03 +02:00
cd319dbacc Improved !oops command. Improved stats. 2021-04-14 19:36:58 +02:00
b5fd23533f Improved !oops command (#3726). 2021-04-13 20:23:48 +02:00
03e346554f Fixed connexion exception retry (#5261). 2021-04-13 20:19:06 +02:00
9a3bf64417 Fixed missing trim of commands (#5316). 2021-04-09 16:41:39 +02:00
8e51e5c25b Added message on cancelprevious command. 2021-04-09 03:24:44 +02:00
6fb712ed18 Build 2.11.0 2021-04-09 03:19:53 +02:00
c2aeedced2 Fixed Java version check in build script. 2021-04-09 03:19:32 +02:00
44b1865a9b Improved label. 2021-04-09 03:16:14 +02:00
853852751f Fixed cancelprevious feature. 2021-04-09 03:09:57 +02:00
d110c2168e Fixed naming. 2021-04-09 02:54:18 +02:00
f3a9bfc465 Reset build num value. 2021-04-09 01:21:43 +02:00
4d9a09b0e1 Removed Pastebin code (replaced by Privatebin code). 2021-04-09 01:20:20 +02:00
b5cfa87aa9 Migrated build and configuration file to Privatebin. 2021-04-09 01:19:21 +02:00
9e2743368b Made code review. 2021-04-09 01:14:19 +02:00
c4e904a7a9 Improved log. Added test file. 2021-04-09 01:07:09 +02:00
9526609196 Replaced Pastebin with Privatebin. 2021-04-09 00:49:18 +02:00
7cc73c9a4e Increased minor version with Java 11 and PrivateBin feature. 2021-04-06 19:30:00 +02:00
dfaac4e407 Added PrivateBin feature. 2021-04-06 19:22:18 +02:00
8696ed665c Migrated to Java 11. 2021-04-06 12:29:59 +02:00
c731c9413c Added time keeper feature. 2021-01-30 23:48:08 +01:00
12fe4ede50 Added cancel previous input hook. 2021-01-30 20:12:01 +01:00
77d501937a Added Antoine Bardelli work about « Pizza chacune chez soi ». 2020-04-10 12:24:44 +02:00
f97607b91e Renamed image folder. 2020-04-10 03:58:51 +02:00
94b2b35870 Added *~ in gitignore file. 2020-04-03 15:03:17 +02:00
33c8617fcf Removed unuseful file. 2020-04-03 15:02:09 +02:00
f645c86fe4 Added pizza photos. 2020-04-03 15:00:30 +02:00
3a4980d3e2 Updated official repository URL. 2020-03-11 01:37:02 +01:00
2c42afdcc3 Made markdown review. 2020-02-26 00:23:42 +01:00
06516acdaa Added logo and README.md file. 2020-02-26 00:18:45 +01:00
81eaaaee76 Improved wording. 2019-06-09 16:09:35 +02:00
fb2eb0772d Fixed Javadoc. 2019-05-03 17:35:06 +02:00
1799500b0f Build 2.0.19 2019-05-03 17:34:04 +02:00
a9057039c4 Restricted the use of !debut command when review is already started
(#3689).
2019-05-03 16:19:31 +02:00
29e878a02a Restricted the use of the !stop command to the review owner (#3688). 2019-05-03 16:02:02 +02:00
b7be0fae07 Build 2.0.18 2019-05-03 15:07:11 +02:00
8c5b3486ab Fixed default list in missing command. 2019-05-03 14:51:17 +02:00
ddddfd55bc Made code review. 2019-05-03 12:38:26 +02:00
cf090c021e Fixed number suffix as in french typography (è -> e). 2019-05-03 12:29:07 +02:00
8346f211f9 Refactored tests. 2019-05-03 12:26:34 +02:00
90c739ed07 Improved missing command message (#3415). Improved code and typography. 2019-05-02 18:46:18 +02:00
d02e12e1da Improved message in missing hook (#3431). 2019-05-02 15:42:47 +02:00
18bd91eec2 Fixed suffix in number display (#3541). Added record command. 2019-05-02 13:30:39 +02:00
680b2b56d8 Updated header date. 2019-05-02 13:11:17 +02:00
2c37b9ab0a Improved code. 2019-05-02 13:09:20 +02:00
96a37bf770 Fixed inverted value. 2019-05-02 13:07:30 +02:00
a1dfbcc896 Added !start command as !debut alias. 2019-05-02 13:05:36 +02:00
dbbb9da4d6 Improved code. 2019-05-02 12:50:29 +02:00
935bdeed07 Fixed missing review stats writing (#3487). 2019-05-02 12:26:07 +02:00
7bc6a415f6 Improved wording. 2019-05-02 04:05:39 +02:00
3058ffe587 Improved label in help command display. 2018-11-07 17:27:43 +01:00
1f3b2accbd Fixed license header file (mistake on project name). 2018-11-07 14:01:47 +01:00
8660574211 Build 2.0.17 2018-10-03 14:55:21 +02:00
880e1d44b6 Added IRC NickServ identify feature. 2018-10-03 01:43:19 +02:00
42b6faaa5c Build 2.0.16 2018-09-25 23:01:41 +02:00
95c12449d1 Improved review reporter code. 2018-09-25 22:57:22 +02:00
1e8f06f373 Refactored finish review action. 2018-09-25 02:42:42 +02:00
f11dd169d7 Improved and fixed hooks. 2018-09-22 11:50:59 +02:00
d52d358984 Reversed copyright line order (because it will be easier to detect
un-updated headers).
2018-09-21 22:29:51 +02:00
1cd73061e7 Improved cron management. 2018-09-21 22:16:09 +02:00
d2a1f6b340 Fixed minor key mistake. 2018-09-21 18:34:42 +02:00
f2f9bceae5 Refactored onMessage code with hook management. 2018-09-21 01:04:12 +02:00
6640dc9853 Upgrade commons-lang library. 2018-09-20 18:36:16 +02:00
1524774eb7 Rename model package as bot. 2018-09-20 18:25:29 +02:00
bca2565ea9 Build 2.0.15 2018-06-13 14:40:42 +02:00
bfc81614a9 Improved final message order (#2897). 2018-06-13 14:39:58 +02:00
59fb949d02 Build 2.0.14 2018-06-13 14:33:43 +02:00
561fb4ce02 Improved final message order (#2897). 2018-06-13 14:33:04 +02:00
0467fdb1dd Build 2.0.13 2018-06-13 14:19:59 +02:00
a72713d36c Added stats help in !help command display (#2910). 2018-06-13 14:19:20 +02:00
599f04e7dd Build 2.0.12 2018-06-13 13:33:51 +02:00
7651c66c54 Improved statistics message display (#2910). 2018-06-13 13:23:41 +02:00
9a18bea228 Changed IRC target user of complex statistics from all to review owner. 2018-06-13 11:07:32 +02:00
c87cbe2059 Fixed statistic type. 2018-06-13 10:24:51 +02:00
fb2dd10a46 Build 2.0.11 2018-06-12 13:30:14 +02:00
1eab79954c Upgraded library jars. 2018-06-12 11:13:10 +02:00
2d5c6d025c Improved naming. 2018-05-25 13:31:59 +02:00
ed13715e60 Improved facet configuration. 2018-05-24 15:01:41 +02:00
142 changed files with 7769 additions and 2880 deletions

View File

@ -12,16 +12,18 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<attributes>
<attribute name="module" value="true"/>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/Logs/log4j-1.2.17.jar"/> <classpathentry kind="lib" path="lib/Logs/log4j-1.2.17.jar"/>
<classpathentry kind="lib" path="lib/Logs/slf4j-api-1.7.5.jar"/>
<classpathentry kind="lib" path="lib/Logs/slf4j-log4j12-1.7.5.jar"/>
<classpathentry kind="lib" path="lib/UnitTesting/hamcrest-core-1.3.jar"/> <classpathentry kind="lib" path="lib/UnitTesting/hamcrest-core-1.3.jar"/>
<classpathentry kind="lib" path="lib/UnitTesting/junit-4.11.jar"/>
<classpathentry kind="lib" path="lib/commons-cli-1.4.jar"/> <classpathentry kind="lib" path="lib/commons-cli-1.4.jar"/>
<classpathentry kind="lib" path="lib/commons-codec-1.4.jar"/> <classpathentry kind="lib" path="lib/commons-codec-1.4.jar"/>
<classpathentry kind="lib" path="lib/commons-collections-3.2.1.jar"/> <classpathentry kind="lib" path="lib/commons-collections-3.2.1.jar"/>
<classpathentry kind="lib" path="lib/commons-io-2.5.jar" sourcepath="lib/commons-io-2.5-src.jar"/> <classpathentry kind="lib" path="lib/commons-io-2.5.jar" sourcepath="lib/commons-io-2.5-src.jar"/>
<classpathentry kind="lib" path="lib/commons-lang3-3.4.jar" sourcepath="lib/commons-lang3-3.4-src.jar"/>
<classpathentry kind="lib" path="lib/commons-logging-1.1.1.jar"/> <classpathentry kind="lib" path="lib/commons-logging-1.1.1.jar"/>
<classpathentry kind="lib" path="lib/httpclient-4.5.jar"/> <classpathentry kind="lib" path="lib/httpclient-4.5.jar"/>
<classpathentry kind="lib" path="lib/httpcore-4.4.1.jar"/> <classpathentry kind="lib" path="lib/httpcore-4.4.1.jar"/>
@ -29,15 +31,15 @@
<classpathentry kind="lib" path="lib/pircbot-1.5.0.jar" sourcepath="lib/pircbot-1.5.0-sources.zip"/> <classpathentry kind="lib" path="lib/pircbot-1.5.0.jar" sourcepath="lib/pircbot-1.5.0-sources.zip"/>
<classpathentry kind="lib" path="lib/scribe-1.3.7.jar"/> <classpathentry kind="lib" path="lib/scribe-1.3.7.jar"/>
<classpathentry kind="lib" path="lib/quartz-2.2.3.jar" sourcepath="lib/quartz-2.2.3-source.zip"/> <classpathentry kind="lib" path="lib/quartz-2.2.3.jar" sourcepath="lib/quartz-2.2.3-source.zip"/>
<classpathentry kind="lib" path="lib/devinsy-strings-0.4.4.jar" sourcepath="lib/devinsy-strings-0.4.4-sources.zip"/>
<classpathentry kind="lib" path="lib/twitter4j-async-4.0.4.jar" sourcepath="lib/twitter4j-async-4.0.4-src.zip"/> <classpathentry kind="lib" path="lib/twitter4j-async-4.0.4.jar" sourcepath="lib/twitter4j-async-4.0.4-src.zip"/>
<classpathentry kind="lib" path="lib/twitter4j-core-4.0.4.jar" sourcepath="lib/twitter4j-core-4.0.4-src.zip"/> <classpathentry kind="lib" path="lib/twitter4j-core-4.0.4.jar" sourcepath="lib/twitter4j-core-4.0.4-src.zip"/>
<classpathentry kind="lib" path="lib/twitter4j-media-support-4.0.4.jar" sourcepath="lib/twitter4j-media-support-4.0.4-src.zip"/> <classpathentry kind="lib" path="lib/twitter4j-media-support-4.0.4.jar" sourcepath="lib/twitter4j-media-support-4.0.4-src.zip"/>
<classpathentry kind="lib" path="lib/twitter4j-stream-4.0.4.jar" sourcepath="lib/twitter4j-stream-4.0.4-src.zip"/> <classpathentry kind="lib" path="lib/twitter4j-stream-4.0.4.jar" sourcepath="lib/twitter4j-stream-4.0.4-src.zip"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> <classpathentry kind="lib" path="lib/Logs/slf4j-api-1.7.25.jar" sourcepath="lib/Logs/slf4j-api-1.7.25-sources.jar"/>
<attributes> <classpathentry kind="lib" path="lib/Logs/slf4j-log4j12-1.7.25.jar" sourcepath="lib/Logs/slf4j-log4j12-1.7.25-sources.jar"/>
<attribute name="maven.pomderived" value="true"/> <classpathentry kind="lib" path="lib/UnitTesting/junit-4.12.jar" sourcepath="lib/UnitTesting/junit-4.12-sources.jar"/>
</attributes> <classpathentry kind="lib" path="lib/devinsy-strings-0.8.2.jar" sourcepath="lib/devinsy-strings-0.8.2-sources.zip"/>
</classpathentry> <classpathentry kind="lib" path="lib/commons-lang3-3.8.jar" sourcepath="lib/commons-lang3-3.8-sources.jar"/>
<classpathentry kind="lib" path="lib/json-simple-1.1.1.jar" sourcepath="lib/json-simple-1.1.1-source.zip"/>
<classpathentry kind="output" path="target/classes"/> <classpathentry kind="output" path="target/classes"/>
</classpath> </classpath>

1
.gitignore vendored
View File

@ -4,3 +4,4 @@
/bin/ /bin/
/dist/ /dist/
/build/ /build/
*~

View File

@ -17,9 +17,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@ -33,6 +33,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
@ -76,6 +77,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=igno
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
@ -108,8 +110,10 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.8 org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
@ -117,17 +121,20 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_assignment=0
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=49 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=49
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
@ -213,11 +220,12 @@ org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
@ -248,6 +256,8 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
@ -272,13 +282,17 @@ org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
@ -326,6 +340,8 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do no
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
@ -362,9 +378,12 @@ org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not inser
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
@ -390,7 +409,11 @@ org.eclipse.jdt.core.formatter.tabulation.char=space
org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true
org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true
org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true
org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter

View File

@ -13,28 +13,38 @@ cleanup.always_use_this_for_non_static_field_access=true
cleanup.always_use_this_for_non_static_method_access=false cleanup.always_use_this_for_non_static_method_access=false
cleanup.convert_functional_interfaces=false cleanup.convert_functional_interfaces=false
cleanup.convert_to_enhanced_for_loop=false cleanup.convert_to_enhanced_for_loop=false
cleanup.convert_to_enhanced_for_loop_if_loop_var_used=false
cleanup.correct_indentation=false cleanup.correct_indentation=false
cleanup.format_source_code=true cleanup.format_source_code=true
cleanup.format_source_code_changes_only=false cleanup.format_source_code_changes_only=false
cleanup.insert_inferred_type_arguments=false cleanup.insert_inferred_type_arguments=false
cleanup.lazy_logical_operator=false
cleanup.make_local_variable_final=false cleanup.make_local_variable_final=false
cleanup.make_parameters_final=true cleanup.make_parameters_final=true
cleanup.make_private_fields_final=false cleanup.make_private_fields_final=false
cleanup.make_type_abstract_if_missing_method=false cleanup.make_type_abstract_if_missing_method=false
cleanup.make_variable_declarations_final=true cleanup.make_variable_declarations_final=true
cleanup.merge_conditional_blocks=false
cleanup.never_use_blocks=false cleanup.never_use_blocks=false
cleanup.never_use_parentheses_in_expressions=true cleanup.never_use_parentheses_in_expressions=true
cleanup.number_suffix=false
cleanup.objects_equals=false
cleanup.organize_imports=false cleanup.organize_imports=false
cleanup.precompile_regex=false
cleanup.push_down_negation=false
cleanup.qualify_static_field_accesses_with_declaring_class=false cleanup.qualify_static_field_accesses_with_declaring_class=false
cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
cleanup.qualify_static_member_accesses_with_declaring_class=true cleanup.qualify_static_member_accesses_with_declaring_class=true
cleanup.qualify_static_method_accesses_with_declaring_class=false cleanup.qualify_static_method_accesses_with_declaring_class=false
cleanup.remove_private_constructors=true cleanup.remove_private_constructors=true
cleanup.remove_redundant_type_arguments=true cleanup.remove_redundant_modifiers=false
cleanup.remove_redundant_semicolons=false
cleanup.remove_redundant_type_arguments=false
cleanup.remove_trailing_whitespaces=true cleanup.remove_trailing_whitespaces=true
cleanup.remove_trailing_whitespaces_all=true cleanup.remove_trailing_whitespaces_all=true
cleanup.remove_trailing_whitespaces_ignore_empty=false cleanup.remove_trailing_whitespaces_ignore_empty=false
cleanup.remove_unnecessary_array_creation=false
cleanup.remove_unnecessary_casts=true cleanup.remove_unnecessary_casts=true
cleanup.remove_unnecessary_nls_tags=true cleanup.remove_unnecessary_nls_tags=true
cleanup.remove_unused_imports=true cleanup.remove_unused_imports=true
@ -43,11 +53,14 @@ cleanup.remove_unused_private_fields=true
cleanup.remove_unused_private_members=false cleanup.remove_unused_private_members=false
cleanup.remove_unused_private_methods=true cleanup.remove_unused_private_methods=true
cleanup.remove_unused_private_types=true cleanup.remove_unused_private_types=true
cleanup.simplify_lambda_expression_and_method_ref=false
cleanup.sort_members=true cleanup.sort_members=true
cleanup.sort_members_all=false cleanup.sort_members_all=false
cleanup.use_anonymous_class_creation=false cleanup.use_anonymous_class_creation=false
cleanup.use_autoboxing=false
cleanup.use_blocks=true cleanup.use_blocks=true
cleanup.use_blocks_only_for_return_and_throw=false cleanup.use_blocks_only_for_return_and_throw=false
cleanup.use_directly_map_method=false
cleanup.use_lambda=true cleanup.use_lambda=true
cleanup.use_parentheses_in_expressions=false cleanup.use_parentheses_in_expressions=false
cleanup.use_this_for_non_static_field_access=true cleanup.use_this_for_non_static_field_access=true
@ -55,6 +68,8 @@ cleanup.use_this_for_non_static_field_access_only_if_necessary=false
cleanup.use_this_for_non_static_method_access=false cleanup.use_this_for_non_static_method_access=false
cleanup.use_this_for_non_static_method_access_only_if_necessary=true cleanup.use_this_for_non_static_method_access_only_if_necessary=true
cleanup.use_type_arguments=false cleanup.use_type_arguments=false
cleanup.use_unboxing=false
cleanup.use_var=false
cleanup_profile=_Hebdobot cleanup_profile=_Hebdobot
cleanup_settings_version=2 cleanup_settings_version=2
eclipse.preferences.version=1 eclipse.preferences.version=1
@ -62,6 +77,7 @@ editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_Hebdobot formatter_profile=_Hebdobot
formatter_settings_version=12 formatter_settings_version=12
jautodoc.cleanup.add_header=false jautodoc.cleanup.add_header=false
jautodoc.cleanup.javadoc=false
jautodoc.cleanup.replace_header=false jautodoc.cleanup.replace_header=false
org.eclipse.jdt.ui.exception.name=exception org.eclipse.jdt.ui.exception.name=exception
org.eclipse.jdt.ui.gettersetter.use.is=true org.eclipse.jdt.ui.gettersetter.use.is=true

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<faceted-project> <faceted-project>
<runtime name="jdk1.8.0_92"/> <installed facet="java" version="11"/>
<installed facet="java" version="1.8"/>
</faceted-project> </faceted-project>

View File

@ -1,6 +1,6 @@
* Changed license from GNU GPL v3 to GNU AGPL v3. * Changed license from GNU GPL v3 to GNU AGPL v3+.
Le 08/01/2018 à 01:07, aeris a écrit : Le 08/01/2018 à 01:07, aeris a écrit :
> From: aeris <aeris@imirhil.fr> > From: aeris <aeris@imirhil.fr>
@ -32,5 +32,5 @@ Le 08/01/2018 à 01:07, aeris a écrit :
* change Java version to 1.8 * change Java version to 1.8
* anonymized Twitter API key * anonymized Twitter API key
* eplaced Maven with Ant * replaced Maven with Ant
* no more code injection * no more code injection

62
README.md Normal file
View File

@ -0,0 +1,62 @@
# Hebdobot
Hebdobot est le bot de gestion de la revue hebdomadaire de l'April.
Présentation de la revue hebdomadaire : https://www.april.org/revues-hebdomadaires-april
La revue hebdo dispose d'un bot IRC qui gère les logs et la synthèse de la revue hebdo : Hebdobot.
Hebdobot est un logiciel libre sous licence GNU AGPLv3+ édité par l'April dont le projet est géré ici : https://agir.april.org/projects/hebdobot.
Résultat de la commande !aide :
```
15:26 <Hebdobot> Bienvenue cpm_screen
15:26 <Hebdobot> Je suis Hebdobot-dev, le robot de gestion des revues hebdomadaires de l'APRIL.
15:26 <Hebdobot> Voici les commandes que je comprends :
15:26 <Hebdobot>
15:26 <Hebdobot> !aide,!help : afficher cette aide
15:26 <Hebdobot> !début : commencer une nouvelle revue
15:26 <Hebdobot> # titre : démarrer un sujet individuel
15:26 <Hebdobot> ## titre : démarrer un sujet collectif
15:26 <Hebdobot> % message : traiter comme un commentaire
15:26 <Hebdobot> !courant : afficher le sujet en cours
15:26 <Hebdobot> !manquants : afficher qui n'a pas participé sur le dernier sujet
15:26 <Hebdobot> !fin : terminer la revue en cours
15:26 <Hebdobot> !stop : abandonner la revue en cours
15:26 <Hebdobot> !licence : afficher la licence du logiciel Hebdobot et le lien vers ses sources
15:26 <Hebdobot> !record : affiche le record de participation à la revue
15:26 <Hebdobot> !stats : statistiques sur les précédentes revues
15:26 <Hebdobot> !version : afficher la version d'Hebdobot
15:26 <Hebdobot>
15:26 <Hebdobot> Autres commandes de dialogue : !bonjour, !date, !hello, !merci, !salut
```
À la fin de la revue, une synthèse est accessible via un site de pastes et des statistiques de la revue sont affichées.
## Build
### Dépendances
```bash
apt install ant default-jdk
```
### Build
```bash
./build.sh
```
## License
Hebdobot is a free software released on GNU AGPLv3+
## Logo
The currently cute logo is "Kids ABC Letter H" by "X posid" released on CC0 Public Domain license.
Location: hebdobot/resources/logo/
Source: https://www.publicdomainpictures.net/en/view-image.php?image=154863&picture=kids-abc-letter-h

View File

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit! #Build Number for ANT. Do not edit!
#Sat May 19 15:38:35 CEST 2018 #Fri Dec 31 11:53:11 CET 2021
build.number=11 build.number=8

View File

@ -1,3 +1,3 @@
product.name=hebdobot product.name=hebdobot
product.revision.major=2 product.revision.major=2
product.revision.minor=0 product.revision.minor=11

View File

@ -41,11 +41,11 @@ function build_snapshot
# Java version check. # Java version check.
javaVersionCheck=`javac -version 2>&1` javaVersionCheck=`javac -version 2>&1`
if [[ "$javaVersionCheck" =~ ^.*\ 1.8 ]]; then if [[ "$javaVersionCheck" =~ ^.*\ 11. ]]; then
echo "Java 8 version requirement..... OK" echo "Java 11 version requirement..... OK"
let "okCount+=1" let "okCount+=1"
else else
echo "Java 8 version requirement..... MISSING" echo "Java 11 version requirement..... MISSING"
fi fi
if [ "$okCount" == 3 ]; then if [ "$okCount" == 3 ]; then
@ -83,11 +83,11 @@ function build_local
# Java version check. # Java version check.
javaVersionCheck=`javac -version 2>&1` javaVersionCheck=`javac -version 2>&1`
if [[ "$javaVersionCheck" =~ ^.*\ 1.8 ]]; then if [[ "$javaVersionCheck" =~ ^.*\ 11. ]]; then
echo "Java 8 version requirement..... OK" echo "Java 11 version requirement..... OK"
let "okCount+=1" let "okCount+=1"
else else
echo "Java 8 version requirement..... MISSING" echo "Java 11 version requirement..... MISSING"
fi fi
if [ "$okCount" == 3 ]; then if [ "$okCount" == 3 ]; then
@ -125,11 +125,11 @@ function build_tagandpush
# Java version check. # Java version check.
javaVersionCheck=`javac -version 2>&1` javaVersionCheck=`javac -version 2>&1`
if [[ "$javaVersionCheck" =~ ^.*\ 1.8 ]]; then if [[ "$javaVersionCheck" =~ ^.*\ 11. ]]; then
echo "Java 8 version requirement..... OK" echo "Java 11 version requirement..... OK"
let "okCount+=1" let "okCount+=1"
else else
echo "Java 8 version requirement..... MISSING" echo "Java 11 version requirement..... MISSING"
fi fi
# Git check. # Git check.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/commons-lang3-3.8.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/json-simple-1.1.1.jar Normal file

Binary file not shown.

View File

@ -12,9 +12,11 @@ irc.host=irc.freenode.org
irc.port=6667 irc.port=6667
irc.name=Hebdobot irc.name=Hebdobot
irc.channel=#april-test irc.channel=#april-test
irc.identify.nick=
irc.identify.password=
# Pastebin settings. # Privatebin settings.
#pastebin.apiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX #privatebin.url=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# Twitter settings. # Twitter settings.
#twitter.consumerKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX #twitter.consumerKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
@ -37,7 +39,7 @@ irc.channel=#april-test
notify.at15.cron=0 45 11 ? * * notify.at15.cron=0 45 11 ? * *
notify.at15.irc=Revue hebdomadaire dans 15 minutes notify.at15.irc=Revue hebdomadaire dans 15 minutes
notify.at15.twitter=Revue hebdomadaire April à 12h sur notre salon : http://april.org/salon-irc-de-lapril\nCette revue ne dure qu\'une quinzaine de minutes et permet d\'avoir une idée des actions en cours et à venir.\nVous pouvez aussi juste nous faire un coucou. Et ça met en appétit :) notify.at15.twitter=Revue hebdomadaire April à 12h sur notre salon : http://april.org/salon-irc-de-lapril\nCette revue ne dure qu\'une quinzaine de minutes et permet d\'avoir une idée des actions en cours et à venir.\nVous pouvez aussi juste nous faire un coucou. Et ça met en appétit :)
notify.at5.image=/srv/foo/photo-pizza.jpg notify.at15.image=/srv/foo/photo-pizza.jpg
#notify.at30.cron=0 30 11 ? * * #notify.at30.cron=0 30 11 ? * *
#notify.at30.irc=Revue hebdomadaire dans 30 minutes #notify.at30.irc=Revue hebdomadaire dans 30 minutes

Binary file not shown.

After

Width:  |  Height:  |  Size: 359 KiB

View File

@ -0,0 +1 @@
Travaux réalisés par Antoine Bardelli en avril 2020.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 KiB

6
resources/images/notes Normal file
View File

@ -0,0 +1,6 @@
Toutes les photos présentes ici sont sous licence libre.
Les métadonnées des images contiennent les informations utiles.
Pour ajouter des métadonnées à de nouvelles photos :
exiftool -use MWG -P -m -overwrite_original_in_place -Copyright="$copyright" nouvellephoto.jpg
exiftool -use MWG -P -m -overwrite_original_in_place -Creator="$artist" nouvellephoto.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 641 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 380 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 666 KiB

7
resources/logo/notes Normal file
View File

@ -0,0 +1,7 @@
Source:
https://www.publicdomainpictures.net/en/view-image.php?image=154863&picture=kids-abc-letter-h
License:
License: CC0 Public Domain
X posid has released this “Kids ABC Letter H” image under Public Domain license. It means that you can use and modify it for your personal and commercial projects. If you intend to use an image you find here for commercial use, please be aware that some photos do require a model or a property release. Pictures featuring products should be used with care.

View File

@ -14,11 +14,11 @@ fi
# Java version check. # Java version check.
javaVersionCheck=`java -version 2>&1` javaVersionCheck=`java -version 2>&1`
if [[ "$javaVersionCheck" =~ ^.*\ 1.8 ]]; then if [[ "$javaVersionCheck" =~ ^.*\ 11. ]]; then
echo "Java 8 version requirement..... OK" echo "Java 11 version requirement..... OK"
let "okCount+=1" let "okCount+=1"
else else
echo "Java 8 version requirement..... MISSING" echo "Java 11 version requirement..... MISSING"
fi fi
if [ "$okCount" == 2 ]; then if [ "$okCount" == 2 ]; then

View File

@ -1,6 +1,6 @@
/** /**
* Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr> * Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr>
* Copyright (C) 2017 Christian Pierre MOMON <cmomon@april.org>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *

View File

@ -0,0 +1,583 @@
/**
* Copyright (C) 2017-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2011-2013,2017 Nicolas Vinot <aeris@imirhil.fr>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot;
import java.io.File;
import java.io.IOException;
import java.text.ParseException;
import java.time.LocalDate;
import java.time.LocalTime;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.hooks.AnnivHook;
import org.april.hebdobot.bot.hooks.BadCommandHook;
import org.april.hebdobot.bot.hooks.CancelPreviousInputHook;
import org.april.hebdobot.bot.hooks.ChronoHook;
import org.april.hebdobot.bot.hooks.CollectiveSubjectHook;
import org.april.hebdobot.bot.hooks.CommentHook;
import org.april.hebdobot.bot.hooks.CurrentHook;
import org.april.hebdobot.bot.hooks.DateHook;
import org.april.hebdobot.bot.hooks.DefaultHook;
import org.april.hebdobot.bot.hooks.FinishReviewHook;
import org.april.hebdobot.bot.hooks.HelloHook;
import org.april.hebdobot.bot.hooks.HelpHook;
import org.april.hebdobot.bot.hooks.Hooker;
import org.april.hebdobot.bot.hooks.IndividualSubjectHook;
import org.april.hebdobot.bot.hooks.InputReviewHook;
import org.april.hebdobot.bot.hooks.LicenseHook;
import org.april.hebdobot.bot.hooks.ListenAlexandrieHook;
import org.april.hebdobot.bot.hooks.MissingHook;
import org.april.hebdobot.bot.hooks.RecordHook;
import org.april.hebdobot.bot.hooks.StartReviewHook;
import org.april.hebdobot.bot.hooks.StatsHook;
import org.april.hebdobot.bot.hooks.StatusHook;
import org.april.hebdobot.bot.hooks.StopReviewHook;
import org.april.hebdobot.bot.hooks.ThanksHook;
import org.april.hebdobot.bot.hooks.VersionHook;
import org.april.hebdobot.bot.review.Message;
import org.april.hebdobot.bot.review.Review;
import org.april.hebdobot.cron.CronManager;
import org.april.hebdobot.cron.CronSettings;
import org.april.hebdobot.identica.IdenticaSettings;
import org.april.hebdobot.privatebin.PrivatebinSettings;
import org.april.hebdobot.twitter.TwitterClient;
import org.april.hebdobot.twitter.TwitterSettings;
import org.april.hebdobot.util.Chrono;
import org.jibble.pircbot.IrcException;
import org.jibble.pircbot.NickAlreadyInUseException;
import org.jibble.pircbot.PircBot;
import org.quartz.SchedulerException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import twitter4j.TwitterException;
/**
* The Class Hebdobot.
*/
public class Hebdobot extends PircBot
{
private static final Logger logger = LoggerFactory.getLogger(Hebdobot.class);
private File homeDirectory;
private String host;
private int port;
private String channel;
private String identifyNick;
private String identifyPassword;
private File reviewDirectory;
private String reviewFileSuffix;
private LocalTime reviewWaitTime;
private Review review;
private Chrono chrono;
private IdenticaSettings identicaSettings;
private PrivatebinSettings privatebinSettings;
private TwitterSettings twitterSettings;
private CronSettings cronSettings;
private UserAliases aliases;
private CronManager cronManager;
private Hooker hooker;
/**
* Instantiates a new hebdobot.
*
* @param host
* the host
* @param port
* the port
* @param nickname
* the nickname
* @param channel
* the channel
* @param homeDirectory
* the home directory
* @param reviewDirectory
* the review directory
* @param identifyNick
* the identify nick
* @param identifyPassword
* the identify password
*/
public Hebdobot(final String host, final int port, final String nickname, final String channel, final File homeDirectory,
final File reviewDirectory, final String identifyNick, final String identifyPassword)
{
this.homeDirectory = homeDirectory;
this.host = host;
this.port = port;
this.channel = channel;
this.setName(nickname);
this.identifyNick = identifyNick;
this.identifyPassword = identifyPassword;
this.reviewDirectory = reviewDirectory;
this.reviewFileSuffix = null;
this.reviewWaitTime = null;
this.review = null;
this.chrono = new Chrono();
this.identicaSettings = new IdenticaSettings();
this.privatebinSettings = new PrivatebinSettings();
this.twitterSettings = new TwitterSettings();
this.cronSettings = new CronSettings();
this.aliases = new UserAliases();
this.cronManager = null;
//
this.hooker = new Hooker();
this.hooker.add(new ListenAlexandrieHook());
this.hooker.add(new CancelPreviousInputHook());
this.hooker.add(new ChronoHook());
this.hooker.add(new CollectiveSubjectHook());
this.hooker.add(new CommentHook());
this.hooker.add(new CurrentHook());
this.hooker.add(new FinishReviewHook());
this.hooker.add(new HelpHook());
this.hooker.add(new IndividualSubjectHook());
this.hooker.add(new MissingHook());
this.hooker.add(new RecordHook());
this.hooker.add(new StartReviewHook());
this.hooker.add(new StopReviewHook());
this.hooker.add(new StatsHook());
this.hooker.add(new StatusHook());
this.hooker.add(new AnnivHook());
this.hooker.add(new DateHook());
this.hooker.add(new HelloHook());
this.hooker.add(new LicenseHook());
this.hooker.add(new ThanksHook());
this.hooker.add(new VersionHook());
this.hooker.add(new BadCommandHook());
this.hooker.add(new InputReviewHook());
this.hooker.add(new DefaultHook());
}
/**
* Check anniversary.
*/
public void checkReviewAnniversary()
{
LocalDate now = LocalDate.now();
LocalDate creation = LocalDate.of(2010, 04, 30);
LocalDate anniv = LocalDate.of(now.getYear(), creation.getMonth(), creation.getDayOfMonth());
logger.debug("now ={}", now.toString());
logger.debug("creation={}", creation.toString());
logger.debug("anniv ={}", anniv.toString());
if ((!now.isBefore(anniv)) && (now.isBefore(anniv.plusDays(7))))
{
logger.info("Review anniversary detected.");
int year = anniv.getYear() - creation.getYear();
sendMessage("% \\o/ Joyeux " + year + "e anniversaire la revue hebdo \\o/");
}
}
/**
* Close.
*/
public void close()
{
this.disconnect();
this.dispose();
}
/**
* End review.
*/
public void endReview()
{
this.review.endReview();
this.chrono.reset();
}
/**
* Gets the aliases.
*
* @return the aliases
*/
public UserAliases getAliases()
{
return this.aliases;
}
public Chrono getChrono()
{
return this.chrono;
}
public CronManager getCronManager()
{
return this.cronManager;
}
/**
* Gets the cron settings.
*
* @return the cron settings
*/
public CronSettings getCronSettings()
{
return this.cronSettings;
}
/**
* Gets the help.
*
* @param source
* the source
* @return the help
* @throws HebdobotException
* the hebdobot exception
*/
public StringList getHelp(final String source) throws HebdobotException
{
StringList result;
if (source == null)
{
result = null;
}
else
{
result = this.hooker.attemptHelp(source);
}
//
return result;
}
/**
* Gets the home directory.
*
* @return the home directory
*/
public File getHomeDirectory()
{
return this.homeDirectory;
}
/**
* Gets the identica settings.
*
* @return the identica settings
*/
public IdenticaSettings getIdenticaSettings()
{
return this.identicaSettings;
}
/**
* Gets the privatebin settings.
*
* @return the privatebin settings
*/
public PrivatebinSettings getPrivatebinSettings()
{
return this.privatebinSettings;
}
public Review getReview()
{
return this.review;
}
public File getReviewDirectory()
{
return this.reviewDirectory;
}
public String getReviewFileSuffix()
{
return this.reviewFileSuffix;
}
public LocalTime getReviewWaitTime()
{
return this.reviewWaitTime;
}
/**
* Gets the twitter settings.
*
* @return the twitter settings
*/
public TwitterSettings getTwitterSettings()
{
return this.twitterSettings;
}
/**
* Notify irc.
*
* @param message
* the message
*/
public void notifyIrc(final String message)
{
sendMessage(message);
}
/**
* Notify twitter.
*
* @param message
* the message
*/
public void notifyTwitter(final String message)
{
notifyTwitter(message, null);
}
/**
* Notify twitter.
*
* @param message
* the message
* @param imageFile
* the image file
*/
public void notifyTwitter(final String message, final File imageFile)
{
if ((this.twitterSettings.isValid()) && (StringUtils.isNotBlank(message)))
{
try
{
TwitterClient twitter = new TwitterClient(this.twitterSettings.getConsumerKey(), this.twitterSettings.getConsumerSecret(),
this.twitterSettings.getAccessToken(), this.twitterSettings.getAccessTokenSecret());
twitter.tweet(message, imageFile);
}
catch (TwitterException exception)
{
logger.error("Error in tweet", exception);
sendMessage("(pour information, la notification par Tweet a échoué : " + exception.getErrorMessage() + ")");
}
}
}
/* (non-Javadoc)
* @see org.jibble.pircbot.PircBot#onMessage(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
protected void onMessage(final String channel, final String sender, final String login, final String hostname, final String message)
{
logger.debug("Message received - channel : {}, sender : {}, message : {}", channel, sender, message);
if (channel.equalsIgnoreCase(this.channel))
{
String text = message.trim();
if (this.review != null)
{
this.review.addRaw(new Message(sender, text));
}
text = text.replaceAll("^" + getName().replace("[", "\\[").replaceAll("]", "\\]") + "[,:]\\s*", "!");
try
{
this.hooker.attemptProcess(this, channel, sender, login, hostname, text);
}
catch (Exception exception)
{
logger.error("Error managing post.", exception);
sendMessage("/me a choppé un bug : ", exception.getMessage());
}
}
}
/* (non-Javadoc)
* @see org.jibble.pircbot.PircBot#onPrivateMessage(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
protected void onPrivateMessage(final String sender, final String login, final String hostname, final String message)
{
logger.debug("Private message received - sender : {}, message : {}", sender, message);
String text = message.trim();
if (text.startsWith("!"))
{
logger.info("!??? caught.");
// Command unknown.
sendMessage(sender, "vos commandes dans le salon public");
}
else
{
// Nothing to say.
}
}
/**
* Run.
*
* @throws HebdobotException
* the hebdobot exception
*/
public void run() throws HebdobotException
{
//
try
{
logger.info("Cron initializing.");
{
this.cronManager = new CronManager(this, this.cronSettings);
this.cronManager.start();
}
logger.info("Cron initialized.");
}
catch (SchedulerException | ParseException exception)
{
throw new HebdobotException("Error in cron settings.", exception);
}
// Manage "Caused by: java.net.UnknownHostException: irc.freenode.org".
boolean ended = false;
while (!ended)
{
try
{
logger.info("Bot connection.");
this.connect(this.host, this.port);
logger.info("Bot connected.");
ended = true;
}
catch (NickAlreadyInUseException exception)
{
throw new HebdobotException(exception);
}
catch (IOException exception)
{
logger.error("IOException during connection ", exception);
try
{
Thread.sleep(200000);
}
catch (InterruptedException subException)
{
logger.error("Exception during sleep ", subException);
}
}
catch (IrcException exception)
{
throw new HebdobotException(exception);
}
}
//
if (this.identifyPassword == null)
{
logger.info("Skipped identify.");
}
else
{
logger.info("Apply identify.");
sendMessage("NickServ", "identify " + this.identifyNick + " " + this.identifyPassword);
logger.info("Applied identify.");
}
logger.info("Bot joining channel ({}).", this.channel);
this.joinChannel(this.channel);
logger.info("Bot ready.");
}
/**
* Send chrono message.
*/
public void sendChronoMessage()
{
if (this.review == null)
{
sendMessage("% durée du point : pas de revue en cours.");
}
else if (this.review.isEmpty())
{
sendMessage("% durée du point : pas de point en cours.");
}
else
{
String topicTitle = this.review.getCurrentTopic().getTitle();
String chronoValue = this.chrono.toString();
sendMessage(String.format("%% durée du point %s : %s", topicTitle, chronoValue));
}
}
/**
* Send message.
*
* @param message
* the message
*/
public void sendMessage(final String message)
{
logger.debug("Send message : {}", message);
this.sendMessage(this.channel, message);
if (this.review != null)
{
this.review.addRaw(new Message("Hebdobot", message));
}
}
/**
* Sets the home directory.
*
* @param homeDirectory
* the new home directory
*/
public void setHomeDirectory(final File homeDirectory)
{
this.homeDirectory = homeDirectory;
}
public void setReview(final Review review)
{
this.review = review;
}
public void setReviewDirectory(final File reviewDirectory)
{
this.reviewDirectory = reviewDirectory;
}
public void setReviewFileSuffix(final String reviewFileSuffix)
{
this.reviewFileSuffix = reviewFileSuffix;
}
public void setReviewWaitTime(final LocalTime reviewWaitTime)
{
this.reviewWaitTime = reviewWaitTime;
}
/**
* Stop review.
*/
public void stopReview()
{
setReview(null);
this.chrono.reset();
}
}

View File

@ -1,6 +1,6 @@
/** /**
* Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr> * Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr>
* Copyright (C) 2017 Christian Pierre MOMON <cmomon@april.org>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -17,7 +17,7 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/> * along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/ */
package org.april.hebdobot.model; package org.april.hebdobot.bot;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
@ -32,7 +32,7 @@ import org.april.hebdobot.HebdobotException;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fr.devinsy.util.strings.StringList; import fr.devinsy.strings.StringList;
/** /**
* The Class UserAliases. * The Class UserAliases.

View File

@ -0,0 +1,103 @@
/**
* Copyright (C) 2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.hooks;
import java.time.LocalDate;
import java.time.Period;
import java.time.format.DateTimeFormatter;
import java.util.Locale;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class AnnivHook.
*/
public class AnnivHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(AnnivHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "anniv"))
{
result = new StringList("!anniv : afficher des anniversaires");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
final String message)
{
boolean result;
if (StringUtils.equalsAnyIgnoreCase(message, "!anniv"))
{
logger.info("!anniv caught.");
LocalDate now = LocalDate.now();
LocalDate revueBirthdate = LocalDate.of(2010, 04, 30);
String birthdate = revueBirthdate.format(DateTimeFormatter.ofPattern("EEEE dd MMMM yyyy", Locale.FRENCH));
int years = Period.between(revueBirthdate, now).getYears();
bot.sendMessage(String.format("La revue hebdomadaire est née le %s et a %d ans", birthdate, years));
LocalDate hebdobotBirthdate = LocalDate.of(2011, 9, 9);
years = Period.between(hebdobotBirthdate, now).getYears();
birthdate = hebdobotBirthdate.format(DateTimeFormatter.ofPattern("EEEE dd MMMM yyyy", Locale.FRENCH));
bot.sendMessage(String.format("Hebdobot a géré sa première revue le %s et a %d ans", birthdate, years));
LocalDate aprilBirthdate = LocalDate.of(1996, 11, 20);
birthdate = aprilBirthdate.format(DateTimeFormatter.ofPattern("EEEE dd MMMM yyyy", Locale.FRENCH));
years = Period.between(aprilBirthdate, now).getYears();
bot.sendMessage(String.format("L'April a été déclarée en préférecture le %s et a %d ans", birthdate, years));
result = true;
}
else
{
result = false;
}
//
return result;
}
}

View File

@ -0,0 +1,68 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.hooks;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
/**
* The Class DefaultHook.
*/
public class BadCommandHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(BadCommandHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(org.april.hebdobot.bot.Hebdobot, java.lang.String)
*/
@Override
public StringList attemptHelp(final String message) throws HebdobotException
{
return null;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
final String message)
{
boolean result;
if (message.matches("^!.*$"))
{
logger.info("!??? caught.");
bot.sendMessage(sender + ", Yo !");
result = true;
}
else
{
result = false;
}
//
return result;
}
}

View File

@ -0,0 +1,107 @@
/**
* Copyright (C) 2019-2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.hooks;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.april.hebdobot.bot.review.Topic;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class CancelPreviousInputHook.
*/
public class CancelPreviousInputHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(CancelPreviousInputHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(org.april.hebdobot.bot.Hebdobot, java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "cancelprevious", "oops", "oups"))
{
result = new StringList("!oups, !oops, !cancelprevious : annuler la dernière entrée dans un point de revue");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
final String message)
{
boolean result;
if (StringsUtils.equalsAnyIgnoreCase(message, "!cancelprevious", "!oops", "!oups"))
{
logger.info("!cancelprevious/!oops caught.");
// Missing.
if (bot.getReview() == null)
{
bot.sendMessage(sender + ", pas de revue en cours.");
}
else
{
Topic topic = bot.getReview().getCurrentTopic();
if (topic == null)
{
bot.sendMessage("Pas de sujet en cours.");
}
else
{
String previousMessage = topic.cancelPreviousMessage(sender);
if (previousMessage == null)
{
bot.sendMessage(sender + ", vous n'avez pas d'entrée en cours.");
}
else
{
bot.sendMessage(sender + ", suppression de votre précédente entrée : " + previousMessage);
}
}
}
result = true;
}
else
{
result = false;
}
//
return result;
}
}

View File

@ -0,0 +1,83 @@
/**
* Copyright (C) 2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.hooks;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class ChronoHook.
*/
public class ChronoHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(ChronoHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "chrono"))
{
result = new StringList("!chrono : afficher la durée du point de revue en cours");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
final String message)
{
boolean result;
if (StringUtils.equalsAnyIgnoreCase(message, "!chrono"))
{
logger.info("!chrono caught.");
// bot.sendChronoMessage();
bot.sendMessage(bot.getChrono().format());
result = true;
}
else
{
result = false;
}
//
return result;
}
}

View File

@ -0,0 +1,108 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.hooks;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.april.hebdobot.bot.review.CollectiveTopic;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class CollectiveSubjectHook.
*/
public class CollectiveSubjectHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(CollectiveSubjectHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "##"))
{
result = new StringList("## titre : démarrer un sujet collectif");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
final String message)
{
boolean result;
if (message.matches("\\s*##.*"))
{
logger.info("\\s*##.* caught.");
// Collective topic, must be before individual topic.
if (bot.getReview() != null)
{
if (bot.getReview().isOwner(sender))
{
CollectiveTopic topic = new CollectiveTopic(message.replaceFirst("##", "").trim());
if (!bot.getReview().isEmpty())
{
bot.sendChronoMessage();
String participants = StringUtils.join(bot.getReview().getParticipants(), " ");
bot.sendMessage(String.format("%% %s, on va passer à la suite : %s", participants, topic.getTitle()));
}
bot.getReview().begin(topic);
bot.sendMessage("Sujet collectif : " + topic.getTitle());
bot.sendMessage("% 1 minute max");
bot.sendMessage("% si rien à signaler vous pouvez écrire % ras");
bot.sendMessage("% quand vous avez fini vous le dites par % fini");
bot.getChrono().start();
}
else
{
bot.sendMessage(sender + ", vous n'êtes pas le conducteur de la réunion");
}
}
result = true;
}
else
{
result = false;
}
//
return result;
}
}

View File

@ -0,0 +1,82 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.hooks;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class CommentHook.
*/
public class CommentHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(CommentHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "%"))
{
result = new StringList("% message : traiter le message comme un commentaire (ignoré dans la synthèse de la revue)");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
final String message)
{
boolean result;
if (message.startsWith("%"))
{
logger.info("% caught.");
// Ignore.
result = true;
}
else
{
result = false;
}
//
return result;
}
}

View File

@ -0,0 +1,106 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.hooks;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.april.hebdobot.bot.review.CollectiveTopic;
import org.april.hebdobot.bot.review.IndividualTopic;
import org.april.hebdobot.bot.review.Topic;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class CurrentHook.
*/
public class CurrentHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(CurrentHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "courant"))
{
result = new StringList("!courant : afficher le sujet en cours");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
final String message)
{
boolean result;
if (StringUtils.equalsIgnoreCase(message, "!courant"))
{
logger.info("!courant caught.");
// Current.
if (bot.getReview() == null)
{
bot.sendMessage(sender + ", pas de revue en cours.");
}
else
{
Topic current = bot.getReview().getCurrentTopic();
if (current == null)
{
bot.sendMessage("% Pas de sujet en cours.");
}
else if (current instanceof IndividualTopic)
{
bot.sendMessage("% Sujet individuel en cours : " + current.getTitle());
}
else if (current instanceof CollectiveTopic)
{
bot.sendMessage("% Sujet collectif en cours : " + current.getTitle());
}
}
result = true;
}
else
{
result = false;
}
//
return result;
}
}

View File

@ -0,0 +1,87 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.hooks;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Locale;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class DateHook.
*/
public class DateHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(DateHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "date", "time", "now"))
{
result = new StringList("!date, !time, !now : afficher la date et l'heure");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
final String message)
{
boolean result;
if (StringUtils.equalsAnyIgnoreCase(message, "!date", "!time", "!now"))
{
logger.info("!date caught.");
// Date command.
bot.sendMessage(LocalDateTime.now().format(DateTimeFormatter.ofPattern("EEEE dd MMMM yyyy HH'h'mm", Locale.FRENCH)));
result = true;
}
else
{
result = false;
}
//
return result;
}
}

View File

@ -0,0 +1,65 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.hooks;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
/**
* The Class DefaultHook.
*/
public class DefaultHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(DefaultHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
result = null;
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
final String message)
{
boolean result;
logger.info("All the other caught.");
result = true;
//
return result;
}
}

View File

@ -0,0 +1,222 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.hooks;
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.april.hebdobot.bot.review.ReviewReporter;
import org.april.hebdobot.bot.stats.ReviewData;
import org.april.hebdobot.bot.stats.ReviewDatas;
import org.april.hebdobot.bot.stats.ReviewDatasFile;
import org.april.hebdobot.bot.stats.ReviewStatsReporter;
import org.april.hebdobot.privatebin.PrivatebinClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class FinishReviewHook.
*/
public class FinishReviewHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(FinishReviewHook.class);
public static String DEFAULT_SUFFIX = "-log-irc-revue-hebdomadaire.txt";
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "fin"))
{
result = new StringList("!fin : terminer la revue en cours");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
final String message)
{
boolean result;
if (StringUtils.equalsAnyIgnoreCase(message, "!fin"))
{
logger.info("!fin caught.");
// End.
if (bot.getReview() == null)
{
bot.sendMessage(sender + ", pas de revue en cours.");
}
else if (!bot.getReview().isOwner(sender))
{
bot.sendMessage(sender + ", vous n'êtes pas le conducteur de la réunion");
}
else if (bot.getReview().isEnded())
{
bot.sendMessage("La revue est déjà finie.");
}
else if (bot.getReview().getParticipants().size() == 0)
{
bot.sendMessage("Participation nulle détectée. La revue est ignorée.");
bot.setReview(null);
}
else
{
// End the review.
bot.sendChronoMessage();
bot.endReview();
// Load and update review statistics.
ReviewDatas datas;
try
{
File reviewDataFile = new File(bot.getReviewDirectory(), "reviewstats.csv");
datas = ReviewDatasFile.load(reviewDataFile);
datas.clean();
ReviewData currentReviewData = new ReviewData(LocalDateTime.now(), bot.getReview().getParticipants().size(),
bot.getReview().getDurationInMinutes());
datas.add(currentReviewData);
if (bot.getReview().getParticipants().size() > 1)
{
ReviewDatasFile.append(reviewDataFile, currentReviewData);
}
}
catch (Exception exception)
{
logger.warn("Exception during statistics work.", exception);
datas = null;
}
// Generate the review text.
String date = LocalDate.now().format(DateTimeFormatter.BASIC_ISO_DATE);
String reviewText = ReviewReporter.report(datas, bot.getReview());
// Pastebin the review text.
String pastebinUrl;
if (bot.getPrivatebinSettings().isValid())
{
logger.info("Pastebin the review.");
try
{
PrivatebinClient pastebinClient = new PrivatebinClient(bot.getPrivatebinSettings());
pastebinUrl = pastebinClient.paste(reviewText);
}
catch (final Exception exception)
{
logger.error("Error during Pastebin submit.", exception);
pastebinUrl = "erreur";
}
}
else
{
pastebinUrl = "aucun";
}
// Save the review text.
logger.info("Write review file.");
File reviewFile = new File(bot.getReviewDirectory(), date + StringUtils.defaultString(bot.getReviewFileSuffix(), DEFAULT_SUFFIX));
if (reviewFile.exists())
{
LocalTime now = LocalTime.now();
String newSuffix = String.format("-%02dh%02d.txt", now.getHour(), now.getMinute());
reviewFile = new File(reviewFile.getAbsolutePath().replace(".txt", newSuffix));
}
try
{
if (!bot.getReviewDirectory().exists())
{
logger.info("Create review directory: " + bot.getReviewDirectory().getAbsolutePath());
bot.getReviewDirectory().mkdirs();
}
FileUtils.writeStringToFile(reviewFile, reviewText, StandardCharsets.UTF_8);
logger.info("File review saved in: [{}]", reviewFile.getAbsolutePath());
}
catch (final Exception exception)
{
logger.error("Error during file writing.", exception);
}
// Send conclusion message in channel.
bot.checkReviewAnniversary();
bot.sendMessage("% " + ReviewStatsReporter.reportCurrentReviewCount(datas));
bot.sendMessage("% Compte-rendu de la revue : " + pastebinUrl);
bot.sendMessage("% Durée de la revue : " + bot.getReview().getDurationInMinutes() + " minutes");
bot.sendMessage("% Nombre de personnes participantes : " + bot.getReview().getParticipants().size());
bot.sendMessage("% " + ReviewStatsReporter.reportCheckUserCountRecord(datas));
bot.sendMessage(bot.getReview().getOwner(), ReviewStatsReporter.reportUserCount(datas, bot.getReview().getParticipants().size()));
bot.sendMessage(bot.getReview().getOwner(), ReviewStatsReporter.reportDuration(datas, bot.getReview().getDurationInMinutes()));
String participants = StringUtils.join(bot.getReview().getParticipants(), " ");
bot.sendMessage("% " + participants + ", pensez à noter votre bénévalo : http://www.april.org/my?action=benevalo");
String reminderMessage = String.format(
"%% %s, ne pas oublier d'ajouter le compte-rendu de la revue sur https://agir.april.org/issues/135 en utilisant comme nom de fichier %s",
bot.getReview().getOwner(), reviewFile.getName());
logger.info("reminderMessage=[{}]", reminderMessage);
bot.sendMessage(reminderMessage);
// Finalize review.
bot.sendMessage("% Fin de la revue hebdomadaire");
bot.sendMessage(bot.getReview().getOwner(), "Revue finie.");
bot.setReview(null);
}
result = true;
}
else
{
result = false;
}
//
return result;
}
}

View File

@ -0,0 +1,91 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.hooks;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class HelloHook.
*/
public class HelloHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(HelloHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "salut", "bonjour", "hello"))
{
result = new StringList("!salut, !bonjour, !hello : dire bonjour");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
final String message)
{
boolean result;
if (StringUtils.equalsAnyIgnoreCase(message, "!salut", "!bonjour", "!hello"))
{
logger.info("!salut caught.");
// Salutation command.
bot.sendMessage(sender + ", bonjour \\o/");
result = true;
}
else if ((StringsUtils.containsAnyIgnoreCase(message, "bonjour", "salut", "hello", "yo", "hey", "hi"))
&& (StringUtils.containsIgnoreCase(message, bot.getName())))
{
bot.sendMessage(sender + ", bonjour \\o/");
result = true;
}
else
{
result = false;
}
//
return result;
}
}

View File

@ -0,0 +1,158 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.hooks;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class HelpHook.
*/
public class HelpHook extends Hook
{
private static final Pattern COMMAND_HELP_PATTERN = Pattern.compile("^!(aide|help)\\s+(?<token>\\S+)$");
private static final Logger logger = LoggerFactory.getLogger(HelpHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "aide", "help"))
{
result = new StringList();
result.append("!aide, !help, !aide hebdobot, !help hebdobot : afficher l'aide générale");
result.append("!aide commande, !help commande : afficher l'aide de la commande !commande");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
final String message) throws HebdobotException
{
boolean result;
if (StringUtils.equalsAnyIgnoreCase(message, "!aide", "!help", "!aide hebdobot", "!help hebdobot"))
{
logger.info("!help caught.");
// Help.
bot.sendMessage(sender,
String.format("Bienvenue %s. Je suis %s, le robot de gestion des revues hebdomadaires de l'April.", sender, bot.getName()));
bot.sendMessage(sender, "Voici les commandes que je comprends :");
bot.sendMessage(sender, " ");
bot.sendMessage(sender, " !aide,!help : afficher cette aide");
bot.sendMessage(sender, " !aide commande : afficher l'aide de la commande !commande");
bot.sendMessage(sender, " !début : commencer une nouvelle revue");
bot.sendMessage(sender, " % message  : traiter comme un commentaire");
bot.sendMessage(sender, " # titre  : démarrer un sujet individuel");
bot.sendMessage(sender, " ## titre  : démarrer un sujet collectif");
bot.sendMessage(sender, " !oups   : annuler la dernière entrée dans un point de revue");
bot.sendMessage(sender, " !courant : afficher le sujet en cours");
bot.sendMessage(sender, " !fin : terminer la revue en cours");
bot.sendMessage(sender, " !stop  : abandonner la revue en cours");
bot.sendMessage(sender, " ");
bot.sendMessage(sender,
"Autres commandes : !anniv, !bonjour, !chrono, !date, !hello, !licence, !manquants, !merci, !record, !salut, !stats, !status, !version");
result = true;
}
else
{
String token = extractTargetHelp(message);
if (token == null)
{
result = false;
}
else
{
StringList help = bot.getHelp(token);
if (help == null)
{
bot.sendMessage("aide indisponible pour la commande " + token);
}
else
{
for (String line : help)
{
bot.sendMessage(line);
}
}
result = true;
}
}
//
return result;
}
/**
* Extract target help.
*
* @return the string
*/
private String extractTargetHelp(final String message)
{
String result;
Matcher matcher = COMMAND_HELP_PATTERN.matcher(message);
if (matcher.find())
{
result = matcher.group("token");
if (StringUtils.startsWith(result, "!"))
{
result = result.substring(1);
}
}
else
{
result = null;
}
//
return result;
}
}

View File

@ -0,0 +1,78 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.hooks;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import fr.devinsy.strings.StringList;
/**
* The Class Hook.
*/
public abstract class Hook
{
/**
* Attempt help.
*
* @param string
* the string
* @return the string list
* @throws HebdobotException
* the hebdobot exception
*/
public abstract StringList attemptHelp(final String string) throws HebdobotException;
/**
* Attempt process.
*
* @param bot
* the bot
* @param channel
* the channel
* @param sender
* the sender
* @param login
* the login
* @param hostname
* the hostname
* @param message
* the message
* @return true, if successful
* @throws HebdobotException
* the hebdobot exception
*/
public abstract boolean attemptProcess(Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
final String message) throws HebdobotException;
/**
* Gets the name.
*
* @return the name
*/
public String getName()
{
String result;
result = this.getClass().getName().replace("Hook", "");
//
return result;
}
}

View File

@ -0,0 +1,190 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.hooks;
import java.util.ArrayList;
import java.util.Iterator;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
/**
* The class Hooker, a hook manager.
*/
public class Hooker
{
private static final Logger logger = LoggerFactory.getLogger(Hooker.class);
private ArrayList<Hook> hooks;
/**
* Instantiates a new hook manager.
*/
public Hooker()
{
this.hooks = new ArrayList<>(30);
}
/**
* Adds the.
*
* @param hook
* the hook
*/
public void add(final Hook hook)
{
if (hook != null)
{
this.hooks.add(hook);
}
}
/**
* Attempt help.
*
* @param message
* the message
* @return the string list
* @throws HebdobotException
* the hebdobot exception
*/
public StringList attemptHelp(final String message) throws HebdobotException
{
StringList result;
boolean ended = false;
Iterator<Hook> iterator = this.hooks.iterator();
result = null;
while (!ended)
{
if (iterator.hasNext())
{
Hook hook = iterator.next();
StringList help = hook.attemptHelp(message);
if (help != null)
{
ended = true;
result = help;
}
}
else
{
ended = true;
result = null;
}
}
//
return result;
}
/**
* Attempt process.
*
* @param bot
* the bot
* @param channel
* the channel
* @param sender
* the sender
* @param login
* the login
* @param hostname
* the hostname
* @param message
* the message
* @return true, if successful
* @throws HebdobotException
* the hebdobot exception
*/
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
final String message) throws HebdobotException
{
boolean result;
boolean ended = false;
Iterator<Hook> iterator = this.hooks.iterator();
result = false;
while (!ended)
{
if (iterator.hasNext())
{
Hook hook = iterator.next();
boolean hookResult = hook.attemptProcess(bot, channel, sender, login, hostname, message);
if (hookResult)
{
ended = true;
result = true;
}
}
else
{
ended = true;
result = false;
}
}
//
return result;
}
/**
* Clear.
*/
public void clear()
{
this.hooks.clear();
}
public StringList getHookNames()
{
StringList result;
result = new StringList(this.hooks.size());
for (Hook hook : this.hooks)
{
result.add(hook.getName());
}
//
return result;
}
/**
* Size.
*
* @return the int
*/
public int size()
{
int result;
result = this.hooks.size();
//
return result;
}
}

View File

@ -0,0 +1,107 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.hooks;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.april.hebdobot.bot.review.IndividualTopic;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class IndividualSubjectHook.
*/
public class IndividualSubjectHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(IndividualSubjectHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "#"))
{
result = new StringList("# titre : démarrer un sujet individuel");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
final String message)
{
boolean result;
if (message.matches("\\s*#[^#].*"))
{
logger.info("\\s*#[^#].* caught.");
// Individual topic.
if (bot.getReview() != null)
{
if (bot.getReview().isOwner(sender))
{
IndividualTopic topic = new IndividualTopic(message.replaceFirst("#", "").trim());
if (!bot.getReview().isEmpty())
{
bot.sendChronoMessage();
String participants = StringUtils.join(bot.getReview().getParticipants(), " ");
bot.sendMessage(String.format("%% %s, on va passer à la suite : %s", participants, topic.getTitle()));
}
bot.getReview().begin(topic);
bot.sendMessage("Sujet individuel : " + topic.getTitle());
bot.sendMessage("% si rien à signaler vous pouvez écrire % ras");
bot.sendMessage("% quand vous avez fini vous le dites par % fini");
bot.getChrono().start();
}
else
{
bot.sendMessage(sender + ", vous n'êtes pas le conducteur de la réunion");
}
}
result = true;
}
else
{
result = false;
}
//
return result;
}
}

View File

@ -0,0 +1,75 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.hooks;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.april.hebdobot.bot.review.Message;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
/**
* The Class DefaultHook.
*/
public class InputReviewHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(InputReviewHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
result = null;
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
final String message)
{
boolean result;
if (bot.getReview() == null)
{
result = false;
}
else
{
bot.getReview().add(new Message(sender, message));
result = true;
}
result = true;
//
return result;
}
}

View File

@ -0,0 +1,83 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.hooks;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class LicenseHook.
*/
public class LicenseHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(LicenseHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "licence", "license"))
{
result = new StringList("!licence, !license : afficher la licence du logiciel Hebdobot et le lien vers ses sources");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
final String message)
{
boolean result;
if (StringsUtils.equalsAnyIgnoreCase(message, "!licence", "!license"))
{
logger.info("!licence caught.");
bot.sendMessage(
"Hebdobot est un logiciel libre de l'April sous licence GNU AGPLv3+, sources : https://forge.april.org/adminsys/hebdobot");
result = true;
}
else
{
result = false;
}
//
return result;
}
}

View File

@ -0,0 +1,74 @@
/**
* Copyright (C) 2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.hooks;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
/**
* The Class ListenAlexandrieHook.
*
* This hook is listening Alexandrie messages and do not answer.
*
*/
public class ListenAlexandrieHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(ListenAlexandrieHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
result = null;
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
final String message)
{
boolean result;
if (StringUtils.equalsIgnoreCase(sender, "alexandrie"))
{
result = true;
}
else
{
result = false;
}
//
return result;
}
}

View File

@ -0,0 +1,116 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.hooks;
import java.util.Collection;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.april.hebdobot.bot.review.Topic;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringSet;
import fr.devinsy.strings.StringsUtils;
/**
* The Class MissingHook.
*/
public class MissingHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(MissingHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "manquants"))
{
result = new StringList("!manquants : afficher les pseudos n'ayant pas participé au point en cours");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
final String message)
{
boolean result;
if (StringUtils.equalsIgnoreCase(message, "!manquants"))
{
logger.info("!manquants caught.");
// Missing.
if (bot.getReview() == null)
{
bot.sendMessage(sender + ", pas de revue en cours.");
}
else
{
Topic topic = bot.getReview().getCurrentTopic();
if (topic == null)
{
bot.sendMessage("Pas de sujet en cours.");
}
else
{
StringSet participants = bot.getReview().getParticipants();
participants.add(bot.getReview().getOwner());
StringSet currentParticipants = topic.getParticipants();
Collection<String> missing = CollectionUtils.subtract(participants, currentParticipants);
if (missing.isEmpty())
{
bot.sendMessage("Tout le monde s'est exprimé sur le sujet courant \\o/");
}
else
{
bot.sendMessage("Personnes participantes ne s'étant pas exprimées sur le sujet courant : " + StringUtils.join(missing, ", "));
}
}
}
result = true;
}
else
{
result = false;
}
//
return result;
}
}

View File

@ -0,0 +1,109 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.hooks;
import java.io.File;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.april.hebdobot.bot.stats.ReviewDatas;
import org.april.hebdobot.bot.stats.ReviewDatasFile;
import org.april.hebdobot.bot.stats.ReviewStatsReporter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class RecordHook.
*/
public class RecordHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(RecordHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "record"))
{
result = new StringList("!record : afficher le record de participation à la revue");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
final String message)
{
boolean result;
if (StringUtils.equalsIgnoreCase(message, "!record"))
{
logger.info("!record caught.");
// This feature has to not break Hebdobot.
try
{
File reviewDataFile = new File(bot.getReviewDirectory(), "reviewstats.csv");
if (reviewDataFile.exists())
{
ReviewDatas datas = ReviewDatasFile.load(reviewDataFile);
datas.clean();
bot.sendMessage(ReviewStatsReporter.reportUserCountRecord(datas));
}
else
{
logger.warn("Statistic file not found [{}]", reviewDataFile.getAbsolutePath());
bot.sendMessage("% Fichier de statistiques absent.");
}
}
catch (Exception exception)
{
logger.warn("Exception during record work.", exception);
bot.sendMessage("% Impossible d'afficher le record.");
}
//
result = true;
}
else
{
result = false;
}
//
return result;
}
}

View File

@ -0,0 +1,120 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.hooks;
import java.time.LocalTime;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.april.hebdobot.bot.review.Review;
import org.quartz.SchedulerException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class StartReviewHook.
*/
public class StartReviewHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(StartReviewHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "début", "debut", "start"))
{
result = new StringList("!début, !debut, !start : commencer une nouvelle revue");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
final String message)
{
boolean result;
if (StringUtils.equalsAnyIgnoreCase(message, "!début", "!debut", "!start"))
{
logger.info("!debut caught.");
if ((bot.getReviewWaitTime() != null) && (LocalTime.now().isBefore(bot.getReviewWaitTime())))
{
bot.sendMessage(sender + ", ce n'est pas encore l'heure.");
}
else
{
// Start.
if (bot.getReview() != null)
{
bot.sendMessage("% " + sender + ", une revue est déjà en cours.");
}
else
{
if (bot.getCronManager() != null)
{
try
{
bot.getCronManager().shutdown();
}
catch (SchedulerException exception)
{
logger.warn("Scheduler shutdown failed.", exception);
}
}
bot.setReview(new Review(sender, bot.getAliases()));
bot.sendMessage(sender, "Bonjour " + sender + ", vous êtes le conducteur de réunion.");
bot.sendMessage(sender, "Pour terminer la réunion, tapez \"!fin\"");
bot.checkReviewAnniversary();
bot.sendMessage("% Début de la réunion hebdomadaire");
bot.sendMessage(
"% rappel : toute ligne commençant par % sera considérée comme un commentaire et non prise en compte dans la synthèse");
bot.sendMessage("% pour connaître le point courant, taper !courant");
}
}
result = true;
}
else
{
result = false;
}
//
return result;
}
}

View File

@ -0,0 +1,113 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.hooks;
import java.io.File;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.april.hebdobot.bot.stats.ReviewDatas;
import org.april.hebdobot.bot.stats.ReviewDatasFile;
import org.april.hebdobot.bot.stats.ReviewStatsReporter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class StatsHook.
*/
public class StatsHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(StatsHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "stats"))
{
result = new StringList("!stats : statistiques sur les précédentes revues");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
final String message)
{
boolean result;
if (StringUtils.equalsIgnoreCase(message, "!stats"))
{
logger.info("!stats caught.");
// Display statistics. This feature has to not break
// Hebdobot.
try
{
File reviewDataFile = new File(bot.getReviewDirectory(), "reviewstats.csv");
if (reviewDataFile.exists())
{
ReviewDatas datas = ReviewDatasFile.load(reviewDataFile);
datas.clean();
bot.sendMessage("% " + ReviewStatsReporter.reportReviewCount(datas));
bot.sendMessage("% " + ReviewStatsReporter.reportReviewUserCount(datas));
bot.sendMessage("% " + ReviewStatsReporter.reportReviewDuration(datas));
bot.sendMessage("% " + ReviewStatsReporter.reportUserCountBoard(datas));
bot.sendMessage("% " + ReviewStatsReporter.reportDurationBoard(datas));
}
else
{
logger.warn("Statistic file not found [{}]", reviewDataFile.getAbsolutePath());
bot.sendMessage("% Fichier de statistiques absent.");
}
}
catch (Exception exception)
{
logger.warn("Exception during statistics work.", exception);
bot.sendMessage("% Impossible d'afficher des statistiques.");
}
result = true;
}
else
{
result = false;
}
//
return result;
}
}

View File

@ -0,0 +1,98 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.hooks;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class StatusHook.
*/
public class StatusHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(StatusHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "status", "statut"))
{
result = new StringList("!status, !statut : état et paramétrage d'Hebdobot");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
final String message)
{
boolean result;
if (StringUtils.equalsAnyIgnoreCase(message, "!status", "!statut"))
{
logger.info("!status caught.");
bot.sendMessage(sender, sender + ", voici l'état d'Hebdobot :");
bot.sendMessage(sender, " revue en cours : " + (bot.getReview() != null));
if (bot.getReview() == null)
{
bot.sendMessage(sender, " animateur revue : none");
}
else
{
bot.sendMessage(sender, " animateur revue : " + bot.getReview().getOwner());
}
bot.sendMessage(sender, " Alias settings : " + (bot.getAliases().size()));
bot.sendMessage(sender, " Identica settings : " + (bot.getIdenticaSettings().isValid()));
bot.sendMessage(sender, " Privatebin settings : " + bot.getPrivatebinSettings().toString());
bot.sendMessage(sender, " Twitter settings : " + (bot.getTwitterSettings().isValid()));
bot.sendMessage(sender, " Cron settings : " + (bot.getCronSettings().size()));
bot.sendMessage(sender, " Review Wait Time : " + (bot.getReviewWaitTime()));
result = true;
}
else
{
result = false;
}
//
return result;
}
}

View File

@ -0,0 +1,96 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.hooks;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class StopReviewHook.
*/
public class StopReviewHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(StopReviewHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "stop"))
{
result = new StringList("!stop : abandonner la revue en cours");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
final String message)
{
boolean result;
if (StringUtils.equalsAnyIgnoreCase(message, "!stop"))
{
logger.info("!stop caught.");
// Stop.
if (bot.getReview() == null)
{
bot.sendMessage(sender + ", pas de revue en cours, abandon impossible.");
}
else if (!bot.getReview().isOwner(sender))
{
bot.sendMessage(sender + ", vous n'êtes pas le conducteur de la réunion.");
}
else
{
bot.sendMessage("Abandon de la revue en cours.");
bot.stopReview();
}
result = true;
}
else
{
result = false;
}
//
return result;
}
}

View File

@ -0,0 +1,88 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.hooks;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class ThanksHook.
*/
public class ThanksHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(ThanksHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "merci"))
{
result = new StringList("!merci : dire que ça fait plaisir");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
final String message)
{
boolean result;
if (StringsUtils.equalsAnyIgnoreCase(message, "!merci"))
{
logger.info("!merci caught.");
bot.sendMessage(sender + ", de rien \\o/");
result = true;
}
else if ((StringsUtils.containsAnyIgnoreCase(message, "merci")) && (StringUtils.containsIgnoreCase(message, bot.getName())))
{
bot.sendMessage(sender + ", de rien \\o/");
result = true;
}
else
{
result = false;
}
//
return result;
}
}

View File

@ -0,0 +1,83 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.hooks;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.april.hebdobot.util.BuildInformation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class VersionHook.
*/
public class VersionHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(VersionHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "version"))
{
result = new StringList("!version : afficher la version d'Hebdobot");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
final String message)
{
boolean result;
if (StringUtils.equalsIgnoreCase(message, "!version"))
{
logger.info("!version caught.");
bot.sendMessage(new BuildInformation().toString());
result = true;
}
else
{
result = false;
}
//
return result;
}
}

View File

@ -1,6 +1,6 @@
/** /**
* Copyright (C) 2017-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr> * Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr>
* Copyright (C) 2017 Christian Pierre MOMON <cmomon@april.org>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -17,11 +17,11 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/> * along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/ */
package org.april.hebdobot.model.review; package org.april.hebdobot.bot.review;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
import fr.devinsy.strings.StringSet;
/** /**
* The Class CollectiveTopic. * The Class CollectiveTopic.
@ -52,6 +52,31 @@ public class CollectiveTopic extends Topic
this.messages.add(message); this.messages.add(message);
} }
/* (non-Javadoc)
* @see org.april.hebdobot.bot.review.Topic#cancelPrevious(java.lang.String)
*/
@Override
public String cancelPreviousMessage(final String author)
{
String result;
Messages authorMessages = this.messages.getByAuthor(author);
if (authorMessages.isEmpty())
{
result = null;
}
else
{
Message previousMessage = authorMessages.getLast();
this.messages.remove(previousMessage);
result = previousMessage.getContent();
}
//
return result;
}
/** /**
* Gets the messages. * Gets the messages.
* *
@ -66,13 +91,34 @@ public class CollectiveTopic extends Topic
* @see org.april.hebdobot.review.Topic#getParticipants() * @see org.april.hebdobot.review.Topic#getParticipants()
*/ */
@Override @Override
public Set<String> getParticipants() public StringSet getParticipants()
{ {
final Set<String> participants = new HashSet<String>(); StringSet result = new StringSet();
for (final Message message : this.messages) for (final Message message : this.messages)
{ {
participants.add(message.getAuthor()); result.add(message.getAuthor());
} }
return participants;
//
return result;
}
/**
* Checks for message.
*
* @param author
* the author
* @return true, if successful
*/
@Override
public boolean hasMessage(final String author)
{
boolean result;
Messages authorMessage = this.messages.getByAuthor(author);
result = authorMessage.isEmpty();
//
return result;
} }
} }

View File

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2017 Christian Pierre MOMON <cmomon@april.org> * Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -16,21 +16,21 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/> * along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/ */
package org.april.hebdobot.model.review; package org.april.hebdobot.bot.review;
import java.util.LinkedList; import java.util.LinkedList;
/** /**
* The Class MessageLinkedList. * The Class CollectiveTopics.
*/ */
public class Messages extends LinkedList<Message> public class CollectiveTopics extends LinkedList<CollectiveTopic>
{ {
private static final long serialVersionUID = -4092193002518826252L; private static final long serialVersionUID = -2719546135520171963L;
/** /**
* Instantiates a new messages. * Instantiates a new collective topics.
*/ */
public Messages() public CollectiveTopics()
{ {
super(); super();
} }

View File

@ -1,6 +1,6 @@
/** /**
* Copyright (C) 2017-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr> * Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr>
* Copyright (C) 2017 Christian Pierre MOMON <cmomon@april.org>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -17,18 +17,16 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/> * along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/ */
package org.april.hebdobot.model.review; package org.april.hebdobot.bot.review;
import java.util.HashMap; import fr.devinsy.strings.StringSet;
import java.util.Map;
import java.util.Set;
/** /**
* The Class IndividualTopic. * The Class IndividualTopic.
*/ */
public class IndividualTopic extends Topic public class IndividualTopic extends Topic
{ {
private final Map<String, Messages> messages; private final MessageMap messages;
/** /**
* Instantiates a new individual topic. * Instantiates a new individual topic.
@ -40,7 +38,7 @@ public class IndividualTopic extends Topic
{ {
super(title); super(title);
this.messages = new HashMap<String, Messages>(); this.messages = new MessageMap();
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -57,6 +55,29 @@ public class IndividualTopic extends Topic
this.messages.get(author).add(message); this.messages.get(author).add(message);
} }
/* (non-Javadoc)
* @see org.april.hebdobot.bot.review.Topic#cancelPrevious(java.lang.String)
*/
@Override
public String cancelPreviousMessage(final String participant)
{
String result;
Messages authorMessages = this.messages.get(participant);
if ((authorMessages == null) || (authorMessages.isEmpty()))
{
result = null;
}
else
{
Message removed = authorMessages.removeLast();
result = removed.getContent();
}
//
return result;
}
/** /**
* Gets the messages. * Gets the messages.
* *
@ -78,11 +99,38 @@ public class IndividualTopic extends Topic
* @see org.april.hebdobot.review.Topic#getParticipants() * @see org.april.hebdobot.review.Topic#getParticipants()
*/ */
@Override @Override
public Set<String> getParticipants() public StringSet getParticipants()
{ {
Set<String> result; StringSet result;
result = this.messages.keySet(); result = new StringSet(this.messages.keySet());
//
return result;
}
/**
* Checks for message.
*
* @param participant
* the participant
* @return true, if successful
*/
@Override
public boolean hasMessage(final String participant)
{
boolean result;
Messages messages = this.messages.get(participant);
if ((messages == null) || (messages.isEmpty()))
{
result = false;
}
else
{
result = true;
}
// //
return result; return result;

View File

@ -0,0 +1,37 @@
/**
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.review;
import java.util.LinkedList;
/**
* The Class IndividualTopics.
*/
public class IndividualTopics extends LinkedList<IndividualTopic>
{
private static final long serialVersionUID = -5285310840777688742L;
/**
* Instantiates a new individual topics.
*/
public IndividualTopics()
{
super();
}
}

View File

@ -1,6 +1,6 @@
/** /**
* Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr> * Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr>
* Copyright (C) 2017 Christian Pierre MOMON <cmomon@april.org>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -17,7 +17,7 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/> * along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/ */
package org.april.hebdobot.model.review; package org.april.hebdobot.bot.review;
import java.time.LocalDateTime; import java.time.LocalDateTime;

View File

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2017 Christian Pierre MOMON <cmomon@april.org> * Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -16,7 +16,7 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/> * along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/ */
package org.april.hebdobot.model.review; package org.april.hebdobot.bot.review;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -0,0 +1,37 @@
/**
* Copyright (C) 2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.review;
import java.util.HashMap;
/**
* The Class MessageMap.
*/
public class MessageMap extends HashMap<String, Messages>
{
private static final long serialVersionUID = 2324236890989710448L;
/**
* Instantiates a new message map.
*/
public MessageMap()
{
super();
}
}

View File

@ -0,0 +1,64 @@
/**
* Copyright (C) 2017-2019 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.review;
import java.util.LinkedList;
import org.apache.commons.lang3.StringUtils;
/**
* The Class MessageLinkedList.
*/
public class Messages extends LinkedList<Message>
{
private static final long serialVersionUID = -4092193002518826252L;
/**
* Instantiates a new messages.
*/
public Messages()
{
super();
}
/**
* Gets the by author.
*
* @param author
* the author
* @return the by author
*/
public Messages getByAuthor(final String author)
{
Messages result;
result = new Messages();
for (Message message : this)
{
if (StringUtils.equals(message.getAuthor(), author))
{
result.add(message);
}
}
//
return result;
}
}

View File

@ -0,0 +1,356 @@
/**
* Copyright (C) 2017-2019 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.review;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import org.april.hebdobot.bot.UserAliases;
import fr.devinsy.strings.StringSet;
/**
* The Class Review.
*/
public class Review
{
private static final int LENGTH = 80;
private final StringSet participants;
private final IndividualTopics individualTopics;
private final CollectiveTopics collectiveTopics;
private Topic currentTopic;
private final MessageList messages;
private final String owner;
private final UserAliases aliases;
private final LocalDateTime startTime;
private LocalDateTime endTime;
/**
* Instantiates a new review.
*
* @param owner
* the owner
* @param aliases
* the aliases
*/
public Review(final String owner, final UserAliases aliases)
{
this.participants = new StringSet();
this.individualTopics = new IndividualTopics();
this.collectiveTopics = new CollectiveTopics();
this.messages = new MessageList();
this.owner = owner;
this.aliases = aliases;
this.startTime = LocalDateTime.now();
this.endTime = null;
}
/**
* Adds the.
*
* @param message
* the message
*/
public void add(final Message message)
{
if (this.currentTopic != null)
{
this.participants.add(message.getAuthor());
this.currentTopic.add(message);
}
}
/**
* Adds the raw.
*
* @param message
* the message
*/
public void addRaw(final Message message)
{
this.messages.add(message);
}
/**
* Begin.
*
* @param topic
* the topic
*/
public void begin(final CollectiveTopic topic)
{
this.collectiveTopics.add(topic);
this.currentTopic = topic;
}
/**
* Begin.
*
* @param topic
* the topic
*/
public void begin(final IndividualTopic topic)
{
this.individualTopics.add(topic);
this.currentTopic = topic;
}
/**
* End review.
*/
public void endReview()
{
this.endTime = LocalDateTime.now();
}
public UserAliases getAliases()
{
return this.aliases;
}
/**
* Gets the collective topics.
*
* @return the collective topics
*/
public CollectiveTopics getCollectiveTopics()
{
return this.collectiveTopics;
}
/**
* Gets the current topic.
*
* @return the current topic
*/
public Topic getCurrentTopic()
{
return this.currentTopic;
}
/**
* Gets the duration.
*
* @return the duration
*/
public long getDuration()
{
long result;
if (this.endTime == null)
{
result = Duration.between(this.startTime, LocalDateTime.now()).getSeconds();
}
else
{
result = Duration.between(this.startTime, this.endTime).getSeconds();
}
//
return result;
}
/**
* Gets the duration.
*
* @return the duration
*/
public long getDurationInMinutes()
{
long result;
result = (long) Math.ceil(getDuration() / 60.0);
//
return result;
}
/**
* Gets the end time.
*
* @return the end time
*/
public LocalDateTime getEndTime()
{
return this.endTime;
}
/**
* Gets the formatted end time.
*
* @return the formatted end time
*/
public String getFormattedEndTime()
{
String result;
if (this.endTime == null)
{
result = "??h??";
}
else
{
result = this.endTime.format(DateTimeFormatter.ofPattern("kk'h'mm"));
}
//
return result;
}
/**
* Gets the formatted start time.
*
* @return the formatted start time
*/
public String getFormattedStartTime()
{
String result;
result = this.startTime.format(DateTimeFormatter.ofPattern("kk'h'mm"));
//
return result;
}
/**
* Gets the individual topics.
*
* @return the individual topics
*/
public IndividualTopics getIndividualTopics()
{
return this.individualTopics;
}
public MessageList getMessages()
{
return this.messages;
}
/**
* Gets the owner.
*
* @return the owner
*/
public String getOwner()
{
return this.owner;
}
/**
* Gets the participants.
*
* @return the participants
*/
public StringSet getParticipants()
{
StringSet result;
result = new StringSet();
for (final Topic topic : this.individualTopics)
{
result.addAll(topic.getParticipants());
}
for (final Topic topic : this.collectiveTopics)
{
result.addAll(topic.getParticipants());
}
//
return result;
}
/**
* Gets the start time.
*
* @return the start time
*/
public LocalDateTime getStartTime()
{
return this.startTime;
}
/**
* Checks if is empty.
*
* @return true, if is empty
*/
public boolean isEmpty()
{
boolean result;
if ((this.individualTopics.isEmpty()) && (this.collectiveTopics.isEmpty()))
{
result = true;
}
else
{
result = false;
}
//
return result;
}
/**
* Checks if is ended.
*
* @return true, if is ended
*/
public boolean isEnded()
{
boolean result;
if (this.endTime == null)
{
result = false;
}
else
{
result = true;
}
//
return result;
}
/**
* Checks if is owner.
*
* @param name
* the name
* @return true, if is owner
*/
public boolean isOwner(final String name)
{
boolean result;
result = this.owner.equalsIgnoreCase(name);
//
return result;
}
}

View File

@ -0,0 +1,361 @@
/**
* Copyright (C) 2017-2019 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.review;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Locale;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.bot.stats.ReviewDatas;
import org.april.hebdobot.bot.stats.ReviewStatsReporter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
/**
* The Class Review.
*/
public class ReviewReporter
{
private static final Logger logger = LoggerFactory.getLogger(ReviewReporter.class);
private static final int LENGTH_LINE = 80;
/**
* Adds the center.
*
* @param buffer
* the buffer
* @param content
* the content
*/
private static void addCenter(final StringList buffer, final String content)
{
addCenter(buffer, content, ' ');
}
/**
* Adds the center.
*
* @param buffer
* the buffer
* @param content
* the content
* @param letter
* the c
*/
private static void addCenter(final StringList buffer, final String content, final char letter)
{
buffer.appendln(getLine(content, letter));
}
/**
* Adds the chunk.
*
* @param buffer
* the buffer
* @param content
* the content
*/
private static void addChunk(final StringList buffer, final String content)
{
appendln(buffer, chunk(content));
}
/**
* Adds the empty.
*
* @param buffer
* the buffer
*/
private static void addEmpty(final StringList buffer)
{
buffer.appendln();
}
/**
* Adds the line.
*
* @param buffer
* the buffer
* @param c
* the c
*/
private static void addLine(final StringList buffer, final char c)
{
buffer.append(getLine(c)).appendln();
}
/**
* Adds the.
*
* @param buffer
* the buffer
* @param content
* the content
*/
private static void append(final StringList buffer, final String content)
{
buffer.append(content);
}
/**
* Appendln.
*
* @param buffer
* the buffer
* @param content
* the content
*/
private static void appendln(final StringList buffer, final String content)
{
buffer.appendln(content);
}
/**
* Chunk.
*
* @param content
* the content
* @return the string
*/
private static String chunk(final String content)
{
String result;
result = chunk(content, LENGTH_LINE);
//
return result;
}
/**
* Chunk.
*
* @param content
* the content
* @param maxLength
* the length
* @return the string
*/
private static String chunk(final String content, final int maxLength)
{
String result;
final String[] words = content.split(" ");
final StringBuffer buffer = new StringBuffer();
StringBuffer current = new StringBuffer();
for (final String word : words)
{
if (current.length() + word.length() > maxLength)
{
if (buffer.length() > 0)
{
buffer.append("\n");
}
buffer.append(current);
current = new StringBuffer(word);
}
else
{
if (current.length() > 0)
{
current.append(" ");
}
current.append(word);
}
}
if (current.length() > 0)
{
if (buffer.length() > 0)
{
buffer.append("\n");
}
buffer.append(current);
}
result = buffer.toString();
//
return result;
}
/**
* Gets the line.
*
* @param letter
* the letter
* @return the line
*/
private static String getLine(final Character letter)
{
String result;
result = StringUtils.repeat(letter.toString(), LENGTH_LINE);
//
return result;
}
/**
* Gets the line.
*
* @param content
* the content
* @param letter
* the c
* @return the line
*/
private static String getLine(final String content, final char letter)
{
String result;
result = StringUtils.center(" " + content + " ", LENGTH_LINE, letter);
//
return result;
}
/**
* Gets the topic.
*
* @param topic
* the topic
* @return the topic
*/
private static String getTopic(final Topic topic)
{
String result;
result = "=== " + topic.getTitle() + " ===";
//
return result;
}
/**
* Report.
*
* @param datas
* the datas
* @param review
* the review
* @return the string
*/
public static String report(final ReviewDatas datas, final Review review)
{
String result;
//
StringList buffer = new StringList();
//
addLine(buffer, '=');
addCenter(buffer, "Revue de la semaine en cours");
addEmpty(buffer);
addCenter(buffer, StringUtils.capitalize(LocalDateTime.now().format(DateTimeFormatter.ofPattern("EEEE dd MMMM yyyy", Locale.FRENCH))));
addLine(buffer, '=');
addEmpty(buffer);
addEmpty(buffer);
//
addLine(buffer, '=');
addEmpty(buffer);
addCenter(buffer, "Personnes participantes", '-');
for (final String participant : review.getParticipants())
{
addChunk(buffer, "* " + review.getAliases().getRealName(participant));
}
//
if (!review.getIndividualTopics().isEmpty())
{
for (final String participant : review.getParticipants())
{
addEmpty(buffer);
addLine(buffer, '=');
addEmpty(buffer);
addCenter(buffer, review.getAliases().getRealName(participant), '-');
for (final IndividualTopic topic : review.getIndividualTopics())
{
if (topic.hasParticipant(participant))
{
addEmpty(buffer);
appendln(buffer, getTopic(topic));
addEmpty(buffer);
for (final Message message : topic.getMessages(participant))
{
addChunk(buffer, "* " + message.getContent());
}
}
}
}
}
//
if (!review.getCollectiveTopics().isEmpty())
{
for (final CollectiveTopic topic : review.getCollectiveTopics())
{
addEmpty(buffer);
addLine(buffer, '=');
addCenter(buffer, topic.getTitle());
addLine(buffer, '=');
addEmpty(buffer);
for (final Message message : topic.getMessages())
{
addChunk(buffer, "* " + message.getAuthor() + " : " + message.getContent());
}
}
}
//
addEmpty(buffer);
addCenter(buffer, "Log IRC brut");
addEmpty(buffer);
for (Message message : review.getMessages())
{
addChunk(buffer, "* " + message.getAuthor() + " : " + message.getContent());
}
// Add statistics in text review.
addEmpty(buffer);
addCenter(buffer, "Statistiques");
addEmpty(buffer);
addChunk(buffer, ReviewStatsReporter.reportCurrentReviewCount(datas));
addChunk(buffer, "Horaire de début de la revue : " + review.getFormattedStartTime());
addChunk(buffer, "Horaire de fin de la revue : " + review.getFormattedEndTime());
addChunk(buffer, "Durée de la revue : " + review.getDurationInMinutes() + " minutes");
addChunk(buffer, "Nombre de personnes participantes : " + review.getParticipants().size());
addChunk(buffer, ReviewStatsReporter.reportCheckUserCountRecord(datas));
addChunk(buffer, ReviewStatsReporter.reportUserCount(datas, review.getParticipants().size()));
addChunk(buffer, ReviewStatsReporter.reportDuration(datas, review.getDurationInMinutes()));
//
result = buffer.toString();
//
return result;
}
}

View File

@ -1,6 +1,6 @@
/** /**
* Copyright (C) 2017-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr> * Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr>
* Copyright (C) 2017 Christian Pierre MOMON <cmomon@april.org>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -17,9 +17,9 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/> * along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/ */
package org.april.hebdobot.model.review; package org.april.hebdobot.bot.review;
import java.util.Set; import fr.devinsy.strings.StringSet;
/** /**
* The Class Topic. * The Class Topic.
@ -47,12 +47,20 @@ public abstract class Topic
*/ */
public abstract void add(Message message); public abstract void add(Message message);
/**
* Cancel previous.
*
* @param participant
* the participant
*/
public abstract String cancelPreviousMessage(final String participant);
/** /**
* Gets the participants. * Gets the participants.
* *
* @return the participants * @return the participants
*/ */
public abstract Set<String> getParticipants(); public abstract StringSet getParticipants();
/** /**
* Gets the title. * Gets the title.
@ -63,4 +71,13 @@ public abstract class Topic
{ {
return this.title; return this.title;
} }
/**
* Checks for message from.
*
* @param author
* the author
* @return true, if successful
*/
public abstract boolean hasMessage(String author);
} }

View File

@ -16,14 +16,14 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/> * along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/ */
package org.april.hebdobot.model.stats; package org.april.hebdobot.bot.stats;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import fr.devinsy.util.strings.StringList; import fr.devinsy.strings.StringList;
/** /**
* The Class Integers. * The Class Integers.
@ -39,7 +39,7 @@ public class IntegerBoard implements Iterable<IntegerStat>
*/ */
public IntegerBoard() public IntegerBoard()
{ {
this.integers = new HashMap<Integer, IntegerStat>(30); this.integers = new HashMap<>(30);
this.isUptodate = false; this.isUptodate = false;
this.board = new IntegerStats(this.integers.size()); this.board = new IntegerStats(this.integers.size());
} }

View File

@ -16,7 +16,7 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/> * along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/ */
package org.april.hebdobot.model.stats; package org.april.hebdobot.bot.stats;
/** /**
* The Class Stat. * The Class Stat.

View File

@ -16,7 +16,7 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/> * along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/ */
package org.april.hebdobot.model.stats; package org.april.hebdobot.bot.stats;
import java.util.Comparator; import java.util.Comparator;

View File

@ -16,12 +16,12 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/> * along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/ */
package org.april.hebdobot.model.stats; package org.april.hebdobot.bot.stats;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import org.april.hebdobot.model.stats.IntegerStatComparator.Sorting; import org.april.hebdobot.bot.stats.IntegerStatComparator.Sorting;
/** /**
* The Class Stats. * The Class Stats.

View File

@ -0,0 +1,300 @@
/**
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.stats;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import fr.devinsy.strings.StringList;
/**
* The Class LongBoard.
*/
public class LongBoard implements Iterable<LongStat>
{
private Map<Long, LongStat> longs;
private boolean isUptodate;
private LongStats board;
/**
* Instantiates a new distribution.
*/
public LongBoard()
{
this.longs = new HashMap<>(30);
this.isUptodate = false;
this.board = new LongStats(this.longs.size());
}
/**
* Adds the.
*
* @param value
* the value
*/
public void add(final Long value)
{
if (value != null)
{
LongStat stat = this.longs.get(value);
if (stat == null)
{
stat = new LongStat(value);
this.longs.put(value, stat);
}
stat.inc();
}
}
/**
* Gets the.
*
* @param value
* the value
* @return the long stat
*/
public LongStat get(final long value)
{
LongStat result;
result = this.longs.get(value);
//
return result;
}
/**
* Gets the average.
*
* @return the average
*/
public double getAverage()
{
double result;
int numerator = 0;
int denumerator = 0;
for (LongStat stat : this.longs.values())
{
numerator += stat.getCount() * stat.getValue();
denumerator += stat.getCount();
}
result = (numerator * 1. / denumerator);
//
return result;
}
/**
* Gets the count sum.
*
* @return the count sum
*/
public int getCountSum()
{
int result;
result = 0;
for (LongStat stat : this.longs.values())
{
result += stat.getCount();
}
//
return result;
}
public long getMaxValue()
{
long result;
if (isEmpty())
{
result = 0;
}
else
{
result = Long.MIN_VALUE;
for (LongStat stat : this.longs.values())
{
if (stat.getValue() > result)
{
result = stat.getValue();
}
}
}
//
return result;
}
/**
* Gets the min.
*
* @return the min
*/
public long getMinValue()
{
long result;
if (isEmpty())
{
result = 0;
}
else
{
result = Long.MAX_VALUE;
for (LongStat stat : this.longs.values())
{
if (stat.getValue() < result)
{
result = stat.getValue();
}
}
}
//
return result;
}
/**
* Gets the position of board item.
*
* @param search
* the search
* @return the position of
*/
public Integer getPositionOf(final long search)
{
Integer result;
update();
int index = 0;
boolean ended = false;
result = null;
while (!ended)
{
if (index < this.board.size())
{
long value = this.board.get(index).getValue();
if (value == search)
{
result = index + 1;
ended = true;
}
else
{
index += 1;
}
}
else
{
ended = true;
result = null;
}
}
//
return result;
}
/**
* Checks if is empty.
*
* @return true, if is empty
*/
public boolean isEmpty()
{
boolean result;
if (this.longs.size() == 0)
{
result = true;
}
else
{
result = false;
}
//
return result;
}
/**
* Iterator.
*
* @return the iterator
*/
@Override
public Iterator<LongStat> iterator()
{
Iterator<LongStat> result;
update();
result = this.board.iterator();
//
return result;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString()
{
String result;
update();
StringList buffer = new StringList();
for (LongStat stat : this.board)
{
buffer.append(String.format("%d (%d)", stat.getValue(), stat.getCount()));
}
result = buffer.toStringWithBracket();
//
return result;
}
/**
* Update.
*/
public void update()
{
if (!this.isUptodate)
{
this.board.clear();
for (LongStat stat : this.longs.values())
{
this.board.add(stat);
}
this.board.sortByValue();
Collections.reverse(this.board);
this.isUptodate = false;
}
}
}

View File

@ -0,0 +1,99 @@
/**
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.stats;
/**
* The Class Stat.
*/
public class LongStat
{
private long value;
private long count;
/**
* Instantiates a new distribution pair.
*
* @param value
* the value
*/
public LongStat(final long value)
{
this(value, 0);
}
/**
* Instantiates a new distribution pair.
*
* @param value
* the value
* @param count
* the count
*/
public LongStat(final long value, final long count)
{
this.value = value;
this.count = count;
}
/**
* Decrease count.
*/
public void dec()
{
this.count -= 1;
}
/**
* Gets the count.
*
* @return the count
*/
public long getCount()
{
long result;
result = this.count;
//
return result;
}
/**
* Gets the value.
*
* @return the value
*/
public long getValue()
{
long result;
result = this.value;
//
return result;
}
/**
* Increments count.
*/
public void inc()
{
this.count += 1;
}
}

View File

@ -0,0 +1,217 @@
/**
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.stats;
import java.util.Comparator;
/**
* The Class Stat.
*/
public class LongStatComparator implements Comparator<LongStat>
{
public enum Sorting
{
VALUE,
COUNT
}
private Sorting sorting;
/**
* Instantiates a new review data comparator.
*
* @param sorting
* the sorting
*/
public LongStatComparator(final Sorting sorting)
{
this.sorting = sorting;
}
/* (non-Javadoc)
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
*/
@Override
public int compare(final LongStat alpha, final LongStat bravo)
{
int result;
result = compare(alpha, bravo, this.sorting);
//
return result;
}
/**
* Compare.
*
* @param alpha
* the alpha
* @param bravo
* the bravo
* @return the int
*/
public static int compare(final Integer alpha, final Integer bravo)
{
int result;
//
if ((alpha == null) && (bravo == null))
{
result = 0;
}
else if (alpha == null)
{
result = -1;
}
else if (bravo == null)
{
result = +1;
}
else
{
result = alpha.compareTo(bravo);
}
//
return result;
}
/**
* Compare.
*
* @param alpha
* the alpha
* @param bravo
* the bravo
* @return the int
*/
public static int compare(final Long alpha, final Long bravo)
{
int result;
//
if ((alpha == null) && (bravo == null))
{
result = 0;
}
else if (alpha == null)
{
result = -1;
}
else if (bravo == null)
{
result = +1;
}
else
{
result = alpha.compareTo(bravo);
}
//
return result;
}
/**
* Compare.
*
* @param alpha
* the alpha
* @param bravo
* the bravo
* @param sorting
* the sorting
* @return the int
*/
public static int compare(final LongStat alpha, final LongStat bravo, final Sorting sorting)
{
int result;
if (sorting == null)
{
result = 0;
}
else
{
switch (sorting)
{
case VALUE:
result = compare(getValue(alpha), getValue(bravo));
break;
case COUNT:
result = compare(getCount(alpha), getCount(bravo));
break;
default:
result = 0;
}
}
//
return result;
}
/**
* Gets the user count.
*
* @param source
* the source
* @return the user count
*/
public static Long getCount(final LongStat source)
{
Long result;
if (source == null)
{
result = null;
}
else
{
result = source.getCount();
}
//
return result;
}
/**
* Gets the duration.
*
* @param source
* the source
* @return the duration
*/
public static Long getValue(final LongStat source)
{
Long result;
if (source == null)
{
result = null;
}
else
{
result = source.getValue();
}
//
return result;
}
}

Some files were not shown because too many files have changed in this diff Show More