Compare commits

..

60 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
87 changed files with 3256 additions and 1055 deletions

View File

@ -12,6 +12,12 @@
<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/UnitTesting/hamcrest-core-1.3.jar"/> <classpathentry kind="lib" path="lib/UnitTesting/hamcrest-core-1.3.jar"/>
<classpathentry kind="lib" path="lib/commons-cli-1.4.jar"/> <classpathentry kind="lib" path="lib/commons-cli-1.4.jar"/>
@ -29,15 +35,11 @@
<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">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/Logs/slf4j-api-1.7.25.jar" sourcepath="lib/Logs/slf4j-api-1.7.25-sources.jar"/> <classpathentry kind="lib" path="lib/Logs/slf4j-api-1.7.25.jar" sourcepath="lib/Logs/slf4j-api-1.7.25-sources.jar"/>
<classpathentry kind="lib" path="lib/Logs/slf4j-log4j12-1.7.25.jar" sourcepath="lib/Logs/slf4j-log4j12-1.7.25-sources.jar"/> <classpathentry kind="lib" path="lib/Logs/slf4j-log4j12-1.7.25.jar" sourcepath="lib/Logs/slf4j-log4j12-1.7.25-sources.jar"/>
<classpathentry kind="lib" path="lib/UnitTesting/junit-4.12.jar" sourcepath="lib/UnitTesting/junit-4.12-sources.jar"/> <classpathentry kind="lib" path="lib/UnitTesting/junit-4.12.jar" sourcepath="lib/UnitTesting/junit-4.12-sources.jar"/>
<classpathentry kind="lib" path="lib/devinsy-strings-0.8.2.jar" sourcepath="lib/devinsy-strings-0.8.2-sources.zip"/> <classpathentry kind="lib" path="lib/devinsy-strings-0.8.2.jar" sourcepath="lib/devinsy-strings-0.8.2-sources.zip"/>
<classpathentry kind="lib" path="lib/commons-lang3-3.8.jar" sourcepath="lib/commons-lang3-3.8-sources.jar"/> <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,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<faceted-project> <faceted-project>
<installed facet="java" version="1.8"/> <installed facet="java" version="11"/>
</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>

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!
#Fri May 03 17:33:54 CEST 2019 #Fri Dec 31 11:53:11 CET 2021
build.number=20 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.

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

Binary file not shown.

View File

@ -15,8 +15,8 @@ irc.channel=#april-test
irc.identify.nick= irc.identify.nick=
irc.identify.password= irc.identify.password=
# Pastebin settings. # Privatebin settings.
#pastebin.apiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX #privatebin.url=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# Twitter settings. # Twitter settings.
#twitter.consumerKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX #twitter.consumerKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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,5 +1,5 @@
/** /**
* Copyright (C) 2017-2019 Christian Pierre MOMON <cmomon@april.org> * Copyright (C) 2017-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2011-2013,2017 Nicolas Vinot <aeris@imirhil.fr> * Copyright (C) 2011-2013,2017 Nicolas Vinot <aeris@imirhil.fr>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
@ -22,11 +22,15 @@ package org.april.hebdobot.bot;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException; import java.text.ParseException;
import java.time.LocalDate;
import java.time.LocalTime; import java.time.LocalTime;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException; 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.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.CollectiveSubjectHook;
import org.april.hebdobot.bot.hooks.CommentHook; import org.april.hebdobot.bot.hooks.CommentHook;
import org.april.hebdobot.bot.hooks.CurrentHook; import org.april.hebdobot.bot.hooks.CurrentHook;
@ -35,10 +39,11 @@ import org.april.hebdobot.bot.hooks.DefaultHook;
import org.april.hebdobot.bot.hooks.FinishReviewHook; import org.april.hebdobot.bot.hooks.FinishReviewHook;
import org.april.hebdobot.bot.hooks.HelloHook; import org.april.hebdobot.bot.hooks.HelloHook;
import org.april.hebdobot.bot.hooks.HelpHook; import org.april.hebdobot.bot.hooks.HelpHook;
import org.april.hebdobot.bot.hooks.HookManager; import org.april.hebdobot.bot.hooks.Hooker;
import org.april.hebdobot.bot.hooks.IndividualSubjectHook; import org.april.hebdobot.bot.hooks.IndividualSubjectHook;
import org.april.hebdobot.bot.hooks.InputReviewHook; import org.april.hebdobot.bot.hooks.InputReviewHook;
import org.april.hebdobot.bot.hooks.LicenseHook; 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.MissingHook;
import org.april.hebdobot.bot.hooks.RecordHook; import org.april.hebdobot.bot.hooks.RecordHook;
import org.april.hebdobot.bot.hooks.StartReviewHook; import org.april.hebdobot.bot.hooks.StartReviewHook;
@ -52,9 +57,10 @@ import org.april.hebdobot.bot.review.Review;
import org.april.hebdobot.cron.CronManager; import org.april.hebdobot.cron.CronManager;
import org.april.hebdobot.cron.CronSettings; import org.april.hebdobot.cron.CronSettings;
import org.april.hebdobot.identica.IdenticaSettings; import org.april.hebdobot.identica.IdenticaSettings;
import org.april.hebdobot.pastebin.PastebinSettings; import org.april.hebdobot.privatebin.PrivatebinSettings;
import org.april.hebdobot.twitter.TwitterClient; import org.april.hebdobot.twitter.TwitterClient;
import org.april.hebdobot.twitter.TwitterSettings; import org.april.hebdobot.twitter.TwitterSettings;
import org.april.hebdobot.util.Chrono;
import org.jibble.pircbot.IrcException; import org.jibble.pircbot.IrcException;
import org.jibble.pircbot.NickAlreadyInUseException; import org.jibble.pircbot.NickAlreadyInUseException;
import org.jibble.pircbot.PircBot; import org.jibble.pircbot.PircBot;
@ -62,6 +68,7 @@ import org.quartz.SchedulerException;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import twitter4j.TwitterException; import twitter4j.TwitterException;
/** /**
@ -81,13 +88,14 @@ public class Hebdobot extends PircBot
private String reviewFileSuffix; private String reviewFileSuffix;
private LocalTime reviewWaitTime; private LocalTime reviewWaitTime;
private Review review; private Review review;
private Chrono chrono;
private IdenticaSettings identicaSettings; private IdenticaSettings identicaSettings;
private PastebinSettings pastebinSettings; private PrivatebinSettings privatebinSettings;
private TwitterSettings twitterSettings; private TwitterSettings twitterSettings;
private CronSettings cronSettings; private CronSettings cronSettings;
private UserAliases aliases; private UserAliases aliases;
private CronManager cronManager; private CronManager cronManager;
private HookManager hooker; private Hooker hooker;
/** /**
* Instantiates a new hebdobot. * Instantiates a new hebdobot.
@ -123,9 +131,10 @@ public class Hebdobot extends PircBot
this.reviewFileSuffix = null; this.reviewFileSuffix = null;
this.reviewWaitTime = null; this.reviewWaitTime = null;
this.review = null; this.review = null;
this.chrono = new Chrono();
this.identicaSettings = new IdenticaSettings(); this.identicaSettings = new IdenticaSettings();
this.pastebinSettings = new PastebinSettings(); this.privatebinSettings = new PrivatebinSettings();
this.twitterSettings = new TwitterSettings(); this.twitterSettings = new TwitterSettings();
this.cronSettings = new CronSettings(); this.cronSettings = new CronSettings();
this.aliases = new UserAliases(); this.aliases = new UserAliases();
@ -133,8 +142,11 @@ public class Hebdobot extends PircBot
this.cronManager = null; this.cronManager = null;
// //
this.hooker = new HookManager(); 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 CollectiveSubjectHook());
this.hooker.add(new CommentHook()); this.hooker.add(new CommentHook());
this.hooker.add(new CurrentHook()); this.hooker.add(new CurrentHook());
@ -148,6 +160,7 @@ public class Hebdobot extends PircBot
this.hooker.add(new StatsHook()); this.hooker.add(new StatsHook());
this.hooker.add(new StatusHook()); this.hooker.add(new StatusHook());
this.hooker.add(new AnnivHook());
this.hooker.add(new DateHook()); this.hooker.add(new DateHook());
this.hooker.add(new HelloHook()); this.hooker.add(new HelloHook());
this.hooker.add(new LicenseHook()); this.hooker.add(new LicenseHook());
@ -159,6 +172,27 @@ public class Hebdobot extends PircBot
this.hooker.add(new DefaultHook()); 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. * Close.
*/ */
@ -168,6 +202,15 @@ public class Hebdobot extends PircBot
this.dispose(); this.dispose();
} }
/**
* End review.
*/
public void endReview()
{
this.review.endReview();
this.chrono.reset();
}
/** /**
* Gets the aliases. * Gets the aliases.
* *
@ -178,6 +221,11 @@ public class Hebdobot extends PircBot
return this.aliases; return this.aliases;
} }
public Chrono getChrono()
{
return this.chrono;
}
public CronManager getCronManager() public CronManager getCronManager()
{ {
return this.cronManager; return this.cronManager;
@ -193,6 +241,32 @@ public class Hebdobot extends PircBot
return this.cronSettings; 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. * Gets the home directory.
* *
@ -214,13 +288,13 @@ public class Hebdobot extends PircBot
} }
/** /**
* Gets the pastebin settings. * Gets the privatebin settings.
* *
* @return the pastebin settings * @return the privatebin settings
*/ */
public PastebinSettings getPastebinSettings() public PrivatebinSettings getPrivatebinSettings()
{ {
return this.pastebinSettings; return this.privatebinSettings;
} }
public Review getReview() public Review getReview()
@ -319,7 +393,7 @@ public class Hebdobot extends PircBot
this.review.addRaw(new Message(sender, text)); this.review.addRaw(new Message(sender, text));
} }
text = message.replaceAll("^" + getName().replace("[", "\\[").replaceAll("]", "\\]") + "[,:]\\s*", "!"); text = text.replaceAll("^" + getName().replace("[", "\\[").replaceAll("]", "\\]") + "[,:]\\s*", "!");
try try
{ {
@ -343,36 +417,12 @@ public class Hebdobot extends PircBot
String text = message.trim(); String text = message.trim();
if (StringUtils.equalsIgnoreCase(text, "!vaten")) if (text.startsWith("!"))
{
logger.info("!die caught.");
// Die.
if (this.review == null)
{
try
{
sendMessage(sender + ", ok bye.");
sendMessage(sender, "ok bye.");
Thread.sleep(1000);
System.exit(0);
}
catch (InterruptedException exception)
{
logger.warn("Pause abort: " + exception.getMessage());
}
}
else
{
sendMessage("% Une revue est en cours, abandon impossible.");
}
}
else if (text.startsWith("!"))
{ {
logger.info("!??? caught."); logger.info("!??? caught.");
// Command unknown. // Command unknown.
sendMessage(sender + ", command unknown: " + text); sendMessage(sender, "vos commandes dans le salon public");
} }
else else
{ {
@ -388,6 +438,7 @@ public class Hebdobot extends PircBot
*/ */
public void run() throws HebdobotException public void run() throws HebdobotException
{ {
//
try try
{ {
logger.info("Cron initializing."); logger.info("Cron initializing.");
@ -396,11 +447,46 @@ public class Hebdobot extends PircBot
this.cronManager.start(); this.cronManager.start();
} }
logger.info("Cron initialized."); 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."); logger.info("Bot connection.");
this.connect(this.host, this.port); this.connect(this.host, this.port);
logger.info("Bot connected."); 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) if (this.identifyPassword == null)
{ {
logger.info("Skipped identify."); logger.info("Skipped identify.");
@ -416,25 +502,26 @@ public class Hebdobot extends PircBot
this.joinChannel(this.channel); this.joinChannel(this.channel);
logger.info("Bot ready."); logger.info("Bot ready.");
} }
catch (NickAlreadyInUseException exception)
/**
* Send chrono message.
*/
public void sendChronoMessage()
{ {
throw new HebdobotException(exception); if (this.review == null)
{
sendMessage("% durée du point : pas de revue en cours.");
} }
catch (IOException exception) else if (this.review.isEmpty())
{ {
throw new HebdobotException(exception); sendMessage("% durée du point : pas de point en cours.");
} }
catch (IrcException exception) else
{ {
throw new HebdobotException(exception); String topicTitle = this.review.getCurrentTopic().getTitle();
} String chronoValue = this.chrono.toString();
catch (SchedulerException exception)
{ sendMessage(String.format("%% durée du point %s : %s", topicTitle, chronoValue));
throw new HebdobotException("Error in cron settings.", exception);
}
catch (ParseException exception)
{
throw new HebdobotException(exception);
} }
} }
@ -484,4 +571,13 @@ public class Hebdobot extends PircBot
{ {
this.reviewWaitTime = reviewWaitTime; this.reviewWaitTime = reviewWaitTime;
} }
/**
* Stop review.
*/
public void stopReview()
{
setReview(null);
this.chrono.reset();
}
} }

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

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org> * Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -18,10 +18,13 @@
*/ */
package org.april.hebdobot.bot.hooks; package org.april.hebdobot.bot.hooks;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot; import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
/** /**
* The Class DefaultHook. * The Class DefaultHook.
*/ */
@ -29,6 +32,15 @@ public class BadCommandHook extends Hook
{ {
private static final Logger logger = LoggerFactory.getLogger(BadCommandHook.class); 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) /* (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) * @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)
*/ */

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

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org> * Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -19,11 +19,15 @@
package org.april.hebdobot.bot.hooks; package org.april.hebdobot.bot.hooks;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot; import org.april.hebdobot.bot.Hebdobot;
import org.april.hebdobot.bot.review.CollectiveTopic; import org.april.hebdobot.bot.review.CollectiveTopic;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/** /**
* The Class CollectiveSubjectHook. * The Class CollectiveSubjectHook.
*/ */
@ -31,6 +35,27 @@ public class CollectiveSubjectHook extends Hook
{ {
private static final Logger logger = LoggerFactory.getLogger(CollectiveSubjectHook.class); 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) /* (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) * @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)
*/ */
@ -52,6 +77,8 @@ public class CollectiveSubjectHook extends Hook
CollectiveTopic topic = new CollectiveTopic(message.replaceFirst("##", "").trim()); CollectiveTopic topic = new CollectiveTopic(message.replaceFirst("##", "").trim());
if (!bot.getReview().isEmpty()) if (!bot.getReview().isEmpty())
{ {
bot.sendChronoMessage();
String participants = StringUtils.join(bot.getReview().getParticipants(), " "); String participants = StringUtils.join(bot.getReview().getParticipants(), " ");
bot.sendMessage(String.format("%% %s, on va passer à la suite : %s", participants, topic.getTitle())); bot.sendMessage(String.format("%% %s, on va passer à la suite : %s", participants, topic.getTitle()));
} }
@ -60,6 +87,7 @@ public class CollectiveSubjectHook extends Hook
bot.sendMessage("% 1 minute max"); bot.sendMessage("% 1 minute max");
bot.sendMessage("% si rien à signaler vous pouvez écrire % ras"); bot.sendMessage("% si rien à signaler vous pouvez écrire % ras");
bot.sendMessage("% quand vous avez fini vous le dites par % fini"); bot.sendMessage("% quand vous avez fini vous le dites par % fini");
bot.getChrono().start();
} }
else else
{ {

View File

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org> * Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -18,10 +18,14 @@
*/ */
package org.april.hebdobot.bot.hooks; package org.april.hebdobot.bot.hooks;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot; import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/** /**
* The Class CommentHook. * The Class CommentHook.
*/ */
@ -29,6 +33,27 @@ public class CommentHook extends Hook
{ {
private static final Logger logger = LoggerFactory.getLogger(CommentHook.class); 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) /* (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) * @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)
*/ */

View File

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2018-2019 Christian Pierre MOMON <cmomon@april.org> * Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -19,6 +19,7 @@
package org.april.hebdobot.bot.hooks; package org.april.hebdobot.bot.hooks;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot; import org.april.hebdobot.bot.Hebdobot;
import org.april.hebdobot.bot.review.CollectiveTopic; import org.april.hebdobot.bot.review.CollectiveTopic;
import org.april.hebdobot.bot.review.IndividualTopic; import org.april.hebdobot.bot.review.IndividualTopic;
@ -26,6 +27,9 @@ import org.april.hebdobot.bot.review.Topic;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/** /**
* The Class CurrentHook. * The Class CurrentHook.
*/ */
@ -33,6 +37,27 @@ public class CurrentHook extends Hook
{ {
private static final Logger logger = LoggerFactory.getLogger(CurrentHook.class); 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) /* (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) * @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)
*/ */

View File

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org> * Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -23,10 +23,14 @@ import java.time.format.DateTimeFormatter;
import java.util.Locale; import java.util.Locale;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot; import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/** /**
* The Class DateHook. * The Class DateHook.
*/ */
@ -34,6 +38,27 @@ public class DateHook extends Hook
{ {
private static final Logger logger = LoggerFactory.getLogger(DateHook.class); 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) /* (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) * @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)
*/ */

View File

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org> * Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -18,10 +18,13 @@
*/ */
package org.april.hebdobot.bot.hooks; package org.april.hebdobot.bot.hooks;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot; import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
/** /**
* The Class DefaultHook. * The Class DefaultHook.
*/ */
@ -29,6 +32,20 @@ public class DefaultHook extends Hook
{ {
private static final Logger logger = LoggerFactory.getLogger(DefaultHook.class); 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) /* (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) * @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)
*/ */

View File

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2018-2019 Christian Pierre MOMON <cmomon@april.org> * Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -27,17 +27,20 @@ import java.time.format.DateTimeFormatter;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot; import org.april.hebdobot.bot.Hebdobot;
import org.april.hebdobot.bot.review.ReviewReporter; import org.april.hebdobot.bot.review.ReviewReporter;
import org.april.hebdobot.bot.stats.ReviewData; import org.april.hebdobot.bot.stats.ReviewData;
import org.april.hebdobot.bot.stats.ReviewDatas; import org.april.hebdobot.bot.stats.ReviewDatas;
import org.april.hebdobot.bot.stats.ReviewDatasFile; import org.april.hebdobot.bot.stats.ReviewDatasFile;
import org.april.hebdobot.bot.stats.ReviewStatsReporter; import org.april.hebdobot.bot.stats.ReviewStatsReporter;
import org.april.hebdobot.pastebin.PastebinClient; import org.april.hebdobot.privatebin.PrivatebinClient;
import org.april.hebdobot.pastebin.Private;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/** /**
* The Class FinishReviewHook. * The Class FinishReviewHook.
*/ */
@ -47,6 +50,27 @@ public class FinishReviewHook extends Hook
public static String DEFAULT_SUFFIX = "-log-irc-revue-hebdomadaire.txt"; 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) /* (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) * @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)
*/ */
@ -81,7 +105,8 @@ public class FinishReviewHook extends Hook
else else
{ {
// End the review. // End the review.
bot.getReview().endReview(); bot.sendChronoMessage();
bot.endReview();
// Load and update review statistics. // Load and update review statistics.
ReviewDatas datas; ReviewDatas datas;
@ -113,14 +138,14 @@ public class FinishReviewHook extends Hook
// Pastebin the review text. // Pastebin the review text.
String pastebinUrl; String pastebinUrl;
if (bot.getPastebinSettings().isValid()) if (bot.getPrivatebinSettings().isValid())
{ {
logger.info("Pastebin the review."); logger.info("Pastebin the review.");
try try
{ {
PastebinClient pastebinClient = new PastebinClient(bot.getPastebinSettings().getApiKey()); PrivatebinClient pastebinClient = new PrivatebinClient(bot.getPrivatebinSettings());
pastebinUrl = pastebinClient.paste(reviewText, "Revue APRIL " + date, Private.UNLISTED); pastebinUrl = pastebinClient.paste(reviewText);
} }
catch (final Exception exception) catch (final Exception exception)
{ {
@ -158,12 +183,13 @@ public class FinishReviewHook extends Hook
} }
// Send conclusion message in channel. // Send conclusion message in channel.
bot.sendMessage("% " + ReviewStatsReporter.reportReviewCount(datas)); bot.checkReviewAnniversary();
bot.sendMessage("% " + ReviewStatsReporter.reportCurrentReviewCount(datas));
bot.sendMessage("% Compte-rendu de la revue : " + pastebinUrl); bot.sendMessage("% Compte-rendu de la revue : " + pastebinUrl);
bot.sendMessage("% Durée de la revue : " + bot.getReview().getDurationInMinutes() + " minutes"); bot.sendMessage("% Durée de la revue : " + bot.getReview().getDurationInMinutes() + " minutes");
bot.sendMessage("% Nombre de personnes participantes : " + bot.getReview().getParticipants().size()); bot.sendMessage("% Nombre de personnes participantes : " + bot.getReview().getParticipants().size());
bot.sendMessage("% " + ReviewStatsReporter.reportNewUserCountRecord(datas)); bot.sendMessage("% " + ReviewStatsReporter.reportCheckUserCountRecord(datas));
bot.sendMessage(bot.getReview().getOwner(), ReviewStatsReporter.reportUserCount(datas, bot.getReview().getParticipants().size())); bot.sendMessage(bot.getReview().getOwner(), ReviewStatsReporter.reportUserCount(datas, bot.getReview().getParticipants().size()));
bot.sendMessage(bot.getReview().getOwner(), ReviewStatsReporter.reportDuration(datas, bot.getReview().getDurationInMinutes())); bot.sendMessage(bot.getReview().getOwner(), ReviewStatsReporter.reportDuration(datas, bot.getReview().getDurationInMinutes()));

View File

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org> * Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -19,10 +19,12 @@
package org.april.hebdobot.bot.hooks; package org.april.hebdobot.bot.hooks;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot; import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils; import fr.devinsy.strings.StringsUtils;
/** /**
@ -32,6 +34,27 @@ public class HelloHook extends Hook
{ {
private static final Logger logger = LoggerFactory.getLogger(HelloHook.class); 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) /* (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) * @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)
*/ */

View File

@ -1,110 +0,0 @@
/**
* 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.hooks;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The Class HelpByCommandHook.
*/
public class HelpByCommandHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(HelpByCommandHook.class);
private static final Pattern PATTERN = Pattern.compile("^!help\\s+(\\S+)$");
/* (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;
Matcher matcher = PATTERN.matcher(message);
if (matcher.find())
{
String command = matcher.group(1);
if (StringUtils.equals(command, "help"))
{
bot.sendMessage(sender + ": help display help commands");
bot.sendMessage(sender + ": help command display help on specific command");
}
else if (StringUtils.equals(command, "ignore"))
{
bot.sendMessage(sender + ": ignore host:service ignore a specific probe");
bot.sendMessage(sender + ": ignore list ignore probes");
}
else if (StringUtils.equals(command, "unignore"))
{
bot.sendMessage(sender + ": unignore host:service ignore a specific probe");
}
else if (StringUtils.equals(command, "ack"))
{
bot.sendMessage(sender + ": ack unack an alert");
}
else if (StringUtils.equals(command, "unack"))
{
bot.sendMessage(sender + ": unack unack an alert");
}
else if (StringUtils.equalsAnyIgnoreCase(command, "!mute", "!tagueule", "!ta gueule", "!chut", "!sieste"))
{
bot.sendMessage(sender + ": mute|tagueule|chut|sieste mute alert display");
}
else if (StringUtils.equalsAnyIgnoreCase(command, "!unmute"))
{
bot.sendMessage(sender + ": unmute mute alert display");
}
else if (StringUtils.equals(command, "list"))
{
bot.sendMessage(sender + ": list display current alerts");
}
else if (StringUtils.equals(command, "refresh"))
{
bot.sendMessage(sender + ": refresh update alert list");
}
else if (StringUtils.equals(command, "recheck"))
{
bot.sendMessage(sender + ": recheck reschedule current alerts");
}
else
{
bot.sendMessage(sender + ": no help available for this command");
}
result = true;
}
else
{
result = false;
}
//
return result;
}
}

View File

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org> * Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -18,60 +18,141 @@
*/ */
package org.april.hebdobot.bot.hooks; package org.april.hebdobot.bot.hooks;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot; import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/** /**
* The Class HelpHook. * The Class HelpHook.
*/ */
public class HelpHook extends Hook 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); 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) /* (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) * @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 @Override
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname, public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
final String message) final String message) throws HebdobotException
{ {
boolean result; boolean result;
if (StringUtils.equalsAnyIgnoreCase(message, "!aide", "!help")) if (StringUtils.equalsAnyIgnoreCase(message, "!aide", "!help", "!aide hebdobot", "!help hebdobot"))
{ {
logger.info("!help caught."); logger.info("!help caught.");
// Help. // Help.
bot.sendMessage(sender, "Bienvenue " + sender); bot.sendMessage(sender,
bot.sendMessage(sender, "Je suis " + bot.getName() + ", le robot de gestion des revues hebdomadaires de l'APRIL."); 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, "Voici les commandes que je comprends :");
bot.sendMessage(sender, " "); bot.sendMessage(sender, " ");
bot.sendMessage(sender, " !aide,!help : afficher cette aide"); 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, " !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 individuel");
bot.sendMessage(sender, " ## titre  : démarrer un sujet collectif"); bot.sendMessage(sender, " ## titre  : démarrer un sujet collectif");
bot.sendMessage(sender, " % message  : traiter comme un commentaire"); 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, " !courant : afficher le sujet en cours");
bot.sendMessage(sender, " !manquants : afficher qui n'a pas participé sur le dernier sujet");
bot.sendMessage(sender, " !fin : terminer la revue en cours"); bot.sendMessage(sender, " !fin : terminer la revue en cours");
bot.sendMessage(sender, " !stop  : abandonner la revue en cours"); bot.sendMessage(sender, " !stop  : abandonner la revue en cours");
bot.sendMessage(sender, " !licence   : afficher la licence du logiciel Hebdobot et le lien vers ses sources");
bot.sendMessage(sender, " !record : affiche le record de participation à la revue");
bot.sendMessage(sender, " !stats : statistiques sur les précédentes revues");
bot.sendMessage(sender, " !version   : afficher la version d'Hebdobot");
bot.sendMessage(sender, " "); bot.sendMessage(sender, " ");
bot.sendMessage(sender, "Autres commandes de dialogue : !bonjour, !date, !hello, !merci, !salut"); bot.sendMessage(sender,
"Autres commandes : !anniv, !bonjour, !chrono, !date, !hello, !licence, !manquants, !merci, !record, !salut, !stats, !status, !version");
result = true; result = true;
} }
else else
{
String token = extractTargetHelp(message);
if (token == null)
{ {
result = false; 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; 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

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org> * Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -21,11 +21,23 @@ package org.april.hebdobot.bot.hooks;
import org.april.hebdobot.HebdobotException; import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot; import org.april.hebdobot.bot.Hebdobot;
import fr.devinsy.strings.StringList;
/** /**
* The Class Hook. * The Class Hook.
*/ */
public abstract 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. * Attempt process.

View File

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2018-2019 Christian Pierre MOMON <cmomon@april.org> * Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -29,18 +29,18 @@ import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList; import fr.devinsy.strings.StringList;
/** /**
* The Interface MessageHook. * The class Hooker, a hook manager.
*/ */
public class HookManager public class Hooker
{ {
private static final Logger logger = LoggerFactory.getLogger(HookManager.class); private static final Logger logger = LoggerFactory.getLogger(Hooker.class);
private ArrayList<Hook> hooks; private ArrayList<Hook> hooks;
/** /**
* Instantiates a new hook manager. * Instantiates a new hook manager.
*/ */
public HookManager() public Hooker()
{ {
this.hooks = new ArrayList<>(30); this.hooks = new ArrayList<>(30);
} }
@ -59,6 +59,46 @@ public class HookManager
} }
} }
/**
* 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. * Attempt process.
* *

View File

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org> * Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -19,11 +19,15 @@
package org.april.hebdobot.bot.hooks; package org.april.hebdobot.bot.hooks;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot; import org.april.hebdobot.bot.Hebdobot;
import org.april.hebdobot.bot.review.IndividualTopic; import org.april.hebdobot.bot.review.IndividualTopic;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/** /**
* The Class IndividualSubjectHook. * The Class IndividualSubjectHook.
*/ */
@ -31,6 +35,27 @@ public class IndividualSubjectHook extends Hook
{ {
private static final Logger logger = LoggerFactory.getLogger(IndividualSubjectHook.class); 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) /* (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) * @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)
*/ */
@ -52,6 +77,8 @@ public class IndividualSubjectHook extends Hook
IndividualTopic topic = new IndividualTopic(message.replaceFirst("#", "").trim()); IndividualTopic topic = new IndividualTopic(message.replaceFirst("#", "").trim());
if (!bot.getReview().isEmpty()) if (!bot.getReview().isEmpty())
{ {
bot.sendChronoMessage();
String participants = StringUtils.join(bot.getReview().getParticipants(), " "); String participants = StringUtils.join(bot.getReview().getParticipants(), " ");
bot.sendMessage(String.format("%% %s, on va passer à la suite : %s", participants, topic.getTitle())); bot.sendMessage(String.format("%% %s, on va passer à la suite : %s", participants, topic.getTitle()));
} }
@ -59,6 +86,7 @@ public class IndividualSubjectHook extends Hook
bot.sendMessage("Sujet individuel : " + topic.getTitle()); bot.sendMessage("Sujet individuel : " + topic.getTitle());
bot.sendMessage("% si rien à signaler vous pouvez écrire % ras"); bot.sendMessage("% si rien à signaler vous pouvez écrire % ras");
bot.sendMessage("% quand vous avez fini vous le dites par % fini"); bot.sendMessage("% quand vous avez fini vous le dites par % fini");
bot.getChrono().start();
} }
else else
{ {

View File

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org> * Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -18,11 +18,14 @@
*/ */
package org.april.hebdobot.bot.hooks; package org.april.hebdobot.bot.hooks;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot; import org.april.hebdobot.bot.Hebdobot;
import org.april.hebdobot.bot.review.Message; import org.april.hebdobot.bot.review.Message;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
/** /**
* The Class DefaultHook. * The Class DefaultHook.
*/ */
@ -30,6 +33,20 @@ public class InputReviewHook extends Hook
{ {
private static final Logger logger = LoggerFactory.getLogger(InputReviewHook.class); 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) /* (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) * @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)
*/ */

View File

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org> * Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -18,10 +18,12 @@
*/ */
package org.april.hebdobot.bot.hooks; package org.april.hebdobot.bot.hooks;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot; import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils; import fr.devinsy.strings.StringsUtils;
/** /**
@ -31,6 +33,27 @@ public class LicenseHook extends Hook
{ {
private static final Logger logger = LoggerFactory.getLogger(LicenseHook.class); 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) /* (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) * @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)
*/ */
@ -44,8 +67,8 @@ public class LicenseHook extends Hook
{ {
logger.info("!licence caught."); logger.info("!licence caught.");
bot.sendMessage(sender bot.sendMessage(
+ ", Hebdobot est un logiciel libre de l'April sous licence GNU AGPL (sources : https://agir.april.org/projects/hebdobot/repository)."); "Hebdobot est un logiciel libre de l'April sous licence GNU AGPLv3+, sources : https://forge.april.org/adminsys/hebdobot");
result = true; result = true;
} }

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

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2018-2019 Christian Pierre MOMON <cmomon@april.org> * Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -22,12 +22,15 @@ import java.util.Collection;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot; import org.april.hebdobot.bot.Hebdobot;
import org.april.hebdobot.bot.review.Topic; import org.april.hebdobot.bot.review.Topic;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringSet; import fr.devinsy.strings.StringSet;
import fr.devinsy.strings.StringsUtils;
/** /**
* The Class MissingHook. * The Class MissingHook.
@ -36,6 +39,27 @@ public class MissingHook extends Hook
{ {
private static final Logger logger = LoggerFactory.getLogger(MissingHook.class); 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) /* (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) * @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)
*/ */
@ -59,7 +83,7 @@ public class MissingHook extends Hook
Topic topic = bot.getReview().getCurrentTopic(); Topic topic = bot.getReview().getCurrentTopic();
if (topic == null) if (topic == null)
{ {
bot.sendMessage("Pas sujet en cours."); bot.sendMessage("Pas de sujet en cours.");
} }
else else
{ {

View File

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org> * Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -20,6 +20,8 @@ package org.april.hebdobot.bot.hooks;
import java.io.File; 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.Hebdobot;
import org.april.hebdobot.bot.stats.ReviewDatas; import org.april.hebdobot.bot.stats.ReviewDatas;
import org.april.hebdobot.bot.stats.ReviewDatasFile; import org.april.hebdobot.bot.stats.ReviewDatasFile;
@ -27,6 +29,9 @@ import org.april.hebdobot.bot.stats.ReviewStatsReporter;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/** /**
* The Class RecordHook. * The Class RecordHook.
*/ */
@ -34,6 +39,27 @@ public class RecordHook extends Hook
{ {
private static final Logger logger = LoggerFactory.getLogger(RecordHook.class); 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) /* (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) * @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)
*/ */
@ -43,7 +69,7 @@ public class RecordHook extends Hook
{ {
boolean result; boolean result;
if (message.equals("!record")) if (StringUtils.equalsIgnoreCase(message, "!record"))
{ {
logger.info("!record caught."); logger.info("!record caught.");
@ -55,7 +81,7 @@ public class RecordHook extends Hook
{ {
ReviewDatas datas = ReviewDatasFile.load(reviewDataFile); ReviewDatas datas = ReviewDatasFile.load(reviewDataFile);
datas.clean(); datas.clean();
bot.sendMessage("% " + ReviewStatsReporter.reportUserCountRecord(datas)); bot.sendMessage(ReviewStatsReporter.reportUserCountRecord(datas));
} }
else else
{ {

View File

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org> * Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -21,12 +21,16 @@ package org.april.hebdobot.bot.hooks;
import java.time.LocalTime; import java.time.LocalTime;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot; import org.april.hebdobot.bot.Hebdobot;
import org.april.hebdobot.bot.review.Review; import org.april.hebdobot.bot.review.Review;
import org.quartz.SchedulerException; import org.quartz.SchedulerException;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/** /**
* The Class StartReviewHook. * The Class StartReviewHook.
*/ */
@ -34,6 +38,27 @@ public class StartReviewHook extends Hook
{ {
private static final Logger logger = LoggerFactory.getLogger(StartReviewHook.class); 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) /* (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) * @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)
*/ */
@ -74,6 +99,7 @@ public class StartReviewHook extends Hook
bot.setReview(new Review(sender, bot.getAliases())); bot.setReview(new Review(sender, bot.getAliases()));
bot.sendMessage(sender, "Bonjour " + sender + ", vous êtes le conducteur de réunion."); bot.sendMessage(sender, "Bonjour " + sender + ", vous êtes le conducteur de réunion.");
bot.sendMessage(sender, "Pour terminer la réunion, tapez \"!fin\""); bot.sendMessage(sender, "Pour terminer la réunion, tapez \"!fin\"");
bot.checkReviewAnniversary();
bot.sendMessage("% Début de la réunion hebdomadaire"); bot.sendMessage("% Début de la réunion hebdomadaire");
bot.sendMessage( bot.sendMessage(
"% rappel : toute ligne commençant par % sera considérée comme un commentaire et non prise en compte dans la synthèse"); "% rappel : toute ligne commençant par % sera considérée comme un commentaire et non prise en compte dans la synthèse");

View File

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org> * Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -20,6 +20,8 @@ package org.april.hebdobot.bot.hooks;
import java.io.File; 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.Hebdobot;
import org.april.hebdobot.bot.stats.ReviewDatas; import org.april.hebdobot.bot.stats.ReviewDatas;
import org.april.hebdobot.bot.stats.ReviewDatasFile; import org.april.hebdobot.bot.stats.ReviewDatasFile;
@ -27,6 +29,9 @@ import org.april.hebdobot.bot.stats.ReviewStatsReporter;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/** /**
* The Class StatsHook. * The Class StatsHook.
*/ */
@ -34,6 +39,27 @@ public class StatsHook extends Hook
{ {
private static final Logger logger = LoggerFactory.getLogger(StatsHook.class); 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) /* (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) * @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)
*/ */
@ -43,7 +69,7 @@ public class StatsHook extends Hook
{ {
boolean result; boolean result;
if (message.equals("!stats")) if (StringUtils.equalsIgnoreCase(message, "!stats"))
{ {
logger.info("!stats caught."); logger.info("!stats caught.");
@ -56,6 +82,9 @@ public class StatsHook extends Hook
{ {
ReviewDatas datas = ReviewDatasFile.load(reviewDataFile); ReviewDatas datas = ReviewDatasFile.load(reviewDataFile);
datas.clean(); 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.reportUserCountBoard(datas));
bot.sendMessage("% " + ReviewStatsReporter.reportDurationBoard(datas)); bot.sendMessage("% " + ReviewStatsReporter.reportDurationBoard(datas));
} }

View File

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org> * Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -19,10 +19,14 @@
package org.april.hebdobot.bot.hooks; package org.april.hebdobot.bot.hooks;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot; import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/** /**
* The Class StatusHook. * The Class StatusHook.
*/ */
@ -30,6 +34,27 @@ public class StatusHook extends Hook
{ {
private static final Logger logger = LoggerFactory.getLogger(StatusHook.class); 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) /* (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) * @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)
*/ */
@ -55,7 +80,7 @@ public class StatusHook extends Hook
} }
bot.sendMessage(sender, " Alias settings : " + (bot.getAliases().size())); bot.sendMessage(sender, " Alias settings : " + (bot.getAliases().size()));
bot.sendMessage(sender, " Identica settings : " + (bot.getIdenticaSettings().isValid())); bot.sendMessage(sender, " Identica settings : " + (bot.getIdenticaSettings().isValid()));
bot.sendMessage(sender, " Pastebin settings : " + (bot.getPastebinSettings().isValid())); bot.sendMessage(sender, " Privatebin settings : " + bot.getPrivatebinSettings().toString());
bot.sendMessage(sender, " Twitter settings : " + (bot.getTwitterSettings().isValid())); bot.sendMessage(sender, " Twitter settings : " + (bot.getTwitterSettings().isValid()));
bot.sendMessage(sender, " Cron settings : " + (bot.getCronSettings().size())); bot.sendMessage(sender, " Cron settings : " + (bot.getCronSettings().size()));
bot.sendMessage(sender, " Review Wait Time : " + (bot.getReviewWaitTime())); bot.sendMessage(sender, " Review Wait Time : " + (bot.getReviewWaitTime()));

View File

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2018-2019 Christian Pierre MOMON <cmomon@april.org> * Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -19,10 +19,14 @@
package org.april.hebdobot.bot.hooks; package org.april.hebdobot.bot.hooks;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot; import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/** /**
* The Class StopReviewHook. * The Class StopReviewHook.
*/ */
@ -30,6 +34,27 @@ public class StopReviewHook extends Hook
{ {
private static final Logger logger = LoggerFactory.getLogger(StopReviewHook.class); 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) /* (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) * @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)
*/ */
@ -55,7 +80,7 @@ public class StopReviewHook extends Hook
else else
{ {
bot.sendMessage("Abandon de la revue en cours."); bot.sendMessage("Abandon de la revue en cours.");
bot.setReview(null); bot.stopReview();
} }
result = true; result = true;

View File

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org> * Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -19,10 +19,12 @@
package org.april.hebdobot.bot.hooks; package org.april.hebdobot.bot.hooks;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot; import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils; import fr.devinsy.strings.StringsUtils;
/** /**
@ -32,6 +34,27 @@ public class ThanksHook extends Hook
{ {
private static final Logger logger = LoggerFactory.getLogger(ThanksHook.class); 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) /* (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) * @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)
*/ */

View File

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org> * Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -18,11 +18,16 @@
*/ */
package org.april.hebdobot.bot.hooks; 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.Hebdobot;
import org.april.hebdobot.util.BuildInformation; import org.april.hebdobot.util.BuildInformation;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/** /**
* The Class VersionHook. * The Class VersionHook.
*/ */
@ -30,6 +35,27 @@ public class VersionHook extends Hook
{ {
private static final Logger logger = LoggerFactory.getLogger(VersionHook.class); 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) /* (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) * @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)
*/ */
@ -39,7 +65,7 @@ public class VersionHook extends Hook
{ {
boolean result; boolean result;
if (message.equals("!version")) if (StringUtils.equalsIgnoreCase(message, "!version"))
{ {
logger.info("!version caught."); logger.info("!version caught.");
bot.sendMessage(new BuildInformation().toString()); bot.sendMessage(new BuildInformation().toString());

View File

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2017-2019 Christian Pierre MOMON <cmomon@april.org> * 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>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
@ -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.
* *
@ -77,4 +102,23 @@ public class CollectiveTopic extends Topic
// //
return result; 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-2019 Christian Pierre MOMON <cmomon@april.org> * 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>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
@ -19,9 +19,6 @@
*/ */
package org.april.hebdobot.bot.review; package org.april.hebdobot.bot.review;
import java.util.HashMap;
import java.util.Map;
import fr.devinsy.strings.StringSet; import fr.devinsy.strings.StringSet;
/** /**
@ -29,7 +26,7 @@ import fr.devinsy.strings.StringSet;
*/ */
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.
@ -41,7 +38,7 @@ public class IndividualTopic extends Topic
{ {
super(title); super(title);
this.messages = new HashMap<>(); this.messages = new MessageMap();
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -58,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.
* *
@ -89,6 +109,33 @@ public class IndividualTopic extends Topic
return result; 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;
}
/** /**
* Checks for participant. * Checks for participant.
* *

View File

@ -1,6 +1,5 @@
/** /**
* Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org> * Copyright (C) 2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -17,26 +16,22 @@
* 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.pastebin; package org.april.hebdobot.bot.review;
import org.junit.Test; import java.util.HashMap;
/** /**
* The Class PastebinClientTest. * The Class MessageMap.
*/ */
public class PastebinClientTest public class MessageMap extends HashMap<String, Messages>
{ {
private final PastebinClient client = new PastebinClient("b95ea42d539ec9dca02a7da1f5b229c7"); private static final long serialVersionUID = 2324236890989710448L;
/** /**
* Test paste. * Instantiates a new message map.
*
* @throws Exception
* the exception
*/ */
@Test public MessageMap()
public void testPaste() throws Exception
{ {
System.out.println(this.client.paste("ééé", Expiration.MINUTE_10)); super();
} }
} }

View File

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org> * Copyright (C) 2017-2019 Christian Pierre MOMON <cmomon@april.org>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -20,6 +20,8 @@ package org.april.hebdobot.bot.review;
import java.util.LinkedList; import java.util.LinkedList;
import org.apache.commons.lang3.StringUtils;
/** /**
* The Class MessageLinkedList. * The Class MessageLinkedList.
*/ */
@ -34,4 +36,29 @@ public class Messages extends LinkedList<Message>
{ {
super(); 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

@ -282,7 +282,7 @@ public class ReviewReporter
// //
addLine(buffer, '='); addLine(buffer, '=');
addEmpty(buffer); addEmpty(buffer);
addCenter(buffer, "Participants", '-'); addCenter(buffer, "Personnes participantes", '-');
for (final String participant : review.getParticipants()) for (final String participant : review.getParticipants())
{ {
addChunk(buffer, "* " + review.getAliases().getRealName(participant)); addChunk(buffer, "* " + review.getAliases().getRealName(participant));
@ -343,12 +343,12 @@ public class ReviewReporter
addEmpty(buffer); addEmpty(buffer);
addCenter(buffer, "Statistiques"); addCenter(buffer, "Statistiques");
addEmpty(buffer); addEmpty(buffer);
addChunk(buffer, ReviewStatsReporter.reportReviewCount(datas)); addChunk(buffer, ReviewStatsReporter.reportCurrentReviewCount(datas));
addChunk(buffer, "Horaire de début de la revue : " + review.getFormattedStartTime()); addChunk(buffer, "Horaire de début de la revue : " + review.getFormattedStartTime());
addChunk(buffer, "Horaire de fin de la revue : " + review.getFormattedEndTime()); addChunk(buffer, "Horaire de fin de la revue : " + review.getFormattedEndTime());
addChunk(buffer, "Durée de la revue : " + review.getDurationInMinutes() + " minutes"); addChunk(buffer, "Durée de la revue : " + review.getDurationInMinutes() + " minutes");
addChunk(buffer, "Nombre de personnes participantes : " + review.getParticipants().size()); addChunk(buffer, "Nombre de personnes participantes : " + review.getParticipants().size());
addChunk(buffer, ReviewStatsReporter.reportNewUserCountRecord(datas)); addChunk(buffer, ReviewStatsReporter.reportCheckUserCountRecord(datas));
addChunk(buffer, ReviewStatsReporter.reportUserCount(datas, review.getParticipants().size())); addChunk(buffer, ReviewStatsReporter.reportUserCount(datas, review.getParticipants().size()));
addChunk(buffer, ReviewStatsReporter.reportDuration(datas, review.getDurationInMinutes())); addChunk(buffer, ReviewStatsReporter.reportDuration(datas, review.getDurationInMinutes()));

View File

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2017-2019 Christian Pierre MOMON <cmomon@april.org> * 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>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
@ -47,6 +47,14 @@ 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.
* *
@ -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

@ -106,6 +106,70 @@ public class ReviewDatas extends ArrayList<ReviewData>
return result; return result;
} }
/**
* Gets the averatge duration.
*
* @return the averatge duration
*/
public double getAveratgeDuration()
{
double result;
if (isEmpty())
{
result = 0;
}
else
{
result = 0;
int count = 0;
for (ReviewData data : this)
{
if (data.getDuration() != null)
{
count += 1;
result += data.getDuration();
}
}
if (count != 0)
{
result = result / count;
}
}
//
return result;
}
/**
* Gets the averatge user count.
*
* @return the averatge user count
*/
public double getAveratgeUserCount()
{
double result;
if (isEmpty())
{
result = 0;
}
else
{
result = 0;
for (ReviewData data : this)
{
result += data.getUserCount();
}
result = result / size();
}
//
return result;
}
/** /**
* Gets the by year. * Gets the by year.
* *
@ -183,6 +247,35 @@ public class ReviewDatas extends ArrayList<ReviewData>
return result; return result;
} }
/**
* Gets the max duration.
*
* @return the max duration
*/
public long getMaxDuration()
{
long result;
if (isEmpty())
{
result = 0;
}
else
{
result = Long.MIN_VALUE;
for (ReviewData data : this)
{
if ((data.getDuration() != null) && (data.getUserCount() > result))
{
result = data.getDuration();
}
}
}
//
return result;
}
/** /**
* Gets the max user count. * Gets the max user count.
* *
@ -212,6 +305,35 @@ public class ReviewDatas extends ArrayList<ReviewData>
return result; return result;
} }
/**
* Gets the min duration.
*
* @return the min duration
*/
public long getMinDuration()
{
long result;
if (isEmpty())
{
result = 0;
}
else
{
result = Long.MAX_VALUE;
for (ReviewData data : this)
{
if ((data.getDuration() != null) && (data.getDuration() < result))
{
result = data.getDuration();
}
}
}
//
return result;
}
/** /**
* Gets the min user count. * Gets the min user count.
* *
@ -298,32 +420,60 @@ public class ReviewDatas extends ArrayList<ReviewData>
/** /**
* Reverse. * Reverse.
*/ */
public void reverse() public ReviewDatas reverse()
{ {
ReviewDatas result;
Collections.reverse(this); Collections.reverse(this);
result = this;
//
return result;
} }
/** /**
* Sort by date. * Sort by date.
*/ */
public void sortByDate() public ReviewDatas sortByDate()
{ {
ReviewDatas result;
Collections.sort(this, new ReviewDataComparator(Sorting.DATE)); Collections.sort(this, new ReviewDataComparator(Sorting.DATE));
result = this;
//
return result;
} }
/** /**
* Sort by duration. * Sort by duration.
*/ */
public void sortByDuration() public ReviewDatas sortByDuration()
{ {
ReviewDatas result;
Collections.sort(this, new ReviewDataComparator(Sorting.DURATION)); Collections.sort(this, new ReviewDataComparator(Sorting.DURATION));
result = this;
//
return result;
} }
/** /**
* Sort by user count. * Sort by user count.
*/ */
public void sortByUserCount() public ReviewDatas sortByUserCount()
{ {
ReviewDatas result;
Collections.sort(this, new ReviewDataComparator(Sorting.USERCOUNT)); Collections.sort(this, new ReviewDataComparator(Sorting.USERCOUNT));
result = this;
//
return result;
} }
} }

View File

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2017-2019 Christian Pierre MOMON <cmomon@april.org> * Copyright (C) 2017-2021 Christian Pierre MOMON <cmomon@april.org>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -102,7 +102,83 @@ public class ReviewStatsReporter
{ {
double result; double result;
result = percent(new Double(a).doubleValue(), new Double(b).doubleValue()); result = percent(Double.valueOf(a).doubleValue(), Double.valueOf(b).doubleValue());
//
return result;
}
/**
* Report new max. The current user count is found in last review by date.
*
* @param datas
* the datas
* @return the string
*/
public static String reportCheckUserCountRecord(final ReviewDatas datas)
{
String result;
if ((datas == null) || (datas.isEmpty()) || (datas.size() == 1))
{
result = "Absence de statistique sur la participation.";
}
else
{
ReviewDatas reviews = new ReviewDatas(datas);
reviews.sortByDate();
ReviewData lastReview = datas.getLastByIndex();
reviews.removeLast();
reviews.sortByUserCount();
ReviewData recordReview = reviews.getLastByIndex();
if (lastReview.getUserCount() < recordReview.getUserCount())
{
double averageUserCount = reviews.getAveratgeUserCount();
result = String.format("La participation moyenne aux revues est de %02.1f personnes.", averageUserCount);
}
else if (lastReview.getUserCount() == recordReview.getUserCount())
{
String lastRecordDate = recordReview.getDate().format(DateTimeFormatter.ofPattern("EEEE dd MMMM yyyy", Locale.FRENCH));
result = String.format("\\o/ Record de participation égalé \\o/ Le précédent record de %d personnes était le %s.",
recordReview.getUserCount(), lastRecordDate);
}
else
{
String lastRecordDate = recordReview.getDate().format(DateTimeFormatter.ofPattern("EEEE dd MMMM yyyy", Locale.FRENCH));
result = String.format(
"*\\o/* Nouveau record de participation : %d personnes ! *\\o/* Le précédent record était de %d personnes le %s.",
lastReview.getUserCount(), recordReview.getUserCount(), lastRecordDate);
}
}
//
return result;
}
/**
* Report review count.
*
* @param datas
* the datas
* @return the string
*/
public static String reportCurrentReviewCount(final ReviewDatas datas)
{
String result;
if ((datas == null) || (datas.isEmpty()))
{
result = "Pas de statistique sur le nombre de revues.";
}
else
{
long currentYear = LocalDateTime.now().getYear();
long reviewYearCount = datas.countByYear(currentYear);
result = String.format("C'était la %d%s revue hebdomadaire de l'April, la %d%s de l'année %d.", datas.size(), numberSuffix(datas.size()),
reviewYearCount, numberSuffix(reviewYearCount), currentYear);
}
// //
return result; return result;
@ -169,55 +245,6 @@ public class ReviewStatsReporter
return result; return result;
} }
/**
* Report new max. The current user count is found in last review by date.
*
* @param datas
* the datas
* @return the string
*/
public static String reportNewUserCountRecord(final ReviewDatas datas)
{
String result;
if ((datas == null) || (datas.isEmpty()) || (datas.size() == 1))
{
result = "Absence de statistique sur la participation.";
}
else
{
ReviewDatas reviews = new ReviewDatas(datas);
reviews.sortByDate();
ReviewData lastReview = datas.getLastByIndex();
reviews.removeLast();
reviews.sortByUserCount();
ReviewData recordReview = reviews.getLastByIndex();
if (lastReview.getUserCount() < recordReview.getUserCount())
{
String lastRecordDate = recordReview.getDate().format(DateTimeFormatter.ofPattern("EEEE dd MMMM yyyy", Locale.FRENCH));
result = String.format("Le dernier record de participation est de %d personnes le %s.", recordReview.getUserCount(), lastRecordDate);
}
else if (lastReview.getUserCount() == recordReview.getUserCount())
{
result = "Record de participation égalé.";
String lastRecordDate = recordReview.getDate().format(DateTimeFormatter.ofPattern("EEEE dd MMMM yyyy", Locale.FRENCH));
result = String.format("\\o/ Record de participation égalé \\o/ Le précédent record était de %d personnes le %s.",
recordReview.getUserCount(), lastRecordDate);
}
else
{
String lastRecordDate = recordReview.getDate().format(DateTimeFormatter.ofPattern("EEEE dd MMMM yyyy", Locale.FRENCH));
result = String.format(
"*\\o/* Nouveau record de participation : %d personnes ! *\\o/* Le précédent record était de %d personnes le %s.",
lastReview.getUserCount(), recordReview.getUserCount(), lastRecordDate);
}
}
//
return result;
}
/** /**
* Report review count. * Report review count.
* *
@ -235,11 +262,61 @@ public class ReviewStatsReporter
} }
else else
{ {
long currentYear = LocalDateTime.now().getYear(); ReviewData firstReview = datas.sortByDate().get(0);
long reviewYearCount = datas.countByYear(currentYear); long reviewCount = datas.size();
String firstDate = firstReview.getDate().format(DateTimeFormatter.ofPattern("EEEE dd MMMM yyyy", Locale.FRENCH));
result = String.format("C'était la %d%s revue hebdomadaire de l'April, la %d%s de l'année %d.", datas.size(), numberSuffix(datas.size()), result = String.format("Il y a eu %d revues. La première date du %s.", reviewCount, firstDate);
reviewYearCount, numberSuffix(reviewYearCount), currentYear); }
//
return result;
}
/**
* Report review duration.
*
* @param datas
* the datas
* @return the string
*/
public static String reportReviewDuration(final ReviewDatas datas)
{
String result;
if ((datas == null) || (datas.isEmpty()))
{
result = "Pas de statistique sur la durée des revues.";
}
else
{
result = String.format("Durée des revues : min.=%d min, moy.=%.1f min, max=%d min", datas.getMinDuration(), datas.getAveratgeDuration(),
datas.getMaxDuration());
}
//
return result;
}
/**
* Report review user count.
*
* @param datas
* the datas
* @return the string
*/
public static String reportReviewUserCount(final ReviewDatas datas)
{
String result;
if ((datas == null) || (datas.isEmpty()))
{
result = "Absence de statistique sur les participations.";
}
else
{
result = String.format("Participation aux revues : min.=%d, moy.=%.1f, max=%d", datas.getMinUserCount(), datas.getAveratgeUserCount(),
datas.getMaxUserCount());
} }
// //

View File

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org> * 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>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
@ -50,7 +50,7 @@ public class HebdobotCLI
private static final String DEFAULT_ALIAS_FILE = "users.conf"; private static final String DEFAULT_ALIAS_FILE = "users.conf";
/** /**
* Instantiates a new hebdobot launcher. * Instantiates a new hebdobot CLI.
*/ */
private HebdobotCLI() private HebdobotCLI()
{ {
@ -209,7 +209,7 @@ public class HebdobotCLI
// //
logger.info("Bot configuring…"); logger.info("Bot configuring…");
bot.getPastebinSettings().setApiKey(config.getPastebinApiKey()); bot.getPrivatebinSettings().setServerUrl(config.getPrivatebinUrl());
bot.getIdenticaSettings().setApiKey(config.getIdenticaApiKey()); bot.getIdenticaSettings().setApiKey(config.getIdenticaApiKey());
bot.getIdenticaSettings().setApiSecret(config.getIdenticaApiSecret()); bot.getIdenticaSettings().setApiSecret(config.getIdenticaApiSecret());
bot.getTwitterSettings().setConsumerKey(config.getTwitterConsumerKey()); bot.getTwitterSettings().setConsumerKey(config.getTwitterConsumerKey());

View File

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org> * Copyright (C) 2017-2021 Christian Pierre MOMON <cmomon@april.org>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -21,6 +21,8 @@ package org.april.hebdobot.cli;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.time.LocalTime; import java.time.LocalTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.Properties; import java.util.Properties;
@ -332,15 +334,23 @@ public class HebdobotConfigFile extends Properties
} }
/** /**
* Gets the pastebin api key. * Gets the private bin url.
* *
* @return the pastebin api key * @return the private bin url
*/ */
public String getPastebinApiKey() public URL getPrivatebinUrl()
{ {
String result; URL result;
result = getProperty("pastebin.apiKey"); try
{
String value = getProperty("privatebin.url");
result = new URL(value);
}
catch (MalformedURLException exception)
{
result = null;
}
// //
return result; return result;

View File

@ -1,52 +0,0 @@
/**
* Copyright (C) 2017-2018 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.pastebin;
public class APIException extends Exception
{
private static final long serialVersionUID = 1852384776503676687L;
/**
* Instantiates a new API exception.
*
* @param message
* the message
*/
private APIException(final String message)
{
super(message);
}
/**
* Throw if error.
*
* @param content
* the content
* @throws APIException
* the API exception
*/
public static void throwIfError(final String content) throws APIException
{
if (content.contains(PastebinClient.API_ERROR))
{
throw new APIException(content.replaceFirst(PastebinClient.API_ERROR, ""));
}
}
}

View File

@ -1,493 +0,0 @@
/**
* Copyright (C) 2017-2018 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.pastebin;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.util.LinkedList;
import java.util.List;
import org.apache.commons.io.IOUtils;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.protocol.HTTP;
import org.april.hebdobot.HebdobotException;
/**
* The Class PastebinClient.
*/
public class PastebinClient
{
private static final String API_LOGIN_URL = "https://pastebin.com/api/api_login.php";
private static final String API_POST_URL = "https://pastebin.com/api/api_post.php";
private static final String API_DEV_KEY = "api_dev_key";
private static final String API_USER_KEY = "api_user_key";
private static final String API_USER_NAME = "api_user_name";
private static final String API_USER_PASSWORD = "api_user_password";
private static final String API_OPTION = "api_option";
private static final String API_PASTE_PRIVATE = "api_paste_private";
private static final String API_PASTE_NAME = "api_paste_name";
private static final String API_PASTE_EXPIRATION = "api_paste_expire_date";
private static final String API_PASTE_FORMAT = "api_paste_format";
private static final String API_PASTE_CODE = "api_paste_code";
public static final String API_ERROR = "Bad API request,";
private String apiKey;
private String apiUserKey;
private HttpClient httpClient;
/**
* Instantiates a new pastebin client.
*
* @param apiKey
* the api key
*/
public PastebinClient(final String apiKey)
{
this.apiKey = apiKey;
this.httpClient = new DefaultHttpClient();
}
/**
* Login.
*
* @param name
* the name
* @param password
* the password
* @throws HebdobotException
* the hebdobot exception
*/
public void login(final String name, final String password) throws HebdobotException
{
try
{
final List<NameValuePair> params = new LinkedList<>();
setParameter(params, API_DEV_KEY, this.apiKey);
setParameter(params, API_USER_NAME, name);
setParameter(params, API_USER_PASSWORD, password);
final HttpPost request = new HttpPost(API_LOGIN_URL);
request.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8));
final HttpResponse response = this.httpClient.execute(request);
final String content = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
APIException.throwIfError(content);
this.apiUserKey = content;
}
catch (UnsupportedEncodingException exception)
{
throw new HebdobotException(exception);
}
catch (ClientProtocolException exception)
{
throw new HebdobotException(exception);
}
catch (IOException exception)
{
throw new HebdobotException(exception);
}
catch (APIException exception)
{
throw new HebdobotException(exception);
}
}
/**
* Paste.
*
* @param code
* the code
* @return the string
* @throws HebdobotException
* the hebdobot exception
*/
public String paste(final String code) throws HebdobotException
{
String result;
result = this.paste(code, null, Format.NONE, Private.PUBLIC, Expiration.DAY_1);
//
return result;
}
/**
* Paste.
*
* @param code
* the code
* @param expiration
* the expiration
* @return the string
* @throws HebdobotException
* the hebdobot exception
*/
public String paste(final String code, final Expiration expiration) throws HebdobotException
{
String result;
result = this.paste(code, null, Format.NONE, Private.PUBLIC, expiration);
//
return result;
}
/**
* Paste.
*
* @param code
* the code
* @param format
* the format
* @return the string
* @throws HebdobotException
* the hebdobot exception
*/
public String paste(final String code, final Format format) throws HebdobotException
{
String result;
result = this.paste(code, null, format, Private.PUBLIC, Expiration.DAY_1);
//
return result;
}
/**
* Paste.
*
* @param code
* the code
* @param format
* the format
* @param expiration
* the expiration
* @return the string
* @throws HebdobotException
* the hebdobot exception
*/
public String paste(final String code, final Format format, final Expiration expiration) throws HebdobotException
{
String result;
result = this.paste(code, null, format, Private.PUBLIC, expiration);
//
return result;
}
/**
* Paste.
*
* @param code
* the code
* @param format
* the format
* @param privat
* the privat
* @return the string
* @throws HebdobotException
* the hebdobot exception
*/
public String paste(final String code, final Format format, final Private privat) throws HebdobotException
{
String result;
result = this.paste(code, null, format, privat, Expiration.DAY_1);
//
return result;
}
/**
* Paste.
*
* @param code
* the code
* @param format
* the format
* @param privat
* the privat
* @param expiration
* the expiration
* @return the string
* @throws HebdobotException
* the hebdobot exception
*/
public String paste(final String code, final Format format, final Private privat, final Expiration expiration) throws HebdobotException
{
String result;
result = this.paste(code, null, format, privat, expiration);
//
return result;
}
/**
* Paste.
*
* @param code
* the code
* @param privat
* the privat
* @return the string
* @throws HebdobotException
* the hebdobot exception
*/
public String paste(final String code, final Private privat) throws HebdobotException
{
String result;
result = this.paste(code, null, Format.NONE, privat, Expiration.DAY_1);
//
return result;
}
/**
* Paste.
*
* @param code
* the code
* @param privat
* the privat
* @param expiration
* the expiration
* @return the string
* @throws HebdobotException
* the hebdobot exception
*/
public String paste(final String code, final Private privat, final Expiration expiration) throws HebdobotException
{
String result;
result = this.paste(code, null, Format.NONE, privat, expiration);
//
return result;
}
/**
* Paste.
*
* @param code
* the code
* @param name
* the name
* @return the string
* @throws HebdobotException
* the hebdobot exception
*/
public String paste(final String code, final String name) throws HebdobotException
{
String result;
result = this.paste(code, name, Format.NONE, Private.PUBLIC, Expiration.DAY_1);
//
return result;
}
/**
* Paste.
*
* @param code
* the code
* @param name
* the name
* @param format
* the format
* @return the string
* @throws HebdobotException
* the hebdobot exception
*/
public String paste(final String code, final String name, final Format format) throws HebdobotException
{
String result;
result = this.paste(code, name, format, Private.PUBLIC, Expiration.DAY_1);
//
return result;
}
/**
* Paste.
*
* @param code
* the code
* @param name
* the name
* @param format
* the format
* @param expiration
* the expiration
* @return the string
* @throws HebdobotException
* the hebdobot exception
*/
public String paste(final String code, final String name, final Format format, final Expiration expiration) throws HebdobotException
{
String result;
result = this.paste(code, name, format, Private.PUBLIC, expiration);
//
return result;
}
/**
* Paste.
*
* @param code
* the code
* @param name
* the name
* @param format
* the format
* @param privat
* the privat
* @return the string
* @throws HebdobotException
* the hebdobot exception
*/
public String paste(final String code, final String name, final Format format, final Private privat) throws HebdobotException
{
String result;
result = this.paste(code, name, format, privat, Expiration.DAY_1);
//
return result;
}
/**
* Paste.
*
* @param code
* the code
* @param name
* the name
* @param format
* the format
* @param privat
* the privat
* @param expiration
* the expiration
* @return the pastebin URL
* @throws HebdobotException
* the exception
*/
public String paste(final String code, final String name, final Format format, final Private privat, final Expiration expiration)
throws HebdobotException
{
String result;
try
{
List<NameValuePair> params = new LinkedList<>();
setParameter(params, API_DEV_KEY, this.apiKey);
setParameter(params, API_USER_KEY, this.apiUserKey);
setParameter(params, API_OPTION, Option.PASTE.getValue());
setParameter(params, API_PASTE_PRIVATE, privat.getValue());
setParameter(params, API_PASTE_NAME, name);
setParameter(params, API_PASTE_EXPIRATION, expiration.getValue());
setParameter(params, API_PASTE_FORMAT, format.getValue());
setParameter(params, API_PASTE_CODE, code);
final HttpPost request = new HttpPost(API_POST_URL);
request.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8));
final HttpResponse response = this.httpClient.execute(request);
result = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
APIException.throwIfError(result);
}
catch (UnsupportedEncodingException exception)
{
throw new HebdobotException(exception);
}
catch (ClientProtocolException exception)
{
throw new HebdobotException(exception);
}
catch (IOException exception)
{
throw new HebdobotException(exception);
}
catch (APIException exception)
{
throw new HebdobotException(exception);
}
//
return result;
}
/**
* Paste.
*
* @param code
* the code
* @param name
* the name
* @param privat
* the privat
* @return the pastebin URL
* @throws HebdobotException
* the hebdobot exception
*/
public String paste(final String code, final String name, final Private privat) throws HebdobotException
{
String result;
result = this.paste(code, name, Format.NONE, privat, Expiration.DAY_1);
//
return result;
}
/**
* Sets the parameter.
*
* @param params
* the params
* @param name
* the name
* @param value
* the value
*/
private static void setParameter(final List<NameValuePair> params, final String name, final String value)
{
if (value != null)
{
params.add(new BasicNameValuePair(name, value));
}
}
}

View File

@ -1,80 +0,0 @@
/**
* Copyright (C) 2017-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.pastebin;
import org.apache.commons.lang3.StringUtils;
/**
* The Class PatebinSettings.
*/
public class PastebinSettings
{
private String apiKey;
/**
* Instantiates a new pastebin settings.
*/
public PastebinSettings()
{
this.apiKey = null;
}
/**
* Instantiates a new pastebin settings.
*
* @param apiKey
* the api key
*/
public PastebinSettings(final String apiKey)
{
this.apiKey = apiKey;
}
public String getApiKey()
{
return this.apiKey;
}
/**
* Checks if is valid.
*
* @return true, if is valid
*/
public boolean isValid()
{
boolean result;
if ((StringUtils.isBlank(this.apiKey)) || (StringUtils.containsOnly(this.apiKey, 'X')))
{
result = false;
}
else
{
result = true;
}
//
return result;
}
public void setApiKey(final String apiKey)
{
this.apiKey = apiKey;
}
}

View File

@ -0,0 +1,208 @@
/*
* Copyright 2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright 2020 Dr Ian Preston ianopolous
* Copyright 2018 Andreas Schildbach
* Copyright 2011 Google Inc.
*
* From:
* https://github.com/multiformats/java-multibase/blob/master/src/main/java/io/ipfs/multibase/Base58.java
* https://github.com/bitcoinj/bitcoinj/blob/master/core/src/main/java/org/bitcoinj/core/Base58.java
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.april.hebdobot.privatebin;
import java.math.BigInteger;
import java.util.Arrays;
/**
* Base58 is a way to encode Bitcoin addresses (or arbitrary data) as
* alphanumeric strings.
* <p>
* Note that this is not the same base58 as used by Flickr, which you may find
* referenced around the Internet.
* <p>
* Satoshi explains: why base-58 instead of standard base-64 encoding?
* <ul>
* <li>Don't want 0OIl characters that look the same in some fonts and could be
* used to create visually identical looking account numbers.</li>
* <li>A string with non-alphanumeric characters is not as easily accepted as an
* account number.</li>
* <li>E-mail usually won't line-break if there's no punctuation to break
* at.</li>
* <li>Doubleclicking selects the whole number as one word if it's all
* alphanumeric.</li>
* </ul>
* <p>
* However, note that the encoding/decoding runs in O(n&sup2;) time, so it is
* not useful for large data.
* <p>
* The basic idea of the encoding is to treat the data bytes as a large number
* represented using base-256 digits, convert the number to be represented using
* base-58 digits, preserve the exact number of leading zeros (which are
* otherwise lost during the mathematical operations on the numbers), and
* finally represent the resulting base-58 digits as alphanumeric ASCII
* characters.
*/
public class Base58
{
public static final char[] ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz".toCharArray();
private static final char ENCODED_ZERO = ALPHABET[0];
private static final int[] INDEXES = new int[128];
static
{
Arrays.fill(INDEXES, -1);
for (int i = 0; i < ALPHABET.length; i++)
{
INDEXES[ALPHABET[i]] = i;
}
}
/**
* Decodes the given base58 string into the original data bytes.
*
* @param input
* the base58-encoded string to decode
* @return the decoded data bytes
*/
public static byte[] decode(final String input)
{
if (input.length() == 0)
{
return new byte[0];
}
// Convert the base58-encoded ASCII chars to a base58 byte sequence
// (base58 digits).
byte[] input58 = new byte[input.length()];
for (int i = 0; i < input.length(); ++i)
{
char c = input.charAt(i);
int digit = c < 128 ? INDEXES[c] : -1;
if (digit < 0)
{
throw new IllegalStateException("InvalidCharacter in base 58");
}
input58[i] = (byte) digit;
}
// Count leading zeros.
int zeros = 0;
while (zeros < input58.length && input58[zeros] == 0)
{
++zeros;
}
// Convert base-58 digits to base-256 digits.
byte[] decoded = new byte[input.length()];
int outputStart = decoded.length;
for (int inputStart = zeros; inputStart < input58.length;)
{
decoded[--outputStart] = divmod(input58, inputStart, 58, 256);
if (input58[inputStart] == 0)
{
++inputStart; // optimization - skip leading zeros
}
}
// Ignore extra leading zeroes that were added during the calculation.
while (outputStart < decoded.length && decoded[outputStart] == 0)
{
++outputStart;
}
// Return decoded data (including original number of leading zeros).
return Arrays.copyOfRange(decoded, outputStart - zeros, decoded.length);
}
public static BigInteger decodeToBigInteger(final String input)
{
return new BigInteger(1, decode(input));
}
/**
* Divides a number, represented as an array of bytes each containing a
* single digit in the specified base, by the given divisor. The given
* number is modified in-place to contain the quotient, and the return value
* is the remainder.
*
* @param number
* the number to divide
* @param firstDigit
* the index within the array of the first non-zero digit (this
* is used for optimization by skipping the leading zeros)
* @param base
* the base in which the number's digits are represented (up to
* 256)
* @param divisor
* the number to divide by (up to 256)
* @return the remainder of the division operation
*/
private static byte divmod(final byte[] number, final int firstDigit, final int base, final int divisor)
{
// this is just long division which accounts for the base of the input
// digits
int remainder = 0;
for (int i = firstDigit; i < number.length; i++)
{
int digit = number[i] & 0xFF;
int temp = remainder * base + digit;
number[i] = (byte) (temp / divisor);
remainder = temp % divisor;
}
return (byte) remainder;
}
/**
* Encodes the given bytes as a base58 string (no checksum is appended).
*
* @param input
* the bytes to encode
* @return the base58-encoded string
*/
public static String encode(byte[] input)
{
if (input.length == 0)
{
return "";
}
// Count leading zeros.
int zeros = 0;
while (zeros < input.length && input[zeros] == 0)
{
++zeros;
}
// Convert base-256 digits to base-58 digits (plus conversion to ASCII
// characters)
input = Arrays.copyOf(input, input.length); // since we modify it
// in-place
char[] encoded = new char[input.length * 2]; // upper bound
int outputStart = encoded.length;
for (int inputStart = zeros; inputStart < input.length;)
{
encoded[--outputStart] = ALPHABET[divmod(input, inputStart, 256, 58)];
if (input[inputStart] == 0)
{
++inputStart; // optimization - skip leading zeros
}
}
// Preserve exactly as many leading encoded zeros in output as there
// were leading zeros in input.
while (outputStart < encoded.length && encoded[outputStart] == ENCODED_ZERO)
{
++outputStart;
}
while (--zeros >= 0)
{
encoded[--outputStart] = ENCODED_ZERO;
}
// Return encoded string (including encoded leading zeros).
return new String(encoded, outputStart, encoded.length - outputStart);
}
}

View File

@ -1,6 +1,5 @@
/** /**
* Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org> * Copyright (C) 2019-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -17,37 +16,42 @@
* 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.pastebin; package org.april.hebdobot.privatebin;
/** /**
* The Enum Private. * The Enum Option.
*/ */
public enum Private public enum BurnAfterReading
{ {
PUBLIC("0"), ON("1"),
UNLISTED("1"), OFF("0");
PRIVATE("2");
private String value; private final String value;
/** /**
* Instantiates a new private. * Instantiates a new option.
* *
* @param value * @param value
* the value * the value
*/ */
private Private(final String value) private BurnAfterReading(final String value)
{ {
this.value = value; this.value = value;
} }
/** /**
* Gets the value. * To string.
* *
* @return the value * @return the string
*/ */
String getValue() @Override
public String toString()
{ {
return this.value; String result;
result = this.value;
//
return result;
} }
} }

View File

@ -0,0 +1,57 @@
/**
* 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.privatebin;
/**
* The Enum Compression.
*/
public enum Compression
{
NONE("none"),
ZLIB("zlib");
private final String value;
/**
* Instantiates a new option.
*
* @param value
* the value
*/
private Compression(final String value)
{
this.value = value;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString()
{
String result;
result = this.value;
//
return result;
}
}

View File

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org> * 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>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
@ -17,18 +17,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.pastebin; package org.april.hebdobot.privatebin;
/** /**
* The Enum Expiration. * The Enum Expiration.
*/ */
public enum Expiration public enum Expiration
{ {
NEVER(null), MINUTE_5("5min"),
MINUTE_10("10M"), MINUTE_10("10min"),
HOUR_1("1H"), HOUR_1("1hour"),
DAY_1("1D"), DAY_1("1day"),
MONTH_1("1M"); WEEK_1("1week"),
MONTH_1("1month"),
YEAR_1("1year"),
NEVER("never");
private final String value; private final String value;
@ -44,12 +47,18 @@ public enum Expiration
} }
/** /**
* Gets the value. * To string.
* *
* @return the value * @return the string
*/ */
public String getValue() @Override
public String toString()
{ {
return this.value; String result;
result = this.value;
//
return result;
} }
} }

View File

@ -1,6 +1,5 @@
/** /**
* Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org> * Copyright (C) 2019-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -17,18 +16,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.pastebin; package org.april.hebdobot.privatebin;
/** /**
* The Enum Format. * The Enum Formatter.
*/ */
public enum Format public enum Formatter
{ {
NONE(null), PLAINTEXT("plaintext"),
C("c"), SYNTAXHIGHLIGHTING("syntaxhighlighting"),
CPP("cpp"), MARKDOWN("markdown");
JAVA("java"),
JAVA_5("java5");
private final String value; private final String value;
@ -38,18 +35,24 @@ public enum Format
* @param value * @param value
* the value * the value
*/ */
private Format(final String value) private Formatter(final String value)
{ {
this.value = value; this.value = value;
} }
/** /**
* Gets the value. * To string.
* *
* @return the value * @return the string
*/ */
public String getValue() @Override
public String toString()
{ {
return this.value; String result;
result = this.value;
//
return result;
} }
} }

View File

@ -1,6 +1,5 @@
/** /**
* Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org> * Copyright (C) 2019-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr>
* *
* This file is part of (April) Hebdobot. * This file is part of (April) Hebdobot.
* *
@ -17,14 +16,15 @@
* 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.pastebin; package org.april.hebdobot.privatebin;
/** /**
* The Enum Option. * The Enum Option.
*/ */
public enum Option public enum OpenDiscussion
{ {
PASTE("paste"); ON("1"),
OFF("0");
private final String value; private final String value;
@ -34,18 +34,24 @@ public enum Option
* @param value * @param value
* the value * the value
*/ */
private Option(final String value) private OpenDiscussion(final String value)
{ {
this.value = value; this.value = value;
} }
/** /**
* Gets the value. * To string.
* *
* @return the value * @return the string
*/ */
public String getValue() @Override
public String toString()
{ {
return this.value; String result;
result = this.value;
//
return result;
} }
} }

View File

@ -0,0 +1,253 @@
/**
* Copyright (C) 2017-2021 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.privatebin;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.KeySpec;
import java.util.Arrays;
import java.util.Base64;
import java.util.Random;
import java.util.zip.Deflater;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.KeyGenerator;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.GCMParameterSpec;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.SecretKeySpec;
import javax.net.ssl.HttpsURLConnection;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.ClientProtocolException;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
/**
* The Class PastebinClient.
*/
public class PrivatebinClient extends PrivatebinSettings
{
private static final Logger logger = LoggerFactory.getLogger(PrivatebinClient.class);
/**
* Instantiates a new privatebin client.
*
* @param settings
* the settings
*/
public PrivatebinClient(final PrivatebinSettings settings)
{
super(settings);
}
/**
* Instantiates a new privatebin client.
*
* @param url
* the url
*/
public PrivatebinClient(final URL url)
{
super();
setServerUrl(url);
}
/**
* Paste.
*
* @param text
* the text
* @return the string
* @throws PrivatebinException
* the privatebin exception
*/
public String paste(final String text) throws PrivatebinException
{
String result;
result = null;
try
{
// Note: the following code is based on:
// https://github.com/PrivateBin/PrivateBin/wiki/API
// https://github.com/kkingsley-BF/PrivateBin-Groovy/blob/master/Paste.groovy
// Build message to encrypt.
JSONObject pasteDataJson = new JSONObject();
pasteDataJson.put("paste", text);
String pasteData = pasteDataJson.toJSONString();
// logger.debug("pasteData={}", pasteData);
// Compression.
byte[] pasteDataBytes;
if (this.compression == Compression.ZLIB)
{
Deflater zipDeflater = new Deflater();
ByteArrayOutputStream stream = new ByteArrayOutputStream();
zipDeflater.setInput(pasteData.getBytes());
zipDeflater.finish();
byte[] buffer = new byte[1024];
while (!zipDeflater.finished())
{
int count = zipDeflater.deflate(buffer);
stream.write(buffer, 0, count);
}
byte[] output;
output = stream.toByteArray();
stream.close();
zipDeflater.end();
// Need to remove the header
pasteDataBytes = Arrays.copyOfRange(output, 2, output.length - 4);
}
else
{
pasteDataBytes = pasteData.getBytes();
}
// Generate password.
KeyGenerator keyGen = KeyGenerator.getInstance("AES");
keyGen.init(192);
String randomPassword = Base64.getEncoder().encodeToString(keyGen.generateKey().getEncoded());
String customPassword = randomPassword + this.password;
// Generate IV.
byte[] cipherIVBytes = new byte[16];
new Random().nextBytes(cipherIVBytes);
String cipherIVEncoded = Base64.getEncoder().encodeToString(cipherIVBytes);
// Generate salt.
byte[] kdfSaltBytes = new byte[8];
new Random().nextBytes(kdfSaltBytes);
String kdfSaltEncoded = Base64.getEncoder().encodeToString(kdfSaltBytes);
// Generate secret key for cipher.
SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256");
KeySpec passwordBasedEncryptionKeySpec = new PBEKeySpec(customPassword.toCharArray(), kdfSaltBytes, 100000, 256);
SecretKey secret = new SecretKeySpec(factory.generateSecret(passwordBasedEncryptionKeySpec).getEncoded(), "AES");
// Cipher AAD.
StringList gcmTagString = new StringList();
gcmTagString.append("[");
gcmTagString.append("[");
gcmTagString.append("\"").append(cipherIVEncoded).append("\"").append(",");
gcmTagString.append("\"").append(kdfSaltEncoded).append("\"").append(",");
gcmTagString.append("100000,256,128,");
gcmTagString.append("\"").append("aes").append("\"").append(",");
gcmTagString.append("\"").append("gcm").append("\"").append(",");
gcmTagString.append("\"").append(this.compression.toString()).append("\"");
gcmTagString.append("]");
gcmTagString.append(",");
gcmTagString.append("\"").append(this.formatter.toString()).append("\"").append(",");
gcmTagString.append(this.openDiscussion.toString()).append(",");
gcmTagString.append(this.burnAfterReading.toString());
gcmTagString.append("]");
byte[] gcmBytes = gcmTagString.toString().getBytes();
// Generate cipher text.
Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
GCMParameterSpec spec = new GCMParameterSpec(128, cipherIVBytes);
cipher.init(Cipher.ENCRYPT_MODE, secret, spec);
cipher.updateAAD(gcmBytes);
byte[] cipherTextBytes = cipher.doFinal(pasteDataBytes);
String cipherText = Base64.getEncoder().encodeToString(cipherTextBytes);
// logger.debug("cipherText={}", cipherText);
// Create POST payload.
StringList payload = new StringList();
payload.append("{");
payload.append("\"v\":2,");
payload.append("\"adata\":").append(gcmTagString.toString()).append(",");
payload.append("\"ct\":\"").append(cipherText).append("\",");
payload.append("\"meta\":{\"expire\":\"").append(this.expiration).append("\"}");
payload.append("}");
// logger.debug("PAYLOAD={}", payload.toString());
// POST Request.
HttpsURLConnection pasteRequest = (HttpsURLConnection) this.serverUrl.openConnection();
pasteRequest.setRequestMethod("POST");
pasteRequest.setDoOutput(true);
pasteRequest.setRequestProperty("X-Requested-With", "JSONHttpRequest");
pasteRequest.getOutputStream().write(payload.toString().getBytes());
// Server response.
int responseCode = pasteRequest.getResponseCode();
logger.debug("Server response: {}", responseCode);
if (responseCode == 200)
{
String out = IOUtils.toString(pasteRequest.getInputStream(), "UTF-8");
logger.info("===> {}", out);
JSONObject parser = (JSONObject) new JSONParser().parse(out);
String status = parser.get("status").toString();
if (StringUtils.equals(status, "0"))
{
String id = parser.get("id").toString();
String pasteURL = parser.get("url").toString();
String deleteToken = parser.get("deletetoken").toString();
String finalURL = this.serverUrl + pasteURL + "#" + Base58.encode(randomPassword.getBytes());
String deleteURL = this.serverUrl + pasteURL + "&deletetoken=" + deleteToken;
logger.info("Pastebin SUCCESS");
logger.debug("Paste URL: {}", finalURL);
logger.debug("Delete URL: {}", deleteURL);
result = finalURL;
}
else
{
String output = parser.get("message").toString();
logger.warn("message={}", output);
throw new PrivatebinException(out);
}
}
}
catch (BadPaddingException | IllegalBlockSizeException | InvalidAlgorithmParameterException | InvalidKeyException | InvalidKeySpecException
| NoSuchAlgorithmException | NoSuchPaddingException | ParseException | UnsupportedEncodingException |
ClientProtocolException exception)
{
exception.printStackTrace();
throw new PrivatebinException(exception);
}
catch (IOException exception)
{
exception.printStackTrace();
throw new PrivatebinException(exception);
}
//
return result;
}
}

View File

@ -0,0 +1,70 @@
/**
* 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.privatebin;
/**
* The Class PrivateBinException.
*/
public class PrivatebinException extends Exception
{
private static final long serialVersionUID = -1113543017171098521L;
/**
* Instantiates a new private bin exception.
*/
public PrivatebinException()
{
super();
}
/**
* Instantiates a new private bin exception.
*
* @param message
* the message
*/
public PrivatebinException(final String message)
{
super(message);
}
/**
* Instantiates a new private bin exception.
*
* @param message
* the message
* @param cause
* the cause
*/
public PrivatebinException(final String message, final Throwable cause)
{
super(message, cause);
}
/**
* Instantiates a new private bin exception.
*
* @param cause
* the cause
*/
public PrivatebinException(final Throwable cause)
{
super(cause);
}
}

View File

@ -0,0 +1,203 @@
/**
* 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.privatebin;
import java.net.URL;
/**
* The Class PrivatebinSettings
*/
public class PrivatebinSettings
{
protected URL serverUrl;
protected Compression compression;
protected Expiration expiration;
protected BurnAfterReading burnAfterReading;
protected OpenDiscussion openDiscussion;
protected Formatter formatter;
protected String password;
/**
* Instantiates a new Privatebin settings.
*/
public PrivatebinSettings()
{
this.serverUrl = null;
this.compression = Compression.ZLIB;
this.expiration = Expiration.DAY_1;
this.burnAfterReading = BurnAfterReading.OFF;
this.openDiscussion = OpenDiscussion.OFF;
this.formatter = Formatter.PLAINTEXT;
this.password = "";
}
/**
* Instantiates a new privatebin settings.
*
* @param settings
* the settings
*/
public PrivatebinSettings(final PrivatebinSettings settings)
{
this.serverUrl = settings.serverUrl;
this.compression = settings.compression;
this.expiration = settings.expiration;
this.burnAfterReading = settings.burnAfterReading;
this.openDiscussion = settings.openDiscussion;
this.formatter = settings.formatter;
this.password = settings.password;
}
public BurnAfterReading getBurnAfterReading()
{
return this.burnAfterReading;
}
public Compression getCompression()
{
return this.compression;
}
public Expiration getExpiration()
{
return this.expiration;
}
public Formatter getFormatter()
{
return this.formatter;
}
public OpenDiscussion getOpenDiscussion()
{
return this.openDiscussion;
}
public String getPassword()
{
return this.password;
}
public URL getServerUrl()
{
return this.serverUrl;
}
/**
* Checks if is valid.
*
* @return true, if is valid
*/
public boolean isValid()
{
boolean result;
if (this.serverUrl == null)
{
result = false;
}
else if ((this.burnAfterReading == BurnAfterReading.ON) && (this.openDiscussion == OpenDiscussion.ON))
{
// Burn after reading cannot be active if opendiscussion is.
result = false;
}
else
{
result = true;
}
//
return result;
}
public void setBurnAfterReading(final BurnAfterReading burnAfterReading)
{
if (burnAfterReading != null)
{
this.burnAfterReading = burnAfterReading;
}
}
public void setCompression(final Compression compression)
{
if (compression != null)
{
this.compression = compression;
}
}
public void setExpiration(final Expiration expiration)
{
if (expiration != null)
{
this.expiration = expiration;
}
}
public void setFormatter(final Formatter formatter)
{
if (formatter != null)
{
this.formatter = formatter;
}
}
public void setOpenDiscussion(final OpenDiscussion openDiscussion)
{
if (openDiscussion != null)
{
this.openDiscussion = openDiscussion;
}
}
public void setPassword(final String password)
{
if (password == null)
{
this.password = "";
}
else
{
this.password = password;
}
}
public void setServerUrl(final URL serverUrl)
{
this.serverUrl = serverUrl;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString()
{
String result;
result = String.format("valid=%b, url=%s, formatter=%s, compression=%s, expiration=%s, burnafterreading=%s, opendiscussion=%s, password=%s",
isValid(), this.serverUrl, this.formatter, this.compression, this.expiration, this.burnAfterReading, this.openDiscussion,
this.password);
//
return result;
}
}

View File

@ -0,0 +1,95 @@
/**
* 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.util;
import java.time.Duration;
import java.time.LocalDateTime;
/**
* The Class Chrono.
*/
public class Chrono
{
private LocalDateTime start;
/**
* Instantiates a new time keeper.
*/
public Chrono()
{
reset();
}
/**
* Format.
*
* @return the string
*/
public String format()
{
String result;
if (this.start == null)
{
result = "n/a";
}
else
{
LocalDateTime end = LocalDateTime.now();
Duration duration = Duration.between(this.start, end);
result = String.format("%1d:%02d", duration.getSeconds() / 60, duration.getSeconds() % 60);
}
//
return result;
}
/**
* Reset.
*/
public void reset()
{
this.start = null;
}
/**
* Start.
*/
public void start()
{
this.start = LocalDateTime.now();
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString()
{
String result;
result = format();
//
return result;
}
}

View File

@ -12,8 +12,8 @@ irc.port=6667
irc.name=Hebdobot irc.name=Hebdobot
irc.channel=#april-test irc.channel=#april-test
# Pastebin settings. # Privatebin settings.
pastebin.apiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX privatebin.url=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# Ident.ca settings. # Ident.ca settings.
identica.apiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX identica.apiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

View File

@ -72,7 +72,7 @@ public class ReviewStatsReporterTest
logger.debug("File loaded."); logger.debug("File loaded.");
ReviewData currentReview = new ReviewData(LocalDateTime.now(), 12, 17L); ReviewData currentReview = new ReviewData(LocalDateTime.now(), 12, 17L);
datas.add(currentReview); datas.add(currentReview);
String report = ReviewStatsReporter.reportNewUserCountRecord(datas); String report = ReviewStatsReporter.reportCheckUserCountRecord(datas);
logger.debug("Report=" + report); logger.debug("Report=" + report);
Assert.assertTrue(StringUtils.startsWith(report, "Le dernier record de")); Assert.assertTrue(StringUtils.startsWith(report, "Le dernier record de"));
} }
@ -92,7 +92,7 @@ public class ReviewStatsReporterTest
logger.debug("File loaded."); logger.debug("File loaded.");
ReviewData currentReview = new ReviewData(LocalDateTime.now(), 42000, 17L); ReviewData currentReview = new ReviewData(LocalDateTime.now(), 42000, 17L);
datas.add(currentReview); datas.add(currentReview);
String report = ReviewStatsReporter.reportNewUserCountRecord(datas); String report = ReviewStatsReporter.reportCheckUserCountRecord(datas);
logger.debug("Report=" + report); logger.debug("Report=" + report);
Assert.assertTrue(StringUtils.startsWith(report, "*\\o/* Nouveau record de participation")); Assert.assertTrue(StringUtils.startsWith(report, "*\\o/* Nouveau record de participation"));
} }

View File

@ -0,0 +1,416 @@
================================================================================
Revue de la semaine en cours
Vendredi 02 avril 2021
================================================================================
================================================================================
--------------------------------- Participants ---------------------------------
* IIIIIIIII IIII (cccccccccc)
* aaaa (aaaa)
* Cccccccccc P. Mmmmmm (cccc_cccccc)
* Pppppp (Pppppp)
================================================================================
------------------------- IIIIIIIII IIII (cccccccccc) --------------------------
=== 1/ Actions passées ou en cours ===
* dépilage courriels suite au congé
* ca@ : suivi divers
* participation à point d'équipe/dossiers
* suivi courriels sur secretaire@
* suivi nouvelles adhésions
* suivi relances personnes morales en retard de cotisation
* relectures diverses
* réu sensibilisation hebdo : orga, annonces, animation
* rdv « tâches importantes » : orga, annonces, présence
* intervention à la 100e de Libre à vous !
* divers fournisseurs
* divers en vente libre
* divers formulaire de contact
* divers régie lav !
* test imprimante
* divers pour rediffusion d'une émission mardi 06/04
* suivi tâches admins me concernant
* maj diverses pad d'orga LAV !
* ventilation temps par catégories LAV !
* divers membres en bounce
=== 2/ Actions à venir ===
* divers lef 2021 : remerciements, bilan, maj diverses
* divers refonte graphique libre en fête
* divers projets sensi
* divers lav !
* suite dépilage courriels
* suivi dossiers administratifs divers
* divers en vente libre
* recherche personnes intervenantes pour sujet longchronique à venir lav !
* rdv « tâches importantes » : orga, annonces, présence
* revue hebdomadaire : génération de la synthèse
* divers en fonction du temps
================================================================================
--------------------------------- aaaa (aaaa) ----------------------------------
=== 2/ Actions à venir ===
* Participation à reunion chatons
* Participation à réunion chapril
* Modération et animation chapril xmpp
* Mise en place de mon serveur physique \o/
================================================================================
----------------------- Cccccccccc P. Mmmmmm (cccc_cccccc) ------------------------
=== 1/ Actions passées ou en cours ===
* CA : courant
* Gdt:adminsys : supervision SI
* Gdt:adminsys : tâches sprint
* Gdt:adminsys : réunion de sprint mensuel adminsys
* Gdt:adminsys : Mettre à jour Gitea/forge.chapril.org en 1.13.6 (#5290)
* Gdt:chapril : supervision SI
* Gdt:chapril : upgrades
* Gdt:chapril : reboot SI
* Gdt:chapril : suivi CHATONS
* Gdt:chapril : jardinage tickets
* Gdt:chapril : réunion CHATONS ChatonsInfos
* Gdt:chapril : dev ChaprilInfos
* Gdt:chapril : dev gestion logs
* Gdt:chapril : permanence du samedi matin
* Gdt:chapril : Mettre à jour Gitea/forge.chapril.org en 1.13.6 (#5291)
* Gdt:chapril : modération pouet.chapril.org
* Gdt:chapril : réponse demande de stage
* Libreàvous! : écoute de l'émission
* Libreàvous! : participation avec une capsule pour la 100e
* Décryptualité : écoute de l'émission
* Transcription : relecture émission n°94
* Virus : suivi, grrrr…
* Divers
* Sensibilisation : participation réunion Boussole du Libre
=== 2/ Actions à venir ===
* CA : courant
* Gdt:adminsys : supervision SI
* Gdt:adminsys : tâches de sprint
* Gdt:chapril : supervision SI
* Gdt:chapril : gestion gdt Chapril
* Gdt:chapril : préparation réunion animateurs (annonce, pad, stats…)
* Gdt:chapril : animation de réunion mensuelle de sprint
* Gdt:chapril : tâches post réunion mensuelle Chapril (tickets, pad…)
* Gdt:chapril : CHATONS, suivi forum
* Gdt:chapril : dev ChatonsInfos
* Gdt:chapril : dév ChaprilInfos
* Gdt:chapril : réunion ChatonsInfos
* Gdt:chapril : point modération Mastodon
* Libreàvous! : écoute de l'émission
* Décryptualité : écoute de l'émission
* Galerie photos : fin traitement photos AGO
================================================================================
-------------------------------- Pppppp (Pppppp) ---------------------------------
=== 1/ Actions passées ou en cours ===
* ca: suivi divres
* tresorerie: suivi divers
* adminsys: suivi divers, maj du cluster + redémarrage, nettoyage de icinga
* siteweb: activation de l'index fulltext pour des mots de 3 lettres
* mails: passage au karsher des domaines en erreur
* adminsys: réunion de sprint fructueuse
* adminsys: maj de matomo et piwik
=== 2/ Actions à venir ===
* rapport d'activité format pdf
================================================================================
3/ Points de blocage / points en retard corrigés cette semaine
================================================================================
* aaaa : Écouter LAV 100 🤣😅
================================================================================
4/ Points de blocage existants / points en retard à traiter
================================================================================
* Pppppp : rapport d'activité version pdf :)
* cccccccccc : mise en vente t-shirt
* cccccccccc : divers comm' et sensi
================================================================================
5/ Points forts de la semaine
================================================================================
* cccc_cccccc : La centième de Libre à vous ! \o/
* cccccccccc : lav ! a fêté 100 émissions \o/
* cccc_cccccc : Réunion adminsys
* aaaa : Je vois le bout du tunnel ovh
* cccccccccc : visite surprise de booky à la fin de la réu sensi
* cccccccccc : veste légère pour sortir :)
* cccc_cccccc : réunion sensibilisation en visio
================================================================================
6/ Points de vigilance de la semaine
================================================================================
* Pppppp : la covid nous prive de notre DG
* aaaa : Trop
* cccc_cccccc : garder le rythme et continuer à faire attention
* cccccccccc : l'avalanche de courriels qu'on peut retrouver dans sa bal en
rentrant de congé :)
================================================================================
7/ Points forts de la réunion
================================================================================
* aaaa : On est là avec Pppppp
* cccc_cccccc : Polux avec nous \O/
* cccccccccc : elle a lieu, en petit comité, mais elle a lieu :)
* cccc_cccccc : continuité assurée
* cccccccccc : plein d'actions
================================================================================
8/ Points de vigilance de la réunion
================================================================================
* cccc_cccccc : Pensée pour les covidés
* cccccccccc : +1
* cccccccccc : abus de postage de notes de la part de l'animatrice
* aaaa : Connexion internet pourrie
Log IRC brut
* Hebdobot : % Début de la réunion hebdomadaire
* Hebdobot : % rappel : toute ligne commençant par % sera considérée comme un
commentaire et non prise en compte dans la synthèse
* Hebdobot : % pour connaître le point courant, taper !courant
* cccccccccc : # 1/ Actions passées ou en cours
* Hebdobot : Sujet individuel : 1/ Actions passées ou en cours
* Hebdobot : % si rien à signaler vous pouvez écrire % ras
* Hebdobot : % quand vous avez fini vous le dites par % fini
* Pppppp : ca: suivi divres
* cccc_cccccc : CA : courant
* cccc_cccccc : Gdt:adminsys : supervision SI
* cccccccccc : dépilage courriels suite au congé
* Pppppp : tresorerie: suivi divers
* cccc_cccccc : Gdt:adminsys : tâches sprint
* cccc_cccccc : Gdt:adminsys : réunion de sprint mensuel adminsys
* cccccccccc : ca@ : suivi divers
* cccc_cccccc : Gdt:adminsys : Mettre à jour Gitea/forge.chapril.org en 1.13.6
(#5290)
* cccc_cccccc : Gdt:chapril : supervision SI
* cccc_cccccc : Gdt:chapril : upgrades
* cccc_cccccc : Gdt:chapril : reboot SI
* cccccccccc : participation à point d'équipe/dossiers
* cccc_cccccc : Gdt:chapril : suivi CHATONS
* Pppppp : adminsys: suivi divers, maj du cluster + redémarrage, nettoyage de
icinga
* cccc_cccccc : Gdt:chapril : jardinage tickets
* cccc_cccccc : Gdt:chapril : réunion CHATONS ChatonsInfos
* cccc_cccccc : Gdt:chapril : dev ChaprilInfos
* cccc_cccccc : Gdt:chapril : dev gestion logs
* cccccccccc : suivi courriels sur secretaire@
* cccc_cccccc : Gdt:chapril : permanence du samedi matin
* cccc_cccccc : Gdt:chapril : Mettre à jour Gitea/forge.chapril.org en 1.13.6
(#5291)
* cccc_cccccc : Gdt:chapril : modération pouet.chapril.org
* cccccccccc : suivi nouvelles adhésions
* cccc_cccccc : Gdt:chapril : réponse demande de stage
* cccc_cccccc : Libreàvous! : écoute de l'émission
* cccccccccc : suivi relances personnes morales en retard de cotisation
* cccc_cccccc : Libreàvous! : participation avec une capsule pour la 100e
* Pppppp : siteweb: activation de l'index fulltext pour des mots de 3 lettres
* cccc_cccccc : Décryptualité : écoute de l'émission
* cccccccccc : relectures diverses
* cccccccccc : réu sensibilisation hebdo : orga, annonces, animation
* cccccccccc : rdv « tâches importantes » : orga, annonces, présence
* cccc_cccccc : Transcription : relecture émission n°94
* cccc_cccccc : Virus : suivi, grrrr…
* cccc_cccccc : Divers
* Pppppp : mails: passage au karsher des domaines en erreur
* cccccccccc : intervention à la 100e de Libre à vous !
* cccc_cccccc : %fnii
* Pppppp : adminsys: réunion de sprint fructueuse
* cccccccccc : divers fournisseurs
* cccccccccc : divers en vente libre
* cccc_cccccc : Sensibilisation : participation réunion Boussole du Libre
* Pppppp : adminsys: maj de matomo et piwik
* cccc_cccccc : % fini
* cccccccccc : divers formulaire de contact
* Pppppp : %fini
* cccccccccc : divers régie lav !
* cccccccccc : test imprimante
* cccccccccc : divers pour rediffusion d'une émission mardi 06/04
* cccccccccc : suivi tâches admins me concernant
* cccccccccc : maj diverses pad d'orga LAV !
* cccc_cccccc : !courant
* Hebdobot : % Sujet individuel en cours : 1/ Actions passées ou en cours
* cccccccccc : ventilation temps par catégories LAV !
* cccccccccc : divers membres en bounce
* cccccccccc : %fini
* cccccccccc : % on va passer à la suite : Actions à venir
* cccccccccc : # 2/ Actions à venir
* Hebdobot : % cccccccccc cccc_cccccc Pppppp, on va passer à la suite : 2/ Actions
à venir
* Hebdobot : Sujet individuel : 2/ Actions à venir
* Hebdobot : % si rien à signaler vous pouvez écrire % ras
* Hebdobot : % quand vous avez fini vous le dites par % fini
* cccccccccc : divers lef 2021 : remerciements, bilan, maj diverses
* cccc_cccccc : CA : courant
* cccc_cccccc : Gdt:adminsys : supervision SI
* cccc_cccccc : Gdt:adminsys : tâches de sprint
* cccc_cccccc : Gdt:chapril : supervision SI
* cccc_cccccc : Gdt:chapril : gestion gdt Chapril
* cccc_cccccc : Gdt:chapril : préparation réunion animateurs (annonce, pad,
stats…)
* cccc_cccccc : Gdt:chapril : animation de réunion mensuelle de sprint
* cccccccccc : divers refonte graphique libre en fête
* cccc_cccccc : Gdt:chapril : tâches post réunion mensuelle Chapril (tickets,
pad…)
* cccc_cccccc : Gdt:chapril : CHATONS, suivi forum
* cccc_cccccc : Gdt:chapril : dev ChatonsInfos
* cccccccccc : divers projets sensi
* cccc_cccccc : Gdt:chapril : dév ChaprilInfos
* Pppppp : rapport d'activité format pdf
* cccccccccc : divers lav !
* cccc_cccccc : Gdt:chapril : réunion ChatonsInfos
* cccccccccc : suite dépilage courriels
* cccc_cccccc : Gdt:chapril : point modération Mastodon
* cccc_cccccc : Libreàvous! : écoute de l'émission
* cccc_cccccc : Décryptualité : écoute de l'émission
* cccccccccc : suivi dossiers administratifs divers
* cccc_cccccc : Galerie photos : fin traitement photos AGO
* cccccccccc : divers en vente libre
* cccccccccc : recherche personnes intervenantes pour sujet longchronique à
venir lav !
* aaaa : !courant
* Hebdobot : % Sujet individuel en cours : 2/ Actions à venir
* cccccccccc : rdv « tâches importantes » : orga, annonces, présence
* aaaa : Participation à reunion chatons
* cccccccccc : revue hebdomadaire : génération de la synthèse
* aaaa : Participation à réunion chapril
* cccccccccc : divers en fonction du temps
* aaaa : Modération et animation chapril xmpp
* aaaa : Mise en place de mon serveur physique \o/
* aaaa : %fini
* cccccccccc : %cccc_cccccc: fini ?
* cccccccccc : %on va passer à la suite : Points de blocage / points en retard
* cccccccccc : ## 3/ Points de blocage / points en retard corrigés cette semaine
* Hebdobot : % cccccccccc aaaa cccc_cccccc Pppppp, on va passer à la suite : 3/
Points de blocage / points en retard corrigés cette semaine
* Hebdobot : Sujet collectif : 3/ Points de blocage / points en retard corrigés
cette semaine
* Hebdobot : % 1 minute max
* Hebdobot : % si rien à signaler vous pouvez écrire % ras
* Hebdobot : % quand vous avez fini vous le dites par % fini
* aaaa : % cccccccccc : en action passées, modération chapril xmpp ;)
* Pppppp : %ras
* cccc_cccccc : %ras
* cccccccccc : %aaaa : ok
* aaaa : Écouter LAV 100 🤣😅
* cccccccccc : %ras
* aaaa : %fini
* cccccccccc : % ♪ ♫ ♬ ♭
* cccccccccc : %on va passer à la suite : Points de blocage / points en retard
existants à traiter
* cccccccccc : ## 4/ Points de blocage existants / points en retard à traiter
* Hebdobot : % cccccccccc aaaa cccc_cccccc Pppppp, on va passer à la suite : 4/
Points de blocage existants / points en retard à traiter
* Hebdobot : Sujet collectif : 4/ Points de blocage existants / points en retard
à traiter
* Hebdobot : % 1 minute max
* Hebdobot : % si rien à signaler vous pouvez écrire % ras
* Hebdobot : % quand vous avez fini vous le dites par % fini
* Pppppp : rapport d'activité version pdf :)
* aaaa : %ras
* cccc_cccccc : %nspp
* cccccccccc : %bravo Pppppp :)
* cccccccccc : mise en vente t-shirt
* cccccccccc : divers comm' et sensi
* cccccccccc : %fini
* cccccccccc : % on va passer à la suite : Points Forts et Points de Vigilance de
la semaine
* cccccccccc : ## 5/ Points forts de la semaine
* Hebdobot : % cccccccccc aaaa cccc_cccccc Pppppp, on va passer à la suite : 5/
Points forts de la semaine
* Hebdobot : Sujet collectif : 5/ Points forts de la semaine
* Hebdobot : % 1 minute max
* Hebdobot : % si rien à signaler vous pouvez écrire % ras
* Hebdobot : % quand vous avez fini vous le dites par % fini
* cccc_cccccc : La centième de Libre à vous ! \o/
* cccccccccc : lav ! a fêté 100 émissions \o/
* cccc_cccccc : Réunion adminsys
* aaaa : Je vois le bout du tunnel ovh
* cccccccccc : visite surprise de booky à la fin de la réu sensi
* cccccccccc : veste légère pour sortir :)
* cccc_cccccc : réunion sensibilisation en visio
* cccccccccc : % on va passer à la suite : Points de Vigilance de la semaine
* cccccccccc : ## 6/ Points de vigilance de la semaine
* Hebdobot : % cccccccccc aaaa cccc_cccccc Pppppp, on va passer à la suite : 6/
Points de vigilance de la semaine
* Hebdobot : Sujet collectif : 6/ Points de vigilance de la semaine
* Hebdobot : % 1 minute max
* Hebdobot : % si rien à signaler vous pouvez écrire % ras
* Hebdobot : % quand vous avez fini vous le dites par % fini
* Pppppp : la covid nous prive de notre DG
* aaaa : Trop
* cccc_cccccc : garder le rythme et continuer à faire attention
* cccccccccc : l'avalanche de courriels qu'on peut retrouver dans sa bal en
rentrant de congé :)
* cccccccccc : % ♪ ♫ ♬ ♭
* cccccccccc : % on va passer à la suite : Points Forts et Points de Vigilance de
la réunion
* cccccccccc : ## 7/ Points forts de la réunion
* Hebdobot : % cccccccccc aaaa cccc_cccccc Pppppp, on va passer à la suite : 7/
Points forts de la réunion
* Hebdobot : Sujet collectif : 7/ Points forts de la réunion
* Hebdobot : % 1 minute max
* Hebdobot : % si rien à signaler vous pouvez écrire % ras
* Hebdobot : % quand vous avez fini vous le dites par % fini
* aaaa : On est là avec Pppppp
* cccc_cccccc : Polux avec nous \O/
* cccccccccc : elle a lieu, en petit comité, mais elle a lieu :)
* cccc_cccccc : continuité assurée
* cccccccccc : plein d'actions
* cccccccccc : % on va passer à la suite : Points de Vigilance de la réunion
* cccccccccc : ## 8/ Points de vigilance de la réunion
* Hebdobot : % cccccccccc aaaa cccc_cccccc Pppppp, on va passer à la suite : 8/
Points de vigilance de la réunion
* Hebdobot : Sujet collectif : 8/ Points de vigilance de la réunion
* Hebdobot : % 1 minute max
* Hebdobot : % si rien à signaler vous pouvez écrire % ras
* Hebdobot : % quand vous avez fini vous le dites par % fini
* cccc_cccccc : Pensée pour les covidés
* cccccccccc : +1
* cccc_cccccc : %fnin
* cccccccccc : %fini
* cccccccccc : % ♪ ♫ ♬ ♭
* cccccccccc : abus de postage de notes de la part de l'animatrice
* cccccccccc : % ♪ ♫ ♬ ♭
* aaaa : Connexion internet pourrie
* cccccccccc : % Fin de la revue hebdomadaire, merci à vous
* cccccccccc : !fin
Statistiques
C'était la 459e revue hebdomadaire de l'April, la 13e de l'année 2021.
Horaire de début de la revue : 12h00
Horaire de fin de la revue : 12h15
Durée de la revue : 16 minutes
Nombre de personnes participantes : 4
Le dernier record de participation est de 14 personnes le vendredi 14 décembre
2012.
Statistiques sur la participation à la revue (4 personnes) : position 11 (min.=2,
moy.=6,6, max.=14), fréquence 42/459 (9 %)
Statistiques sur la durée de la revue (16 min) : position 5 (min.=7 min,
moy.=15,7 min, max.=20 min), fréquence 33/161 (21 %)

View File

@ -0,0 +1,78 @@
/**
* 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.privatebin;
import java.io.File;
import java.net.URL;
import org.apache.commons.io.FileUtils;
import org.apache.log4j.BasicConfigurator;
import org.junit.Test;
/**
* The Class PrivatebinClientTest.
*/
public class PrivatebinClientTest
{
/**
* Test paste.
*
* @throws Exception
* the exception
*/
@Test
public void testPaste00() throws Exception
{
PrivatebinClient client = new PrivatebinClient(new URL("https://cpaste.org/"));
// PrivatebinClient client = new
// PrivatebinClient("https://paste.chapril.org/");
String text = "This is a test.\ntoto";
client.setExpiration(Expiration.MINUTE_5);
String result = client.paste(text);
System.out.println("result:" + result);
}
/**
* Test paste 01.
*
* @throws Exception
* the exception
*/
@Test
public void testPaste01() throws Exception
{
BasicConfigurator.configure();
PrivatebinClient client = new PrivatebinClient(new URL("https://cpaste.org/"));
// PrivatebinClient client = new
// PrivatebinClient("https://paste.chapril.org/");
// String text = FileUtils.readFileToString(new
// File("./test/org/april/hebdobot/privatebin/20210305-log-irc-revue-hebdomadaire.txt"));
String text = FileUtils.readFileToString(new File("./test/org/april/hebdobot/privatebin/20210402-log-irc-revue-hebdomadaire.txt"));
client.setExpiration(Expiration.MINUTE_5);
String result = client.paste(text);
System.out.println("result:" + result);
}
}