diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..dcbb430 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,1235 @@ +[*] +charset = utf-8 +end_of_line = crlf +indent_size = 4 +indent_style = space +insert_final_newline = true +max_line_length = 120 +tab_width = 4 +ij_continuation_indent_size = 4 +ij_formatter_off_tag = @formatter:off +ij_formatter_on_tag = @formatter:on +ij_formatter_tags_enabled = true +ij_smart_tabs = false +ij_visual_guides = +ij_wrap_on_typing = false + +[*.conf] +indent_size = 2 +tab_width = 2 +ij_continuation_indent_size = 2 +ij_hocon_keep_blank_lines_before_right_brace = 2 +ij_hocon_keep_indents_on_empty_lines = false +ij_hocon_keep_line_breaks = true +ij_hocon_space_after_colon = true +ij_hocon_space_after_comma = true +ij_hocon_space_before_colon = true +ij_hocon_space_before_comma = false +ij_hocon_spaces_within_braces = false +ij_hocon_spaces_within_brackets = false +ij_hocon_spaces_within_method_call_parentheses = false + +[*.css] +ij_css_align_closing_brace_with_properties = false +ij_css_blank_lines_around_nested_selector = 1 +ij_css_blank_lines_between_blocks = 1 +ij_css_block_comment_add_space = false +ij_css_brace_placement = end_of_line +ij_css_enforce_quotes_on_format = false +ij_css_hex_color_long_format = false +ij_css_hex_color_lower_case = false +ij_css_hex_color_short_format = false +ij_css_hex_color_upper_case = false +ij_css_keep_blank_lines_in_code = 2 +ij_css_keep_indents_on_empty_lines = false +ij_css_keep_single_line_blocks = false +ij_css_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow +ij_css_space_after_colon = true +ij_css_space_before_opening_brace = true +ij_css_use_double_quotes = true +ij_css_value_alignment = do_not_align + +[*.csv] +indent_style = tab +ij_csv_keep_indents_on_empty_lines = true +ij_csv_wrap_long_lines = false + +[*.feature] +indent_size = 2 +ij_gherkin_keep_indents_on_empty_lines = false + +[*.less] +indent_size = 2 +ij_less_align_closing_brace_with_properties = false +ij_less_blank_lines_around_nested_selector = 1 +ij_less_blank_lines_between_blocks = 1 +ij_less_block_comment_add_space = false +ij_less_brace_placement = 0 +ij_less_enforce_quotes_on_format = false +ij_less_hex_color_long_format = false +ij_less_hex_color_lower_case = false +ij_less_hex_color_short_format = false +ij_less_hex_color_upper_case = false +ij_less_keep_blank_lines_in_code = 2 +ij_less_keep_indents_on_empty_lines = false +ij_less_keep_single_line_blocks = false +ij_less_line_comment_add_space = false +ij_less_line_comment_at_first_column = false +ij_less_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow +ij_less_space_after_colon = true +ij_less_space_before_opening_brace = true +ij_less_use_double_quotes = true +ij_less_value_alignment = 0 + +[*.proto] +indent_size = 2 +tab_width = 2 +ij_continuation_indent_size = 4 +ij_protobuf_keep_blank_lines_in_code = 2 +ij_protobuf_keep_indents_on_empty_lines = false +ij_protobuf_keep_line_breaks = true +ij_protobuf_space_after_comma = true +ij_protobuf_space_before_comma = false +ij_protobuf_spaces_around_assignment_operators = true +ij_protobuf_spaces_within_braces = false +ij_protobuf_spaces_within_brackets = false + +[*.sass] +indent_size = 2 +ij_sass_align_closing_brace_with_properties = false +ij_sass_blank_lines_around_nested_selector = 1 +ij_sass_blank_lines_between_blocks = 1 +ij_sass_brace_placement = 0 +ij_sass_enforce_quotes_on_format = false +ij_sass_hex_color_long_format = false +ij_sass_hex_color_lower_case = false +ij_sass_hex_color_short_format = false +ij_sass_hex_color_upper_case = false +ij_sass_keep_blank_lines_in_code = 2 +ij_sass_keep_indents_on_empty_lines = false +ij_sass_keep_single_line_blocks = false +ij_sass_line_comment_add_space = false +ij_sass_line_comment_at_first_column = false +ij_sass_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow +ij_sass_space_after_colon = true +ij_sass_space_before_opening_brace = true +ij_sass_use_double_quotes = true +ij_sass_value_alignment = 0 + +[*.scss] +indent_size = 2 +ij_scss_align_closing_brace_with_properties = false +ij_scss_blank_lines_around_nested_selector = 1 +ij_scss_blank_lines_between_blocks = 1 +ij_scss_block_comment_add_space = false +ij_scss_brace_placement = 0 +ij_scss_enforce_quotes_on_format = false +ij_scss_hex_color_long_format = false +ij_scss_hex_color_lower_case = false +ij_scss_hex_color_short_format = false +ij_scss_hex_color_upper_case = false +ij_scss_keep_blank_lines_in_code = 2 +ij_scss_keep_indents_on_empty_lines = false +ij_scss_keep_single_line_blocks = false +ij_scss_line_comment_add_space = false +ij_scss_line_comment_at_first_column = false +ij_scss_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow +ij_scss_space_after_colon = true +ij_scss_space_before_opening_brace = true +ij_scss_use_double_quotes = true +ij_scss_value_alignment = 0 + +[*.vue] +indent_size = 2 +tab_width = 2 +ij_continuation_indent_size = 4 +ij_vue_indent_children_of_top_level = template +ij_vue_interpolation_new_line_after_start_delimiter = true +ij_vue_interpolation_new_line_before_end_delimiter = true +ij_vue_interpolation_wrap = off +ij_vue_keep_indents_on_empty_lines = false +ij_vue_spaces_within_interpolation_expressions = true + +[.editorconfig] +ij_editorconfig_align_group_field_declarations = false +ij_editorconfig_space_after_colon = false +ij_editorconfig_space_after_comma = true +ij_editorconfig_space_before_colon = false +ij_editorconfig_space_before_comma = false +ij_editorconfig_spaces_around_assignment_operators = true + +[machete] +indent_style = tab +ij_git-machete_keep_blank_lines_in_code = 1 +ij_git-machete_keep_indents_on_empty_lines = false + +[{*.ant,*.fxml,*.jhm,*.jnlp,*.jrxml,*.pom,*.rng,*.tld,*.wadl,*.wsdl,*.xml,*.xsd,*.xsl,*.xslt,*.xul}] +ij_xml_align_attributes = true +ij_xml_align_text = false +ij_xml_attribute_wrap = normal +ij_xml_block_comment_add_space = false +ij_xml_block_comment_at_first_column = true +ij_xml_keep_blank_lines = 2 +ij_xml_keep_indents_on_empty_lines = false +ij_xml_keep_line_breaks = true +ij_xml_keep_line_breaks_in_text = true +ij_xml_keep_whitespaces = false +ij_xml_keep_whitespaces_around_cdata = preserve +ij_xml_keep_whitespaces_inside_cdata = false +ij_xml_line_comment_at_first_column = true +ij_xml_space_after_tag_name = false +ij_xml_space_around_equals_in_attribute = false +ij_xml_space_inside_empty_tag = false +ij_xml_text_wrap = normal +ij_xml_use_custom_settings = false + +[{*.ats,*.cts,*.mts,*.ts}] +ij_continuation_indent_size = 4 +ij_typescript_align_imports = false +ij_typescript_align_multiline_array_initializer_expression = false +ij_typescript_align_multiline_binary_operation = false +ij_typescript_align_multiline_chained_methods = false +ij_typescript_align_multiline_extends_list = false +ij_typescript_align_multiline_for = true +ij_typescript_align_multiline_parameters = true +ij_typescript_align_multiline_parameters_in_calls = false +ij_typescript_align_multiline_ternary_operation = false +ij_typescript_align_object_properties = 0 +ij_typescript_align_union_types = false +ij_typescript_align_var_statements = 0 +ij_typescript_array_initializer_new_line_after_left_brace = false +ij_typescript_array_initializer_right_brace_on_new_line = false +ij_typescript_array_initializer_wrap = off +ij_typescript_assignment_wrap = off +ij_typescript_binary_operation_sign_on_next_line = false +ij_typescript_binary_operation_wrap = off +ij_typescript_blacklist_imports = rxjs/Rx,node_modules/**,**/node_modules/**,@angular/material,@angular/material/typings/** +ij_typescript_blank_lines_after_imports = 1 +ij_typescript_blank_lines_around_class = 1 +ij_typescript_blank_lines_around_field = 0 +ij_typescript_blank_lines_around_field_in_interface = 0 +ij_typescript_blank_lines_around_function = 1 +ij_typescript_blank_lines_around_method = 1 +ij_typescript_blank_lines_around_method_in_interface = 1 +ij_typescript_block_brace_style = end_of_line +ij_typescript_block_comment_add_space = false +ij_typescript_block_comment_at_first_column = true +ij_typescript_call_parameters_new_line_after_left_paren = false +ij_typescript_call_parameters_right_paren_on_new_line = false +ij_typescript_call_parameters_wrap = off +ij_typescript_catch_on_new_line = false +ij_typescript_chained_call_dot_on_new_line = true +ij_typescript_class_brace_style = end_of_line +ij_typescript_comma_on_new_line = false +ij_typescript_do_while_brace_force = never +ij_typescript_else_on_new_line = false +ij_typescript_enforce_trailing_comma = keep +ij_typescript_enum_constants_wrap = on_every_item +ij_typescript_extends_keyword_wrap = off +ij_typescript_extends_list_wrap = off +ij_typescript_field_prefix = _ +ij_typescript_file_name_style = relaxed +ij_typescript_finally_on_new_line = false +ij_typescript_for_brace_force = never +ij_typescript_for_statement_new_line_after_left_paren = false +ij_typescript_for_statement_right_paren_on_new_line = false +ij_typescript_for_statement_wrap = off +ij_typescript_force_quote_style = false +ij_typescript_force_semicolon_style = false +ij_typescript_function_expression_brace_style = end_of_line +ij_typescript_if_brace_force = never +ij_typescript_import_merge_members = global +ij_typescript_import_prefer_absolute_path = global +ij_typescript_import_sort_members = true +ij_typescript_import_sort_module_name = false +ij_typescript_import_use_node_resolution = true +ij_typescript_imports_wrap = on_every_item +ij_typescript_indent_case_from_switch = true +ij_typescript_indent_chained_calls = true +ij_typescript_indent_package_children = 0 +ij_typescript_jsdoc_include_types = false +ij_typescript_jsx_attribute_value = braces +ij_typescript_keep_blank_lines_in_code = 2 +ij_typescript_keep_first_column_comment = true +ij_typescript_keep_indents_on_empty_lines = false +ij_typescript_keep_line_breaks = true +ij_typescript_keep_simple_blocks_in_one_line = false +ij_typescript_keep_simple_methods_in_one_line = false +ij_typescript_line_comment_add_space = true +ij_typescript_line_comment_at_first_column = false +ij_typescript_method_brace_style = end_of_line +ij_typescript_method_call_chain_wrap = off +ij_typescript_method_parameters_new_line_after_left_paren = false +ij_typescript_method_parameters_right_paren_on_new_line = false +ij_typescript_method_parameters_wrap = off +ij_typescript_object_literal_wrap = on_every_item +ij_typescript_object_types_wrap = on_every_item +ij_typescript_parentheses_expression_new_line_after_left_paren = false +ij_typescript_parentheses_expression_right_paren_on_new_line = false +ij_typescript_place_assignment_sign_on_next_line = false +ij_typescript_prefer_as_type_cast = false +ij_typescript_prefer_explicit_types_function_expression_returns = false +ij_typescript_prefer_explicit_types_function_returns = false +ij_typescript_prefer_explicit_types_vars_fields = false +ij_typescript_prefer_parameters_wrap = false +ij_typescript_property_prefix = +ij_typescript_reformat_c_style_comments = false +ij_typescript_space_after_colon = true +ij_typescript_space_after_comma = true +ij_typescript_space_after_dots_in_rest_parameter = false +ij_typescript_space_after_generator_mult = true +ij_typescript_space_after_property_colon = true +ij_typescript_space_after_quest = true +ij_typescript_space_after_type_colon = true +ij_typescript_space_after_unary_not = false +ij_typescript_space_before_async_arrow_lparen = true +ij_typescript_space_before_catch_keyword = true +ij_typescript_space_before_catch_left_brace = true +ij_typescript_space_before_catch_parentheses = true +ij_typescript_space_before_class_lbrace = true +ij_typescript_space_before_class_left_brace = true +ij_typescript_space_before_colon = true +ij_typescript_space_before_comma = false +ij_typescript_space_before_do_left_brace = true +ij_typescript_space_before_else_keyword = true +ij_typescript_space_before_else_left_brace = true +ij_typescript_space_before_finally_keyword = true +ij_typescript_space_before_finally_left_brace = true +ij_typescript_space_before_for_left_brace = true +ij_typescript_space_before_for_parentheses = true +ij_typescript_space_before_for_semicolon = false +ij_typescript_space_before_function_left_parenth = true +ij_typescript_space_before_generator_mult = false +ij_typescript_space_before_if_left_brace = true +ij_typescript_space_before_if_parentheses = true +ij_typescript_space_before_method_call_parentheses = false +ij_typescript_space_before_method_left_brace = true +ij_typescript_space_before_method_parentheses = false +ij_typescript_space_before_property_colon = false +ij_typescript_space_before_quest = true +ij_typescript_space_before_switch_left_brace = true +ij_typescript_space_before_switch_parentheses = true +ij_typescript_space_before_try_left_brace = true +ij_typescript_space_before_type_colon = false +ij_typescript_space_before_unary_not = false +ij_typescript_space_before_while_keyword = true +ij_typescript_space_before_while_left_brace = true +ij_typescript_space_before_while_parentheses = true +ij_typescript_spaces_around_additive_operators = true +ij_typescript_spaces_around_arrow_function_operator = true +ij_typescript_spaces_around_assignment_operators = true +ij_typescript_spaces_around_bitwise_operators = true +ij_typescript_spaces_around_equality_operators = true +ij_typescript_spaces_around_logical_operators = true +ij_typescript_spaces_around_multiplicative_operators = true +ij_typescript_spaces_around_relational_operators = true +ij_typescript_spaces_around_shift_operators = true +ij_typescript_spaces_around_unary_operator = false +ij_typescript_spaces_within_array_initializer_brackets = false +ij_typescript_spaces_within_brackets = false +ij_typescript_spaces_within_catch_parentheses = false +ij_typescript_spaces_within_for_parentheses = false +ij_typescript_spaces_within_if_parentheses = false +ij_typescript_spaces_within_imports = false +ij_typescript_spaces_within_interpolation_expressions = false +ij_typescript_spaces_within_method_call_parentheses = false +ij_typescript_spaces_within_method_parentheses = false +ij_typescript_spaces_within_object_literal_braces = false +ij_typescript_spaces_within_object_type_braces = true +ij_typescript_spaces_within_parentheses = false +ij_typescript_spaces_within_switch_parentheses = false +ij_typescript_spaces_within_type_assertion = false +ij_typescript_spaces_within_union_types = true +ij_typescript_spaces_within_while_parentheses = false +ij_typescript_special_else_if_treatment = true +ij_typescript_ternary_operation_signs_on_next_line = false +ij_typescript_ternary_operation_wrap = off +ij_typescript_union_types_wrap = on_every_item +ij_typescript_use_chained_calls_group_indents = false +ij_typescript_use_double_quotes = true +ij_typescript_use_explicit_js_extension = auto +ij_typescript_use_path_mapping = always +ij_typescript_use_public_modifier = false +ij_typescript_use_semicolon_after_statement = true +ij_typescript_var_declaration_wrap = normal +ij_typescript_while_brace_force = never +ij_typescript_while_on_new_line = false +ij_typescript_wrap_comments = false + +[{*.bash,*.sh,*.zsh}] +indent_size = 2 +tab_width = 2 +ij_shell_binary_ops_start_line = false +ij_shell_keep_column_alignment_padding = false +ij_shell_minify_program = false +ij_shell_redirect_followed_by_space = false +ij_shell_switch_cases_indented = false +ij_shell_use_unix_line_separator = true + +[{*.bot,*.cast,*.har,*.jsb2,*.jsb3,*.json,.babelrc,.eslintrc,.stylelintrc,bowerrc,jest.config}] +indent_size = 2 +ij_json_array_wrapping = split_into_lines +ij_json_keep_blank_lines_in_code = 0 +ij_json_keep_indents_on_empty_lines = false +ij_json_keep_line_breaks = true +ij_json_keep_trailing_comma = false +ij_json_object_wrapping = split_into_lines +ij_json_property_alignment = do_not_align +ij_json_space_after_colon = true +ij_json_space_after_comma = true +ij_json_space_before_colon = false +ij_json_space_before_comma = false +ij_json_spaces_within_braces = false +ij_json_spaces_within_brackets = false +ij_json_wrap_long_lines = false + +[{*.cjs,*.js}] +ij_continuation_indent_size = 4 +ij_javascript_align_imports = false +ij_javascript_align_multiline_array_initializer_expression = false +ij_javascript_align_multiline_binary_operation = false +ij_javascript_align_multiline_chained_methods = false +ij_javascript_align_multiline_extends_list = false +ij_javascript_align_multiline_for = true +ij_javascript_align_multiline_parameters = true +ij_javascript_align_multiline_parameters_in_calls = false +ij_javascript_align_multiline_ternary_operation = false +ij_javascript_align_object_properties = 0 +ij_javascript_align_union_types = false +ij_javascript_align_var_statements = 0 +ij_javascript_array_initializer_new_line_after_left_brace = false +ij_javascript_array_initializer_right_brace_on_new_line = false +ij_javascript_array_initializer_wrap = off +ij_javascript_assignment_wrap = off +ij_javascript_binary_operation_sign_on_next_line = false +ij_javascript_binary_operation_wrap = off +ij_javascript_blacklist_imports = rxjs/Rx,node_modules/**,**/node_modules/**,@angular/material,@angular/material/typings/** +ij_javascript_blank_lines_after_imports = 1 +ij_javascript_blank_lines_around_class = 1 +ij_javascript_blank_lines_around_field = 0 +ij_javascript_blank_lines_around_function = 1 +ij_javascript_blank_lines_around_method = 1 +ij_javascript_block_brace_style = end_of_line +ij_javascript_block_comment_add_space = false +ij_javascript_block_comment_at_first_column = true +ij_javascript_call_parameters_new_line_after_left_paren = false +ij_javascript_call_parameters_right_paren_on_new_line = false +ij_javascript_call_parameters_wrap = off +ij_javascript_catch_on_new_line = false +ij_javascript_chained_call_dot_on_new_line = true +ij_javascript_class_brace_style = end_of_line +ij_javascript_comma_on_new_line = false +ij_javascript_do_while_brace_force = never +ij_javascript_else_on_new_line = false +ij_javascript_enforce_trailing_comma = keep +ij_javascript_extends_keyword_wrap = off +ij_javascript_extends_list_wrap = off +ij_javascript_field_prefix = _ +ij_javascript_file_name_style = relaxed +ij_javascript_finally_on_new_line = false +ij_javascript_for_brace_force = never +ij_javascript_for_statement_new_line_after_left_paren = false +ij_javascript_for_statement_right_paren_on_new_line = false +ij_javascript_for_statement_wrap = off +ij_javascript_force_quote_style = false +ij_javascript_force_semicolon_style = false +ij_javascript_function_expression_brace_style = end_of_line +ij_javascript_if_brace_force = never +ij_javascript_import_merge_members = global +ij_javascript_import_prefer_absolute_path = global +ij_javascript_import_sort_members = true +ij_javascript_import_sort_module_name = false +ij_javascript_import_use_node_resolution = true +ij_javascript_imports_wrap = on_every_item +ij_javascript_indent_case_from_switch = true +ij_javascript_indent_chained_calls = true +ij_javascript_indent_package_children = 0 +ij_javascript_jsx_attribute_value = braces +ij_javascript_keep_blank_lines_in_code = 2 +ij_javascript_keep_first_column_comment = true +ij_javascript_keep_indents_on_empty_lines = false +ij_javascript_keep_line_breaks = true +ij_javascript_keep_simple_blocks_in_one_line = false +ij_javascript_keep_simple_methods_in_one_line = false +ij_javascript_line_comment_add_space = true +ij_javascript_line_comment_at_first_column = false +ij_javascript_method_brace_style = end_of_line +ij_javascript_method_call_chain_wrap = off +ij_javascript_method_parameters_new_line_after_left_paren = false +ij_javascript_method_parameters_right_paren_on_new_line = false +ij_javascript_method_parameters_wrap = off +ij_javascript_object_literal_wrap = on_every_item +ij_javascript_object_types_wrap = on_every_item +ij_javascript_parentheses_expression_new_line_after_left_paren = false +ij_javascript_parentheses_expression_right_paren_on_new_line = false +ij_javascript_place_assignment_sign_on_next_line = false +ij_javascript_prefer_as_type_cast = false +ij_javascript_prefer_explicit_types_function_expression_returns = false +ij_javascript_prefer_explicit_types_function_returns = false +ij_javascript_prefer_explicit_types_vars_fields = false +ij_javascript_prefer_parameters_wrap = false +ij_javascript_property_prefix = +ij_javascript_reformat_c_style_comments = false +ij_javascript_space_after_colon = true +ij_javascript_space_after_comma = true +ij_javascript_space_after_dots_in_rest_parameter = false +ij_javascript_space_after_generator_mult = true +ij_javascript_space_after_property_colon = true +ij_javascript_space_after_quest = true +ij_javascript_space_after_type_colon = true +ij_javascript_space_after_unary_not = false +ij_javascript_space_before_async_arrow_lparen = true +ij_javascript_space_before_catch_keyword = true +ij_javascript_space_before_catch_left_brace = true +ij_javascript_space_before_catch_parentheses = true +ij_javascript_space_before_class_lbrace = true +ij_javascript_space_before_class_left_brace = true +ij_javascript_space_before_colon = true +ij_javascript_space_before_comma = false +ij_javascript_space_before_do_left_brace = true +ij_javascript_space_before_else_keyword = true +ij_javascript_space_before_else_left_brace = true +ij_javascript_space_before_finally_keyword = true +ij_javascript_space_before_finally_left_brace = true +ij_javascript_space_before_for_left_brace = true +ij_javascript_space_before_for_parentheses = true +ij_javascript_space_before_for_semicolon = false +ij_javascript_space_before_function_left_parenth = true +ij_javascript_space_before_generator_mult = false +ij_javascript_space_before_if_left_brace = true +ij_javascript_space_before_if_parentheses = true +ij_javascript_space_before_method_call_parentheses = false +ij_javascript_space_before_method_left_brace = true +ij_javascript_space_before_method_parentheses = false +ij_javascript_space_before_property_colon = false +ij_javascript_space_before_quest = true +ij_javascript_space_before_switch_left_brace = true +ij_javascript_space_before_switch_parentheses = true +ij_javascript_space_before_try_left_brace = true +ij_javascript_space_before_type_colon = false +ij_javascript_space_before_unary_not = false +ij_javascript_space_before_while_keyword = true +ij_javascript_space_before_while_left_brace = true +ij_javascript_space_before_while_parentheses = true +ij_javascript_spaces_around_additive_operators = true +ij_javascript_spaces_around_arrow_function_operator = true +ij_javascript_spaces_around_assignment_operators = true +ij_javascript_spaces_around_bitwise_operators = true +ij_javascript_spaces_around_equality_operators = true +ij_javascript_spaces_around_logical_operators = true +ij_javascript_spaces_around_multiplicative_operators = true +ij_javascript_spaces_around_relational_operators = true +ij_javascript_spaces_around_shift_operators = true +ij_javascript_spaces_around_unary_operator = false +ij_javascript_spaces_within_array_initializer_brackets = false +ij_javascript_spaces_within_brackets = false +ij_javascript_spaces_within_catch_parentheses = false +ij_javascript_spaces_within_for_parentheses = false +ij_javascript_spaces_within_if_parentheses = false +ij_javascript_spaces_within_imports = false +ij_javascript_spaces_within_interpolation_expressions = false +ij_javascript_spaces_within_method_call_parentheses = false +ij_javascript_spaces_within_method_parentheses = false +ij_javascript_spaces_within_object_literal_braces = false +ij_javascript_spaces_within_object_type_braces = true +ij_javascript_spaces_within_parentheses = false +ij_javascript_spaces_within_switch_parentheses = false +ij_javascript_spaces_within_type_assertion = false +ij_javascript_spaces_within_union_types = true +ij_javascript_spaces_within_while_parentheses = false +ij_javascript_special_else_if_treatment = true +ij_javascript_ternary_operation_signs_on_next_line = false +ij_javascript_ternary_operation_wrap = off +ij_javascript_union_types_wrap = on_every_item +ij_javascript_use_chained_calls_group_indents = false +ij_javascript_use_double_quotes = true +ij_javascript_use_explicit_js_extension = auto +ij_javascript_use_path_mapping = always +ij_javascript_use_public_modifier = false +ij_javascript_use_semicolon_after_statement = true +ij_javascript_var_declaration_wrap = normal +ij_javascript_while_brace_force = never +ij_javascript_while_on_new_line = false +ij_javascript_wrap_comments = false + +[{*.factories,*.properties,spring.handlers,spring.schemas}] +ij_properties_align_group_field_declarations = false +ij_properties_keep_blank_lines = false +ij_properties_key_value_delimiter = equals +ij_properties_spaces_around_key_value_delimiter = false + +[{*.ft,*.vm,*.vsl}] +ij_vtl_keep_indents_on_empty_lines = false + +[{*.gant,*.groovy,*.gy}] +ij_groovy_align_group_field_declarations = false +ij_groovy_align_multiline_array_initializer_expression = false +ij_groovy_align_multiline_assignment = false +ij_groovy_align_multiline_binary_operation = false +ij_groovy_align_multiline_chained_methods = false +ij_groovy_align_multiline_extends_list = false +ij_groovy_align_multiline_for = true +ij_groovy_align_multiline_list_or_map = true +ij_groovy_align_multiline_method_parentheses = false +ij_groovy_align_multiline_parameters = true +ij_groovy_align_multiline_parameters_in_calls = false +ij_groovy_align_multiline_resources = true +ij_groovy_align_multiline_ternary_operation = false +ij_groovy_align_multiline_throws_list = false +ij_groovy_align_named_args_in_map = true +ij_groovy_align_throws_keyword = false +ij_groovy_array_initializer_new_line_after_left_brace = false +ij_groovy_array_initializer_right_brace_on_new_line = false +ij_groovy_array_initializer_wrap = off +ij_groovy_assert_statement_wrap = off +ij_groovy_assignment_wrap = off +ij_groovy_binary_operation_wrap = off +ij_groovy_blank_lines_after_class_header = 0 +ij_groovy_blank_lines_after_imports = 1 +ij_groovy_blank_lines_after_package = 1 +ij_groovy_blank_lines_around_class = 1 +ij_groovy_blank_lines_around_field = 0 +ij_groovy_blank_lines_around_field_in_interface = 0 +ij_groovy_blank_lines_around_method = 1 +ij_groovy_blank_lines_around_method_in_interface = 1 +ij_groovy_blank_lines_before_imports = 1 +ij_groovy_blank_lines_before_method_body = 0 +ij_groovy_blank_lines_before_package = 0 +ij_groovy_block_brace_style = end_of_line +ij_groovy_block_comment_add_space = false +ij_groovy_block_comment_at_first_column = true +ij_groovy_call_parameters_new_line_after_left_paren = false +ij_groovy_call_parameters_right_paren_on_new_line = false +ij_groovy_call_parameters_wrap = off +ij_groovy_catch_on_new_line = false +ij_groovy_class_annotation_wrap = split_into_lines +ij_groovy_class_brace_style = end_of_line +ij_groovy_class_count_to_use_import_on_demand = 5 +ij_groovy_do_while_brace_force = never +ij_groovy_else_on_new_line = false +ij_groovy_enable_groovydoc_formatting = true +ij_groovy_enum_constants_wrap = off +ij_groovy_extends_keyword_wrap = off +ij_groovy_extends_list_wrap = off +ij_groovy_field_annotation_wrap = split_into_lines +ij_groovy_finally_on_new_line = false +ij_groovy_for_brace_force = never +ij_groovy_for_statement_new_line_after_left_paren = false +ij_groovy_for_statement_right_paren_on_new_line = false +ij_groovy_for_statement_wrap = off +ij_groovy_ginq_general_clause_wrap_policy = 2 +ij_groovy_ginq_having_wrap_policy = 1 +ij_groovy_ginq_indent_having_clause = true +ij_groovy_ginq_indent_on_clause = true +ij_groovy_ginq_on_wrap_policy = 1 +ij_groovy_ginq_space_after_keyword = true +ij_groovy_if_brace_force = never +ij_groovy_import_annotation_wrap = 2 +ij_groovy_imports_layout = *,|,javax.**,java.**,|,$* +ij_groovy_indent_case_from_switch = true +ij_groovy_indent_label_blocks = true +ij_groovy_insert_inner_class_imports = false +ij_groovy_keep_blank_lines_before_right_brace = 2 +ij_groovy_keep_blank_lines_in_code = 2 +ij_groovy_keep_blank_lines_in_declarations = 2 +ij_groovy_keep_control_statement_in_one_line = true +ij_groovy_keep_first_column_comment = true +ij_groovy_keep_indents_on_empty_lines = false +ij_groovy_keep_line_breaks = true +ij_groovy_keep_multiple_expressions_in_one_line = false +ij_groovy_keep_simple_blocks_in_one_line = false +ij_groovy_keep_simple_classes_in_one_line = true +ij_groovy_keep_simple_lambdas_in_one_line = true +ij_groovy_keep_simple_methods_in_one_line = true +ij_groovy_label_indent_absolute = false +ij_groovy_label_indent_size = 0 +ij_groovy_lambda_brace_style = end_of_line +ij_groovy_layout_static_imports_separately = true +ij_groovy_line_comment_add_space = false +ij_groovy_line_comment_add_space_on_reformat = false +ij_groovy_line_comment_at_first_column = true +ij_groovy_method_annotation_wrap = split_into_lines +ij_groovy_method_brace_style = end_of_line +ij_groovy_method_call_chain_wrap = off +ij_groovy_method_parameters_new_line_after_left_paren = false +ij_groovy_method_parameters_right_paren_on_new_line = false +ij_groovy_method_parameters_wrap = off +ij_groovy_modifier_list_wrap = false +ij_groovy_names_count_to_use_import_on_demand = 3 +ij_groovy_packages_to_use_import_on_demand = java.awt.*,javax.swing.* +ij_groovy_parameter_annotation_wrap = off +ij_groovy_parentheses_expression_new_line_after_left_paren = false +ij_groovy_parentheses_expression_right_paren_on_new_line = false +ij_groovy_prefer_parameters_wrap = false +ij_groovy_resource_list_new_line_after_left_paren = false +ij_groovy_resource_list_right_paren_on_new_line = false +ij_groovy_resource_list_wrap = off +ij_groovy_space_after_assert_separator = true +ij_groovy_space_after_colon = true +ij_groovy_space_after_comma = true +ij_groovy_space_after_comma_in_type_arguments = true +ij_groovy_space_after_for_semicolon = true +ij_groovy_space_after_quest = true +ij_groovy_space_after_type_cast = true +ij_groovy_space_before_annotation_parameter_list = false +ij_groovy_space_before_array_initializer_left_brace = false +ij_groovy_space_before_assert_separator = false +ij_groovy_space_before_catch_keyword = true +ij_groovy_space_before_catch_left_brace = true +ij_groovy_space_before_catch_parentheses = true +ij_groovy_space_before_class_left_brace = true +ij_groovy_space_before_closure_left_brace = true +ij_groovy_space_before_colon = true +ij_groovy_space_before_comma = false +ij_groovy_space_before_do_left_brace = true +ij_groovy_space_before_else_keyword = true +ij_groovy_space_before_else_left_brace = true +ij_groovy_space_before_finally_keyword = true +ij_groovy_space_before_finally_left_brace = true +ij_groovy_space_before_for_left_brace = true +ij_groovy_space_before_for_parentheses = true +ij_groovy_space_before_for_semicolon = false +ij_groovy_space_before_if_left_brace = true +ij_groovy_space_before_if_parentheses = true +ij_groovy_space_before_method_call_parentheses = false +ij_groovy_space_before_method_left_brace = true +ij_groovy_space_before_method_parentheses = false +ij_groovy_space_before_quest = true +ij_groovy_space_before_record_parentheses = false +ij_groovy_space_before_switch_left_brace = true +ij_groovy_space_before_switch_parentheses = true +ij_groovy_space_before_synchronized_left_brace = true +ij_groovy_space_before_synchronized_parentheses = true +ij_groovy_space_before_try_left_brace = true +ij_groovy_space_before_try_parentheses = true +ij_groovy_space_before_while_keyword = true +ij_groovy_space_before_while_left_brace = true +ij_groovy_space_before_while_parentheses = true +ij_groovy_space_in_named_argument = true +ij_groovy_space_in_named_argument_before_colon = false +ij_groovy_space_within_empty_array_initializer_braces = false +ij_groovy_space_within_empty_method_call_parentheses = false +ij_groovy_spaces_around_additive_operators = true +ij_groovy_spaces_around_assignment_operators = true +ij_groovy_spaces_around_bitwise_operators = true +ij_groovy_spaces_around_equality_operators = true +ij_groovy_spaces_around_lambda_arrow = true +ij_groovy_spaces_around_logical_operators = true +ij_groovy_spaces_around_multiplicative_operators = true +ij_groovy_spaces_around_regex_operators = true +ij_groovy_spaces_around_relational_operators = true +ij_groovy_spaces_around_shift_operators = true +ij_groovy_spaces_within_annotation_parentheses = false +ij_groovy_spaces_within_array_initializer_braces = false +ij_groovy_spaces_within_braces = true +ij_groovy_spaces_within_brackets = false +ij_groovy_spaces_within_cast_parentheses = false +ij_groovy_spaces_within_catch_parentheses = false +ij_groovy_spaces_within_for_parentheses = false +ij_groovy_spaces_within_gstring_injection_braces = false +ij_groovy_spaces_within_if_parentheses = false +ij_groovy_spaces_within_list_or_map = false +ij_groovy_spaces_within_method_call_parentheses = false +ij_groovy_spaces_within_method_parentheses = false +ij_groovy_spaces_within_parentheses = false +ij_groovy_spaces_within_switch_parentheses = false +ij_groovy_spaces_within_synchronized_parentheses = false +ij_groovy_spaces_within_try_parentheses = false +ij_groovy_spaces_within_tuple_expression = false +ij_groovy_spaces_within_while_parentheses = false +ij_groovy_special_else_if_treatment = true +ij_groovy_ternary_operation_wrap = off +ij_groovy_throws_keyword_wrap = off +ij_groovy_throws_list_wrap = off +ij_groovy_use_flying_geese_braces = false +ij_groovy_use_fq_class_names = false +ij_groovy_use_fq_class_names_in_javadoc = true +ij_groovy_use_relative_indents = false +ij_groovy_use_single_class_imports = true +ij_groovy_variable_annotation_wrap = off +ij_groovy_while_brace_force = never +ij_groovy_while_on_new_line = false +ij_groovy_wrap_chain_calls_after_dot = false +ij_groovy_wrap_long_lines = false + +[{*.gradle.kts,*.kt,*.kts,*.main.kts,*.space.kts}] +ij_kotlin_align_in_columns_case_branch = false +ij_kotlin_align_multiline_binary_operation = false +ij_kotlin_align_multiline_extends_list = false +ij_kotlin_align_multiline_method_parentheses = false +ij_kotlin_align_multiline_parameters = true +ij_kotlin_align_multiline_parameters_in_calls = false +ij_kotlin_allow_trailing_comma = false +ij_kotlin_allow_trailing_comma_on_call_site = false +ij_kotlin_assignment_wrap = normal +ij_kotlin_blank_lines_after_class_header = 0 +ij_kotlin_blank_lines_around_block_when_branches = 0 +ij_kotlin_blank_lines_before_declaration_with_comment_or_annotation_on_separate_line = 1 +ij_kotlin_block_comment_add_space = false +ij_kotlin_block_comment_at_first_column = true +ij_kotlin_call_parameters_new_line_after_left_paren = true +ij_kotlin_call_parameters_right_paren_on_new_line = true +ij_kotlin_call_parameters_wrap = on_every_item +ij_kotlin_catch_on_new_line = false +ij_kotlin_class_annotation_wrap = split_into_lines +ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL +ij_kotlin_continuation_indent_for_chained_calls = false +ij_kotlin_continuation_indent_for_expression_bodies = false +ij_kotlin_continuation_indent_in_argument_lists = false +ij_kotlin_continuation_indent_in_elvis = false +ij_kotlin_continuation_indent_in_if_conditions = false +ij_kotlin_continuation_indent_in_parameter_lists = false +ij_kotlin_continuation_indent_in_supertype_lists = false +ij_kotlin_else_on_new_line = false +ij_kotlin_enum_constants_wrap = off +ij_kotlin_extends_list_wrap = normal +ij_kotlin_field_annotation_wrap = split_into_lines +ij_kotlin_finally_on_new_line = false +ij_kotlin_if_rparen_on_new_line = true +ij_kotlin_import_nested_classes = false +ij_kotlin_imports_layout = *,java.**,javax.**,kotlin.**,^ +ij_kotlin_insert_whitespaces_in_simple_one_line_method = true +ij_kotlin_keep_blank_lines_before_right_brace = 2 +ij_kotlin_keep_blank_lines_in_code = 2 +ij_kotlin_keep_blank_lines_in_declarations = 2 +ij_kotlin_keep_first_column_comment = true +ij_kotlin_keep_indents_on_empty_lines = false +ij_kotlin_keep_line_breaks = true +ij_kotlin_lbrace_on_next_line = false +ij_kotlin_line_break_after_multiline_when_entry = true +ij_kotlin_line_comment_add_space = true +ij_kotlin_line_comment_add_space_on_reformat = false +ij_kotlin_line_comment_at_first_column = false +ij_kotlin_method_annotation_wrap = split_into_lines +ij_kotlin_method_call_chain_wrap = normal +ij_kotlin_method_parameters_new_line_after_left_paren = true +ij_kotlin_method_parameters_right_paren_on_new_line = true +ij_kotlin_method_parameters_wrap = on_every_item +ij_kotlin_name_count_to_use_star_import = 5 +ij_kotlin_name_count_to_use_star_import_for_members = 3 +ij_kotlin_packages_to_use_import_on_demand = java.util.*,kotlinx.android.synthetic.**,io.ktor.** +ij_kotlin_parameter_annotation_wrap = off +ij_kotlin_space_after_comma = true +ij_kotlin_space_after_extend_colon = true +ij_kotlin_space_after_type_colon = true +ij_kotlin_space_before_catch_parentheses = true +ij_kotlin_space_before_comma = false +ij_kotlin_space_before_extend_colon = true +ij_kotlin_space_before_for_parentheses = true +ij_kotlin_space_before_if_parentheses = true +ij_kotlin_space_before_lambda_arrow = true +ij_kotlin_space_before_type_colon = false +ij_kotlin_space_before_when_parentheses = true +ij_kotlin_space_before_while_parentheses = true +ij_kotlin_spaces_around_additive_operators = true +ij_kotlin_spaces_around_assignment_operators = true +ij_kotlin_spaces_around_equality_operators = true +ij_kotlin_spaces_around_function_type_arrow = true +ij_kotlin_spaces_around_logical_operators = true +ij_kotlin_spaces_around_multiplicative_operators = true +ij_kotlin_spaces_around_range = false +ij_kotlin_spaces_around_relational_operators = true +ij_kotlin_spaces_around_unary_operator = false +ij_kotlin_spaces_around_when_arrow = true +ij_kotlin_use_custom_formatting_for_modifiers = true +ij_kotlin_variable_annotation_wrap = off +ij_kotlin_while_on_new_line = false +ij_kotlin_wrap_elvis_expressions = 1 +ij_kotlin_wrap_expression_body_functions = 1 +ij_kotlin_wrap_first_method_in_call_chain = false + +[{*.htm,*.html,*.ng,*.sht,*.shtm,*.shtml}] +ij_html_add_new_line_before_tags = body,div,p,form,h1,h2,h3 +ij_html_align_attributes = true +ij_html_align_text = false +ij_html_attribute_wrap = normal +ij_html_block_comment_add_space = false +ij_html_block_comment_at_first_column = true +ij_html_do_not_align_children_of_min_lines = 0 +ij_html_do_not_break_if_inline_tags = title,h1,h2,h3,h4,h5,h6,p +ij_html_do_not_indent_children_of_tags = html,body,thead,tbody,tfoot +ij_html_enforce_quotes = false +ij_html_inline_tags = a,abbr,acronym,b,basefont,bdo,big,br,cite,cite,code,dfn,em,font,i,img,input,kbd,label,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var +ij_html_keep_blank_lines = 2 +ij_html_keep_indents_on_empty_lines = false +ij_html_keep_line_breaks = true +ij_html_keep_line_breaks_in_text = true +ij_html_keep_whitespaces = false +ij_html_keep_whitespaces_inside = span,pre,textarea +ij_html_line_comment_at_first_column = true +ij_html_new_line_after_last_attribute = never +ij_html_new_line_before_first_attribute = never +ij_html_quote_style = double +ij_html_remove_new_line_before_tags = br +ij_html_space_after_tag_name = false +ij_html_space_around_equality_in_attribute = false +ij_html_space_inside_empty_tag = false +ij_html_text_wrap = normal + +[{*.http,*.rest}] +indent_size = 0 +ij_continuation_indent_size = 4 +ij_http-request_call_parameters_wrap = normal +ij_http-request_method_parameters_wrap = split_into_lines +ij_http-request_space_before_comma = true +ij_http-request_spaces_around_assignment_operators = true + +[{*.java,*.jvav}] +ij_java_align_consecutive_assignments = false +ij_java_align_consecutive_variable_declarations = false +ij_java_align_group_field_declarations = false +ij_java_align_multiline_annotation_parameters = false +ij_java_align_multiline_array_initializer_expression = false +ij_java_align_multiline_assignment = false +ij_java_align_multiline_binary_operation = true +ij_java_align_multiline_chained_methods = false +ij_java_align_multiline_deconstruction_list_components = true +ij_java_align_multiline_extends_list = false +ij_java_align_multiline_for = true +ij_java_align_multiline_method_parentheses = false +ij_java_align_multiline_parameters = true +ij_java_align_multiline_parameters_in_calls = false +ij_java_align_multiline_parenthesized_expression = false +ij_java_align_multiline_records = true +ij_java_align_multiline_resources = true +ij_java_align_multiline_ternary_operation = false +ij_java_align_multiline_text_blocks = false +ij_java_align_multiline_throws_list = false +ij_java_align_subsequent_simple_methods = false +ij_java_align_throws_keyword = false +ij_java_align_types_in_multi_catch = true +ij_java_annotation_parameter_wrap = off +ij_java_array_initializer_new_line_after_left_brace = false +ij_java_array_initializer_right_brace_on_new_line = false +ij_java_array_initializer_wrap = off +ij_java_assert_statement_colon_on_next_line = false +ij_java_assert_statement_wrap = off +ij_java_assignment_wrap = off +ij_java_binary_operation_sign_on_next_line = false +ij_java_binary_operation_wrap = off +ij_java_blank_lines_after_anonymous_class_header = 0 +ij_java_blank_lines_after_class_header = 0 +ij_java_blank_lines_after_imports = 1 +ij_java_blank_lines_after_package = 1 +ij_java_blank_lines_around_class = 1 +ij_java_blank_lines_around_field = 0 +ij_java_blank_lines_around_field_in_interface = 0 +ij_java_blank_lines_around_initializer = 1 +ij_java_blank_lines_around_method = 1 +ij_java_blank_lines_around_method_in_interface = 1 +ij_java_blank_lines_before_class_end = 0 +ij_java_blank_lines_before_imports = 1 +ij_java_blank_lines_before_method_body = 0 +ij_java_blank_lines_before_package = 0 +ij_java_block_brace_style = end_of_line +ij_java_block_comment_add_space = false +ij_java_block_comment_at_first_column = true +ij_java_builder_methods = +ij_java_call_parameters_new_line_after_left_paren = false +ij_java_call_parameters_right_paren_on_new_line = false +ij_java_call_parameters_wrap = off +ij_java_case_statement_on_separate_line = true +ij_java_catch_on_new_line = false +ij_java_class_annotation_wrap = split_into_lines +ij_java_class_brace_style = end_of_line +ij_java_class_count_to_use_import_on_demand = 5 +ij_java_class_names_in_javadoc = 1 +ij_java_deconstruction_list_wrap = normal +ij_java_do_not_indent_top_level_class_members = false +ij_java_do_not_wrap_after_single_annotation = false +ij_java_do_not_wrap_after_single_annotation_in_parameter = false +ij_java_do_while_brace_force = never +ij_java_doc_add_blank_line_after_description = true +ij_java_doc_add_blank_line_after_param_comments = false +ij_java_doc_add_blank_line_after_return = false +ij_java_doc_add_p_tag_on_empty_lines = true +ij_java_doc_align_exception_comments = true +ij_java_doc_align_param_comments = true +ij_java_doc_do_not_wrap_if_one_line = false +ij_java_doc_enable_formatting = true +ij_java_doc_enable_leading_asterisks = true +ij_java_doc_indent_on_continuation = false +ij_java_doc_keep_empty_lines = true +ij_java_doc_keep_empty_parameter_tag = true +ij_java_doc_keep_empty_return_tag = true +ij_java_doc_keep_empty_throws_tag = true +ij_java_doc_keep_invalid_tags = true +ij_java_doc_param_description_on_new_line = false +ij_java_doc_preserve_line_breaks = false +ij_java_doc_use_throws_not_exception_tag = true +ij_java_else_on_new_line = false +ij_java_entity_dd_prefix = +ij_java_entity_dd_suffix = EJB +ij_java_entity_eb_prefix = +ij_java_entity_eb_suffix = Bean +ij_java_entity_hi_prefix = +ij_java_entity_hi_suffix = Home +ij_java_entity_lhi_prefix = Local +ij_java_entity_lhi_suffix = Home +ij_java_entity_li_prefix = Local +ij_java_entity_li_suffix = +ij_java_entity_pk_class = java.lang.String +ij_java_entity_ri_prefix = +ij_java_entity_ri_suffix = +ij_java_entity_vo_prefix = +ij_java_entity_vo_suffix = VO +ij_java_enum_constants_wrap = off +ij_java_extends_keyword_wrap = off +ij_java_extends_list_wrap = off +ij_java_field_annotation_wrap = split_into_lines +ij_java_field_name_prefix = +ij_java_field_name_suffix = +ij_java_filter_class_prefix = +ij_java_filter_class_suffix = +ij_java_filter_dd_prefix = +ij_java_filter_dd_suffix = +ij_java_finally_on_new_line = false +ij_java_for_brace_force = never +ij_java_for_statement_new_line_after_left_paren = false +ij_java_for_statement_right_paren_on_new_line = false +ij_java_for_statement_wrap = off +ij_java_generate_final_locals = false +ij_java_generate_final_parameters = false +ij_java_if_brace_force = never +ij_java_imports_layout = *,|,javax.**,java.**,|,$* +ij_java_indent_case_from_switch = true +ij_java_insert_inner_class_imports = false +ij_java_insert_override_annotation = true +ij_java_keep_blank_lines_before_right_brace = 2 +ij_java_keep_blank_lines_between_package_declaration_and_header = 2 +ij_java_keep_blank_lines_in_code = 2 +ij_java_keep_blank_lines_in_declarations = 2 +ij_java_keep_builder_methods_indents = false +ij_java_keep_control_statement_in_one_line = true +ij_java_keep_first_column_comment = true +ij_java_keep_indents_on_empty_lines = false +ij_java_keep_line_breaks = true +ij_java_keep_multiple_expressions_in_one_line = false +ij_java_keep_simple_blocks_in_one_line = false +ij_java_keep_simple_classes_in_one_line = false +ij_java_keep_simple_lambdas_in_one_line = false +ij_java_keep_simple_methods_in_one_line = false +ij_java_label_indent_absolute = false +ij_java_label_indent_size = 0 +ij_java_lambda_brace_style = end_of_line +ij_java_layout_static_imports_separately = true +ij_java_line_comment_add_space = false +ij_java_line_comment_add_space_on_reformat = false +ij_java_line_comment_at_first_column = true +ij_java_listener_class_prefix = +ij_java_listener_class_suffix = +ij_java_local_variable_name_prefix = +ij_java_local_variable_name_suffix = +ij_java_message_dd_prefix = +ij_java_message_dd_suffix = EJB +ij_java_message_eb_prefix = +ij_java_message_eb_suffix = Bean +ij_java_method_annotation_wrap = split_into_lines +ij_java_method_brace_style = end_of_line +ij_java_method_call_chain_wrap = off +ij_java_method_parameters_new_line_after_left_paren = false +ij_java_method_parameters_right_paren_on_new_line = false +ij_java_method_parameters_wrap = off +ij_java_modifier_list_wrap = false +ij_java_multi_catch_types_wrap = normal +ij_java_names_count_to_use_import_on_demand = 3 +ij_java_new_line_after_lparen_in_annotation = false +ij_java_new_line_after_lparen_in_deconstruction_pattern = true +ij_java_new_line_after_lparen_in_record_header = false +ij_java_packages_to_use_import_on_demand = java.awt.*,javax.swing.* +ij_java_parameter_annotation_wrap = off +ij_java_parameter_name_prefix = +ij_java_parameter_name_suffix = +ij_java_parentheses_expression_new_line_after_left_paren = false +ij_java_parentheses_expression_right_paren_on_new_line = false +ij_java_place_assignment_sign_on_next_line = false +ij_java_prefer_longer_names = true +ij_java_prefer_parameters_wrap = false +ij_java_record_components_wrap = normal +ij_java_repeat_annotations = +ij_java_repeat_synchronized = true +ij_java_replace_instanceof_and_cast = false +ij_java_replace_null_check = true +ij_java_replace_sum_lambda_with_method_ref = true +ij_java_resource_list_new_line_after_left_paren = false +ij_java_resource_list_right_paren_on_new_line = false +ij_java_resource_list_wrap = off +ij_java_rparen_on_new_line_in_annotation = false +ij_java_rparen_on_new_line_in_deconstruction_pattern = true +ij_java_rparen_on_new_line_in_record_header = false +ij_java_servlet_class_prefix = +ij_java_servlet_class_suffix = +ij_java_servlet_dd_prefix = +ij_java_servlet_dd_suffix = +ij_java_session_dd_prefix = +ij_java_session_dd_suffix = EJB +ij_java_session_eb_prefix = +ij_java_session_eb_suffix = Bean +ij_java_session_hi_prefix = +ij_java_session_hi_suffix = Home +ij_java_session_lhi_prefix = Local +ij_java_session_lhi_suffix = Home +ij_java_session_li_prefix = Local +ij_java_session_li_suffix = +ij_java_session_ri_prefix = +ij_java_session_ri_suffix = +ij_java_session_si_prefix = +ij_java_session_si_suffix = Service +ij_java_space_after_closing_angle_bracket_in_type_argument = false +ij_java_space_after_colon = true +ij_java_space_after_comma = true +ij_java_space_after_comma_in_type_arguments = true +ij_java_space_after_for_semicolon = true +ij_java_space_after_quest = true +ij_java_space_after_type_cast = true +ij_java_space_before_annotation_array_initializer_left_brace = false +ij_java_space_before_annotation_parameter_list = false +ij_java_space_before_array_initializer_left_brace = false +ij_java_space_before_catch_keyword = true +ij_java_space_before_catch_left_brace = true +ij_java_space_before_catch_parentheses = true +ij_java_space_before_class_left_brace = true +ij_java_space_before_colon = true +ij_java_space_before_colon_in_foreach = true +ij_java_space_before_comma = false +ij_java_space_before_deconstruction_list = false +ij_java_space_before_do_left_brace = true +ij_java_space_before_else_keyword = true +ij_java_space_before_else_left_brace = true +ij_java_space_before_finally_keyword = true +ij_java_space_before_finally_left_brace = true +ij_java_space_before_for_left_brace = true +ij_java_space_before_for_parentheses = true +ij_java_space_before_for_semicolon = false +ij_java_space_before_if_left_brace = true +ij_java_space_before_if_parentheses = true +ij_java_space_before_method_call_parentheses = false +ij_java_space_before_method_left_brace = true +ij_java_space_before_method_parentheses = false +ij_java_space_before_opening_angle_bracket_in_type_parameter = false +ij_java_space_before_quest = true +ij_java_space_before_switch_left_brace = true +ij_java_space_before_switch_parentheses = true +ij_java_space_before_synchronized_left_brace = true +ij_java_space_before_synchronized_parentheses = true +ij_java_space_before_try_left_brace = true +ij_java_space_before_try_parentheses = true +ij_java_space_before_type_parameter_list = false +ij_java_space_before_while_keyword = true +ij_java_space_before_while_left_brace = true +ij_java_space_before_while_parentheses = true +ij_java_space_inside_one_line_enum_braces = false +ij_java_space_within_empty_array_initializer_braces = false +ij_java_space_within_empty_method_call_parentheses = false +ij_java_space_within_empty_method_parentheses = false +ij_java_spaces_around_additive_operators = true +ij_java_spaces_around_annotation_eq = true +ij_java_spaces_around_assignment_operators = true +ij_java_spaces_around_bitwise_operators = true +ij_java_spaces_around_equality_operators = true +ij_java_spaces_around_lambda_arrow = true +ij_java_spaces_around_logical_operators = true +ij_java_spaces_around_method_ref_dbl_colon = false +ij_java_spaces_around_multiplicative_operators = true +ij_java_spaces_around_relational_operators = true +ij_java_spaces_around_shift_operators = true +ij_java_spaces_around_type_bounds_in_type_parameters = true +ij_java_spaces_around_unary_operator = false +ij_java_spaces_within_angle_brackets = false +ij_java_spaces_within_annotation_parentheses = false +ij_java_spaces_within_array_initializer_braces = false +ij_java_spaces_within_braces = false +ij_java_spaces_within_brackets = false +ij_java_spaces_within_cast_parentheses = false +ij_java_spaces_within_catch_parentheses = false +ij_java_spaces_within_deconstruction_list = false +ij_java_spaces_within_for_parentheses = false +ij_java_spaces_within_if_parentheses = false +ij_java_spaces_within_method_call_parentheses = false +ij_java_spaces_within_method_parentheses = false +ij_java_spaces_within_parentheses = false +ij_java_spaces_within_record_header = false +ij_java_spaces_within_switch_parentheses = false +ij_java_spaces_within_synchronized_parentheses = false +ij_java_spaces_within_try_parentheses = false +ij_java_spaces_within_while_parentheses = false +ij_java_special_else_if_treatment = true +ij_java_static_field_name_prefix = +ij_java_static_field_name_suffix = +ij_java_subclass_name_prefix = +ij_java_subclass_name_suffix = Impl +ij_java_ternary_operation_signs_on_next_line = false +ij_java_ternary_operation_wrap = off +ij_java_test_name_prefix = +ij_java_test_name_suffix = Test +ij_java_throws_keyword_wrap = off +ij_java_throws_list_wrap = off +ij_java_use_external_annotations = false +ij_java_use_fq_class_names = false +ij_java_use_relative_indents = false +ij_java_use_single_class_imports = true +ij_java_variable_annotation_wrap = off +ij_java_visibility = public +ij_java_while_brace_force = never +ij_java_while_on_new_line = false +ij_java_wrap_comments = false +ij_java_wrap_first_method_in_call_chain = false +ij_java_wrap_long_lines = false + +[{*.jsf,*.jsp,*.jspf,*.tag,*.tagf,*.xjsp}] +ij_jsp_jsp_prefer_comma_separated_import_list = false +ij_jsp_keep_indents_on_empty_lines = false + +[{*.jspx,*.tagx}] +ij_jspx_keep_indents_on_empty_lines = false + +[{*.markdown,*.md,*.mdtmp,*.rmt}] +ij_markdown_force_one_space_after_blockquote_symbol = true +ij_markdown_force_one_space_after_header_symbol = true +ij_markdown_force_one_space_after_list_bullet = true +ij_markdown_force_one_space_between_words = true +ij_markdown_format_tables = true +ij_markdown_insert_quote_arrows_on_wrap = true +ij_markdown_keep_indents_on_empty_lines = false +ij_markdown_keep_line_breaks_inside_text_blocks = true +ij_markdown_max_lines_around_block_elements = 1 +ij_markdown_max_lines_around_header = 1 +ij_markdown_max_lines_between_paragraphs = 1 +ij_markdown_min_lines_around_block_elements = 1 +ij_markdown_min_lines_around_header = 1 +ij_markdown_min_lines_between_paragraphs = 1 +ij_markdown_wrap_text_if_long = true +ij_markdown_wrap_text_inside_blockquotes = true + +[{*.pb,*.textproto}] +indent_size = 2 +tab_width = 2 +ij_continuation_indent_size = 4 +ij_prototext_keep_blank_lines_in_code = 2 +ij_prototext_keep_indents_on_empty_lines = false +ij_prototext_keep_line_breaks = true +ij_prototext_space_after_colon = true +ij_prototext_space_after_comma = true +ij_prototext_space_before_colon = false +ij_prototext_space_before_comma = false +ij_prototext_spaces_within_braces = true +ij_prototext_spaces_within_brackets = false + +[{*.qute.htm,*.qute.html,*.qute.json,*.qute.txt,*.qute.yaml,*.qute.yml}] +ij_qute_keep_indents_on_empty_lines = false + +[{*.toml,Cargo.lock,Cargo.toml.orig,Gopkg.lock,Pipfile,poetry.lock}] +ij_toml_keep_indents_on_empty_lines = false + +[{*.yaml,*.yml}] +indent_size = 2 +ij_yaml_align_values_properties = do_not_align +ij_yaml_autoinsert_sequence_marker = true +ij_yaml_block_mapping_on_new_line = false +ij_yaml_indent_sequence_value = true +ij_yaml_keep_indents_on_empty_lines = false +ij_yaml_keep_line_breaks = true +ij_yaml_sequence_on_new_line = false +ij_yaml_space_before_colon = false +ij_yaml_spaces_within_braces = true +ij_yaml_spaces_within_brackets = true diff --git a/build.gradle.kts b/build.gradle.kts index 4524485..f66e20e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -125,6 +125,9 @@ apiValidation { // 实验性和内部API可能无法保证二进制兼容 nonPublicMarkers.addAll( listOf( + "love.forte.simbot.component.onebot.common.annotations.InternalOneBotAPI", + "love.forte.simbot.component.onebot.common.annotations.ExperimentalOneBotAPI", + "love.forte.simbot.annotations.ExperimentalSimbotAPI", "love.forte.simbot.annotations.InternalSimbotAPI", "love.forte.simbot.component.onebot.common.annotations.ApiResultConstructor", diff --git a/internal-processors/event-type-resolver-processor/src/main/kotlin/onebot11/internal/processors/eventtyperesolver/EventTypeResolverProcessor.kt b/internal-processors/event-type-resolver-processor/src/main/kotlin/onebot11/internal/processors/eventtyperesolver/EventTypeResolverProcessor.kt index c40bfdb..6227aea 100644 --- a/internal-processors/event-type-resolver-processor/src/main/kotlin/onebot11/internal/processors/eventtyperesolver/EventTypeResolverProcessor.kt +++ b/internal-processors/event-type-resolver-processor/src/main/kotlin/onebot11/internal/processors/eventtyperesolver/EventTypeResolverProcessor.kt @@ -27,8 +27,16 @@ import com.google.devtools.ksp.processing.SymbolProcessorProvider import com.google.devtools.ksp.symbol.KSAnnotated import com.google.devtools.ksp.symbol.KSClassDeclaration import com.google.devtools.ksp.symbol.KSType -import com.squareup.kotlinpoet.* +import com.squareup.kotlinpoet.AnnotationSpec +import com.squareup.kotlinpoet.ClassName +import com.squareup.kotlinpoet.CodeBlock +import com.squareup.kotlinpoet.FileSpec +import com.squareup.kotlinpoet.FunSpec import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy +import com.squareup.kotlinpoet.STRING +import com.squareup.kotlinpoet.WildcardTypeName +import com.squareup.kotlinpoet.asTypeName +import com.squareup.kotlinpoet.buildCodeBlock import com.squareup.kotlinpoet.jvm.jvmMultifileClass import com.squareup.kotlinpoet.jvm.jvmName import com.squareup.kotlinpoet.ksp.toClassName @@ -80,7 +88,10 @@ private const val FUNCTION_RESOLVER_SUB_TYPE_NAME = "resolveEventSubTypeFieldNam private const val FILE_NAME = "EventResolver.generated" private const val FILE_JVM_NAME = "EventResolvers" -private val InternalSimbotAPIClassName = ClassName("love.forte.simbot.annotations", "InternalSimbotAPI") +private val InternalAPIClassName = ClassName( + "love.forte.simbot.component.onebot.common.annotations", + "InternalOneBotAPI" +) private class EventTypeResolverProcessor(val environment: SymbolProcessorEnvironment) : SymbolProcessor { private val generated = AtomicBoolean(false) @@ -201,7 +212,7 @@ private class EventTypeResolverProcessor(val environment: SymbolProcessorEnviron rootSubEventTypes: List ): FunSpec { return FunSpec.builder(FUNCTION_RESOLVER_SERIALIZER_NAME).apply { - addAnnotation(InternalSimbotAPIClassName) + addAnnotation(InternalAPIClassName) addParameter(FUNCTION_EVENT_PARAM_NAME, EventClassName) returns( KSerializerClassName.parameterizedBy( @@ -365,7 +376,7 @@ private class EventTypeResolverProcessor(val environment: SymbolProcessorEnviron values: Map> ): FunSpec { return FunSpec.builder(FUNCTION_RESOLVER_SERIALIZER_NAME).apply { - addAnnotation(InternalSimbotAPIClassName) + addAnnotation(InternalAPIClassName) addParameter(FUNCTION_POST_TYPE_PARAM_NAME, STRING) addParameter(FUNCTION_SUB_TYPE_PARAM_NAME, STRING) returns( @@ -399,7 +410,7 @@ private class EventTypeResolverProcessor(val environment: SymbolProcessorEnviron values: Map> ): FunSpec { return FunSpec.builder(FUNCTION_RESOLVER_TYPE_NAME).apply { - addAnnotation(InternalSimbotAPIClassName) + addAnnotation(InternalAPIClassName) addParameter(FUNCTION_POST_TYPE_PARAM_NAME, STRING) addParameter(FUNCTION_SUB_TYPE_PARAM_NAME, STRING) returns( @@ -434,7 +445,7 @@ private class EventTypeResolverProcessor(val environment: SymbolProcessorEnviron rootSubEventTypes: List ): FunSpec { return FunSpec.builder(FUNCTION_RESOLVER_SUB_TYPE_NAME).apply { - addAnnotation(InternalSimbotAPIClassName) + addAnnotation(InternalAPIClassName) addParameter(FUNCTION_POST_TYPE_PARAM_NAME, STRING) returns(STRING.copy(nullable = true)) diff --git a/internal-processors/include-component-message-elements-processor/src/main/kotlin/onebot11/internal/processors/includemessageelements/IncludeMessageElementsProcessor.kt b/internal-processors/include-component-message-elements-processor/src/main/kotlin/onebot11/internal/processors/includemessageelements/IncludeMessageElementsProcessor.kt index dbad714..fa5781d 100644 --- a/internal-processors/include-component-message-elements-processor/src/main/kotlin/onebot11/internal/processors/includemessageelements/IncludeMessageElementsProcessor.kt +++ b/internal-processors/include-component-message-elements-processor/src/main/kotlin/onebot11/internal/processors/includemessageelements/IncludeMessageElementsProcessor.kt @@ -72,7 +72,10 @@ private const val SEGMENT_FUNCTION_NAME = "includeAllOneBotSegmentImpls" private const val FILE_NAME = "OneBotMessageElements.generated" -private val InternalSimbotAPIClassName = ClassName("love.forte.simbot.annotations", "InternalSimbotAPI") +private val InternalAPIClassName = ClassName( + "love.forte.simbot.component.onebot.common.annotations", + "InternalOneBotAPI" +) private class IncludeMessageElementsProcessor(val environment: SymbolProcessorEnvironment) : SymbolProcessor { private val generated = AtomicBoolean(false) @@ -183,7 +186,7 @@ private class IncludeMessageElementsProcessor(val environment: SymbolProcessorEn return FunSpec.builder(functionName).apply { addModifiers(KModifier.PUBLIC) - addAnnotation(InternalSimbotAPIClassName) + addAnnotation(InternalAPIClassName) receiver(PolymorphicModuleBuilderClassName.parameterizedBy(baseType)) for (impl in impls) { addCode("%M(%T.serializer())\n", memberName, impl.toClassName()) diff --git a/simbot-component-onebot-common/build.gradle.kts b/simbot-component-onebot-common/build.gradle.kts index 8f59a0c..7da0863 100644 --- a/simbot-component-onebot-common/build.gradle.kts +++ b/simbot-component-onebot-common/build.gradle.kts @@ -37,7 +37,8 @@ kotlin { @OptIn(ExperimentalKotlinGradlePluginApi::class) compilerOptions { optIn.addAll( - "love.forte.simbot.annotations.InternalSimbotAPI" + "love.forte.simbot.annotations.InternalSimbotAPI", + "love.forte.simbot.component.onebot.common.annotations.InternalOneBotAPI" ) } diff --git a/simbot-component-onebot-common/src/commonMain/kotlin/love/forte/simbot/component/onebot/common/OneBot.kt b/simbot-component-onebot-common/src/commonMain/kotlin/love/forte/simbot/component/onebot/common/OneBot.kt index 3f68bc8..fac2f7c 100644 --- a/simbot-component-onebot-common/src/commonMain/kotlin/love/forte/simbot/component/onebot/common/OneBot.kt +++ b/simbot-component-onebot-common/src/commonMain/kotlin/love/forte/simbot/component/onebot/common/OneBot.kt @@ -17,12 +17,12 @@ package love.forte.simbot.component.onebot.common -import love.forte.simbot.annotations.InternalSimbotAPI +import love.forte.simbot.component.onebot.common.annotations.InternalOneBotAPI /** * An OneBot object. */ -@InternalSimbotAPI +@InternalOneBotAPI public object OneBot // TODO 一些Opt注解放在这个模块? diff --git a/simbot-component-onebot-common/src/commonMain/kotlin/love/forte/simbot/component/onebot/common/annotations/ComponentOpts.kt b/simbot-component-onebot-common/src/commonMain/kotlin/love/forte/simbot/component/onebot/common/annotations/ComponentOpts.kt new file mode 100644 index 0000000..55b4c9d --- /dev/null +++ b/simbot-component-onebot-common/src/commonMain/kotlin/love/forte/simbot/component/onebot/common/annotations/ComponentOpts.kt @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot is free software: you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + * + * simbot-component-onebot 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with simbot-component-onebot. + * If not, see . + */ + +package love.forte.simbot.component.onebot.common.annotations + +/** + * 标记为仅用于OneBot组件内部使用的API,可能会随时变更、删除 + */ +@Retention(AnnotationRetention.BINARY) +@RequiresOptIn( + message = "仅用于OneBot组件内部使用的API,可能会随时变更、删除", + level = RequiresOptIn.Level.ERROR +) +@MustBeDocumented +public annotation class InternalOneBotAPI + +/** + * 标记为OneBot组件中仍处于实验阶段的API,可能会随时变更、删除 + */ +@Retention(AnnotationRetention.BINARY) +@RequiresOptIn( + message = "OneBot组件中仍处于实验阶段的API,可能会随时变更、删除", + level = RequiresOptIn.Level.ERROR +) +@MustBeDocumented +public annotation class ExperimentalOneBotAPI diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-common/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/common/utils/AvatarUtil.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-common/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/common/utils/AvatarUtil.kt index 9deb65c..1132b31 100644 --- a/simbot-component-onebot-v11/simbot-component-onebot-v11-common/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/common/utils/AvatarUtil.kt +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-common/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/common/utils/AvatarUtil.kt @@ -19,7 +19,7 @@ package love.forte.simbot.component.onebot.v11.common.utils -import love.forte.simbot.annotations.InternalSimbotAPI +import love.forte.simbot.component.onebot.common.annotations.InternalOneBotAPI import kotlin.jvm.JvmName /** @@ -27,7 +27,7 @@ import kotlin.jvm.JvmName * * @param id QQ号 */ -@InternalSimbotAPI +@InternalOneBotAPI public fun qqAvatar640(id: String): String = "https://q1.qlogo.cn/g?b=qq&nk=$id&s=640" @@ -36,6 +36,6 @@ public fun qqAvatar640(id: String): String = * * @param id QQ号 */ -@InternalSimbotAPI +@InternalOneBotAPI public fun qqAvatar100(id: String): String = "https://q1.qlogo.cn/g?b=qq&nk=$id&s=100" diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/build.gradle.kts b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/build.gradle.kts index d1f9edf..4165b43 100644 --- a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/build.gradle.kts +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/build.gradle.kts @@ -42,7 +42,8 @@ kotlin { @OptIn(ExperimentalKotlinGradlePluginApi::class) compilerOptions { optIn.addAll( - "love.forte.simbot.annotations.InternalSimbotAPI" + "love.forte.simbot.annotations.InternalSimbotAPI", + "love.forte.simbot.component.onebot.common.annotations.InternalOneBotAPI" ) } diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/api/OneBotApiRequests.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/api/OneBotApiRequests.kt index 8c931f8..015eb75 100644 --- a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/api/OneBotApiRequests.kt +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/api/OneBotApiRequests.kt @@ -28,8 +28,8 @@ import io.ktor.client.statement.* import io.ktor.http.* import io.ktor.http.content.* import io.ktor.utils.io.charsets.* -import love.forte.simbot.annotations.InternalSimbotAPI import love.forte.simbot.common.serialization.guessSerializer +import love.forte.simbot.component.onebot.common.annotations.InternalOneBotAPI import love.forte.simbot.component.onebot.v11.core.OneBot11 import love.forte.simbot.logger.Logger import love.forte.simbot.logger.LoggerFactory @@ -41,7 +41,7 @@ import kotlin.jvm.JvmSynthetic /** * 用于在对 [OneBotApi] 发起请求时或得到想用后输出相关日志日志收集器。 */ -@InternalSimbotAPI +@InternalOneBotAPI public val ApiLogger: Logger = LoggerFactory.getLogger("love.forte.simbot.component.onebot.v11.core.api.API") /** diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/bot/OneBotBot.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/bot/OneBotBot.kt index d8f8c98..6393aa1 100644 --- a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/bot/OneBotBot.kt +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/bot/OneBotBot.kt @@ -27,6 +27,7 @@ import love.forte.simbot.bot.GroupRelation import love.forte.simbot.bot.GuildRelation import love.forte.simbot.common.collectable.Collectable import love.forte.simbot.common.id.ID +import love.forte.simbot.component.onebot.common.annotations.InternalOneBotAPI import love.forte.simbot.component.onebot.v11.core.actor.OneBotFriend import love.forte.simbot.component.onebot.v11.core.actor.OneBotGroup import love.forte.simbot.component.onebot.v11.core.api.GetLoginInfoApi @@ -58,6 +59,13 @@ public interface OneBotBot : Bot { */ public val configuration: OneBotBotConfiguration + /** + * 由 [OneBotBot] 衍生出的 actor 使用的 [CoroutineContext]。 + * 源自 [coroutineContext], 但是不包含 [Job][kotlinx.coroutines.Job]。 + */ + @InternalOneBotAPI + public val subContext: CoroutineContext + /** * [OneBotBot] 用于请求API的 [HttpClient]。 */ diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/bot/OneBotBotSerializableConfiguration.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/bot/OneBotBotSerializableConfiguration.kt index 0dc74be..646699a 100644 --- a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/bot/OneBotBotSerializableConfiguration.kt +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/bot/OneBotBotSerializableConfiguration.kt @@ -17,11 +17,11 @@ package love.forte.simbot.component.onebot.v11.core.bot -import io.ktor.http.Url +import io.ktor.http.* import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import love.forte.simbot.annotations.InternalSimbotAPI import love.forte.simbot.bot.SerializableBotConfiguration +import love.forte.simbot.component.onebot.common.annotations.InternalOneBotAPI import love.forte.simbot.component.onebot.v11.core.component.OneBot11Component @@ -33,7 +33,7 @@ import love.forte.simbot.component.onebot.v11.core.component.OneBot11Component * * @author ForteScarlet */ -@InternalSimbotAPI +@InternalOneBotAPI @Serializable @SerialName(OneBot11Component.ID_VALUE) public data class OneBotBotSerializableConfiguration( diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/bot/internal/OneBotBotImpl.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/bot/internal/OneBotBotImpl.kt index 37f3180..e2568b1 100644 --- a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/bot/internal/OneBotBotImpl.kt +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/bot/internal/OneBotBotImpl.kt @@ -84,9 +84,20 @@ import love.forte.simbot.component.onebot.v11.core.event.internal.message.OneBot import love.forte.simbot.component.onebot.v11.core.event.internal.message.OneBotGroupPrivateMessageEventImpl import love.forte.simbot.component.onebot.v11.core.event.internal.message.OneBotNormalGroupMessageEventImpl import love.forte.simbot.component.onebot.v11.core.event.internal.message.OneBotNoticeGroupMessageEventImpl -import love.forte.simbot.component.onebot.v11.core.event.internal.meta.OneBotDefaultMetaEventImpl import love.forte.simbot.component.onebot.v11.core.event.internal.meta.OneBotHeartbeatEventImpl import love.forte.simbot.component.onebot.v11.core.event.internal.meta.OneBotLifecycleEventImpl +import love.forte.simbot.component.onebot.v11.core.event.internal.notice.OneBotBotSelfPokeEventImpl +import love.forte.simbot.component.onebot.v11.core.event.internal.notice.OneBotFriendAddEventImpl +import love.forte.simbot.component.onebot.v11.core.event.internal.notice.OneBotFriendRecallEventImpl +import love.forte.simbot.component.onebot.v11.core.event.internal.notice.OneBotGroupAdminEventImpl +import love.forte.simbot.component.onebot.v11.core.event.internal.notice.OneBotGroupBanEventImpl +import love.forte.simbot.component.onebot.v11.core.event.internal.notice.OneBotGroupMemberDecreaseEventImpl +import love.forte.simbot.component.onebot.v11.core.event.internal.notice.OneBotGroupMemberIncreaseEventImpl +import love.forte.simbot.component.onebot.v11.core.event.internal.notice.OneBotGroupRecallEventImpl +import love.forte.simbot.component.onebot.v11.core.event.internal.notice.OneBotGroupUploadEventImpl +import love.forte.simbot.component.onebot.v11.core.event.internal.notice.OneBotHonorEventImpl +import love.forte.simbot.component.onebot.v11.core.event.internal.notice.OneBotLuckyKingEventImpl +import love.forte.simbot.component.onebot.v11.core.event.internal.notice.OneBotMemberPokeEventImpl import love.forte.simbot.component.onebot.v11.core.event.internal.request.OneBotFriendRequestEventImpl import love.forte.simbot.component.onebot.v11.core.event.internal.request.OneBotGroupRequestEventImpl import love.forte.simbot.component.onebot.v11.core.event.internal.stage.OneBotBotStartedEventImpl @@ -96,7 +107,15 @@ import love.forte.simbot.component.onebot.v11.event.message.GroupMessageEvent import love.forte.simbot.component.onebot.v11.event.message.PrivateMessageEvent import love.forte.simbot.component.onebot.v11.event.meta.HeartbeatEvent import love.forte.simbot.component.onebot.v11.event.meta.LifecycleEvent -import love.forte.simbot.component.onebot.v11.event.meta.MetaEvent +import love.forte.simbot.component.onebot.v11.event.notice.FriendAddEvent +import love.forte.simbot.component.onebot.v11.event.notice.FriendRecallEvent +import love.forte.simbot.component.onebot.v11.event.notice.GroupAdminEvent +import love.forte.simbot.component.onebot.v11.event.notice.GroupBanEvent +import love.forte.simbot.component.onebot.v11.event.notice.GroupDecreaseEvent +import love.forte.simbot.component.onebot.v11.event.notice.GroupIncreaseEvent +import love.forte.simbot.component.onebot.v11.event.notice.GroupRecallEvent +import love.forte.simbot.component.onebot.v11.event.notice.GroupUploadEvent +import love.forte.simbot.component.onebot.v11.event.notice.NotifyEvent import love.forte.simbot.component.onebot.v11.event.request.FriendRequestEvent import love.forte.simbot.component.onebot.v11.event.request.GroupRequestEvent import love.forte.simbot.component.onebot.v11.event.resolveEventSerializer @@ -133,7 +152,7 @@ internal class OneBotBotImpl( job.invokeOnCompletion { apiClient.close() } } - internal val subContext = coroutineContext.minusKey(Job) + override val subContext = coroutineContext.minusKey(Job) private val logger = LoggerFactory .getLogger( @@ -499,104 +518,6 @@ internal class OneBotBotImpl( } } - @OptIn(FragileSimbotAPI::class) - private fun resolveRawEventToEvent(raw: String, event: OBRawEvent): Event { - val bot = this@OneBotBotImpl - - return when (event) { - // 群消息、匿名消息、系统消息 - is GroupMessageEvent -> when (event.subType) { - GroupMessageEvent.SUB_TYPE_NORMAL -> - OneBotNormalGroupMessageEventImpl( - raw, - event, - bot - ) - - GroupMessageEvent.SUB_TYPE_ANONYMOUS -> - OneBotAnonymousGroupMessageEventImpl( - raw, - event, - bot - ) - - GroupMessageEvent.SUB_TYPE_NOTICE -> - OneBotNoticeGroupMessageEventImpl( - raw, - event, - bot - ) - - else -> OneBotDefaultGroupMessageEventImpl( - raw, - event, - bot - ) - } - - // 好友私聊消息、成员临时会话 - is PrivateMessageEvent -> when (event.subType) { - PrivateMessageEvent.SUB_TYPE_FRIEND -> OneBotFriendMessageEventImpl( - raw, - event, - bot - ) - - PrivateMessageEvent.SUB_TYPE_GROUP -> OneBotGroupPrivateMessageEventImpl( - raw, - event, - bot - ) - - else -> OneBotDefaultPrivateMessageEventImpl( - raw, - event, - bot - ) - } - - //region Meta events - is MetaEvent -> when (event) { - is LifecycleEvent -> OneBotLifecycleEventImpl( - raw, - event, - bot, - ) - - is HeartbeatEvent -> OneBotHeartbeatEventImpl( - raw, - event, - bot, - ) - - else -> OneBotDefaultMetaEventImpl( - raw, - event, - bot - ) - } - //endregion - - //region 申请事件 - is FriendRequestEvent -> OneBotFriendRequestEventImpl( - raw, - event, - bot - ) - is GroupRequestEvent -> OneBotGroupRequestEventImpl( - raw, - event, - bot - ) - // 其余未知的申请事件扔到 unsupported - //endregion - - // TODO notice events - - is UnknownEvent -> OneBotUnknownEvent(raw, event) - else -> OneBotUnsupportedEvent(raw, event) - } - } private fun pushEvent(event: Event): Job { return eventProcessor @@ -662,3 +583,76 @@ internal class OneBotBotImpl( } +@OptIn(FragileSimbotAPI::class) +internal fun OneBotBotImpl.resolveRawEventToEvent(raw: String, event: OBRawEvent): Event { + val bot = this + + fun unsupported(): OneBotUnsupportedEvent = + OneBotUnsupportedEvent(raw, event) + + return when (event) { + //region 消息事件 + // 群消息、匿名消息、系统消息 + is GroupMessageEvent -> when (event.subType) { + GroupMessageEvent.SUB_TYPE_NORMAL -> + OneBotNormalGroupMessageEventImpl(raw, event, bot) + + GroupMessageEvent.SUB_TYPE_ANONYMOUS -> + OneBotAnonymousGroupMessageEventImpl(raw, event, bot) + + GroupMessageEvent.SUB_TYPE_NOTICE -> + OneBotNoticeGroupMessageEventImpl(raw, event, bot) + + else -> OneBotDefaultGroupMessageEventImpl(raw, event, bot) + } + + // 好友私聊消息、成员临时会话 + is PrivateMessageEvent -> when (event.subType) { + PrivateMessageEvent.SUB_TYPE_FRIEND -> + OneBotFriendMessageEventImpl(raw, event, bot) + + PrivateMessageEvent.SUB_TYPE_GROUP -> + OneBotGroupPrivateMessageEventImpl(raw, event, bot) + + else -> OneBotDefaultPrivateMessageEventImpl(raw, event, bot) + } + //endregion + + //region 元事件 + is LifecycleEvent -> OneBotLifecycleEventImpl(raw, event, bot,) + is HeartbeatEvent -> OneBotHeartbeatEventImpl(raw, event, bot,) + //endregion + + //region 申请事件 + is FriendRequestEvent -> OneBotFriendRequestEventImpl(raw, event, bot) + is GroupRequestEvent -> OneBotGroupRequestEventImpl(raw, event, bot) + //endregion + + //region notice events + is FriendAddEvent -> OneBotFriendAddEventImpl(raw, event, bot) + is FriendRecallEvent -> OneBotFriendRecallEventImpl(raw, event, bot) + is GroupAdminEvent -> OneBotGroupAdminEventImpl(raw, event, bot) + is GroupBanEvent -> OneBotGroupBanEventImpl(raw, event, bot) + is GroupIncreaseEvent -> OneBotGroupMemberIncreaseEventImpl(raw, event, bot) + is GroupDecreaseEvent -> OneBotGroupMemberDecreaseEventImpl(raw, event, bot) + is GroupRecallEvent -> OneBotGroupRecallEventImpl(raw, event, bot) + is GroupUploadEvent -> OneBotGroupUploadEventImpl(raw, event, bot) + is NotifyEvent -> when (event.subType) { + NotifyEvent.SUB_TYPE_HONOR -> OneBotHonorEventImpl(raw, event, bot) + NotifyEvent.SUB_TYPE_LUCKY_KING -> OneBotLuckyKingEventImpl(raw, event, bot) + NotifyEvent.SUB_TYPE_POKE -> when { + event.selfId.value == event.targetId?.value -> + OneBotBotSelfPokeEventImpl(raw, event, bot) + + else -> OneBotMemberPokeEventImpl(raw, event, bot) + } + + // Unsupported + else -> unsupported() + } + + //endregion + is UnknownEvent -> OneBotUnknownEvent(raw, event) + else -> unsupported() + } +} diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/OneBotEvent.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/OneBotEvent.kt index 2925bb5..9cf5524 100644 --- a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/OneBotEvent.kt +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/OneBotEvent.kt @@ -59,7 +59,7 @@ public interface OneBotEvent : OneBotCommonEvent { /** * 事件发生的时间戳 */ - public val timestamp: Timestamp + override val time: Timestamp get() = sourceEvent.timestamp() /** diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/OneBotUnknownEvent.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/OneBotUnknownEvent.kt index ca0b93d..eaf19b9 100644 --- a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/OneBotUnknownEvent.kt +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/OneBotUnknownEvent.kt @@ -20,8 +20,6 @@ package love.forte.simbot.component.onebot.v11.core.event import love.forte.simbot.annotations.FragileSimbotAPI import love.forte.simbot.common.id.ID import love.forte.simbot.common.id.UUID -import love.forte.simbot.common.time.Timestamp -import love.forte.simbot.component.onebot.v11.core.utils.timestamp import love.forte.simbot.component.onebot.v11.event.UnknownEvent @@ -43,10 +41,4 @@ public data class OneBotUnknownEvent( * 一个无意义的随机ID。 */ override val id: ID = UUID.random() - - /** - * 事件时间。 - */ - override val time: Timestamp - get() = sourceEvent.timestamp() } diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/OneBotUnsupportedEvent.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/OneBotUnsupportedEvent.kt index 460067b..87069e5 100644 --- a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/OneBotUnsupportedEvent.kt +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/OneBotUnsupportedEvent.kt @@ -20,8 +20,6 @@ package love.forte.simbot.component.onebot.v11.core.event import love.forte.simbot.annotations.FragileSimbotAPI import love.forte.simbot.common.id.ID import love.forte.simbot.common.id.UUID -import love.forte.simbot.common.time.Timestamp -import love.forte.simbot.component.onebot.v11.core.utils.timestamp import love.forte.simbot.component.onebot.v11.event.UnknownEvent /** @@ -72,10 +70,4 @@ public data class OneBotUnsupportedEvent( * 一个无意义的随机ID。 */ override val id: ID = UUID.random() - - /** - * 事件时间。 - */ - override val time: Timestamp - get() = sourceEvent.timestamp() } diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/internal/meta/OneBotMetaEventImpl.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/internal/meta/OneBotMetaEventImpl.kt index c64cb9c..38900d1 100644 --- a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/internal/meta/OneBotMetaEventImpl.kt +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/internal/meta/OneBotMetaEventImpl.kt @@ -19,16 +19,13 @@ package love.forte.simbot.component.onebot.v11.core.event.internal.meta import love.forte.simbot.common.id.ID import love.forte.simbot.common.id.UUID -import love.forte.simbot.common.time.Timestamp import love.forte.simbot.component.onebot.v11.core.bot.OneBotBot import love.forte.simbot.component.onebot.v11.core.event.internal.eventToString import love.forte.simbot.component.onebot.v11.core.event.meta.OneBotHeartbeatEvent import love.forte.simbot.component.onebot.v11.core.event.meta.OneBotLifecycleEvent import love.forte.simbot.component.onebot.v11.core.event.meta.OneBotMetaEvent -import love.forte.simbot.component.onebot.v11.core.utils.timestamp import love.forte.simbot.component.onebot.v11.event.meta.HeartbeatEvent import love.forte.simbot.component.onebot.v11.event.meta.LifecycleEvent -import love.forte.simbot.component.onebot.v11.event.meta.MetaEvent /** * OneBot中的元事件类型。 @@ -36,9 +33,6 @@ import love.forte.simbot.component.onebot.v11.event.meta.MetaEvent */ internal abstract class OneBotMetaEventImpl : OneBotMetaEvent { override val id: ID = UUID.random() - - override val time: Timestamp - get() = sourceEvent.timestamp() } internal class OneBotHeartbeatEventImpl( @@ -59,11 +53,3 @@ internal class OneBotLifecycleEventImpl( eventToString("OneBotLifecycleEvent") } -internal class OneBotDefaultMetaEventImpl( - override val sourceEventRaw: String?, - override val sourceEvent: MetaEvent, - override val bot: OneBotBot, -) : OneBotMetaEventImpl() { - override fun toString(): String = - eventToString("OneBotDefaultMetaEvent") -} diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/internal/notice/OneBotFriendAddEventImpl.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/internal/notice/OneBotFriendAddEventImpl.kt new file mode 100644 index 0000000..798f9d6 --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/internal/notice/OneBotFriendAddEventImpl.kt @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot is free software: you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + * + * simbot-component-onebot 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with simbot-component-onebot. + * If not, see . + */ + +package love.forte.simbot.component.onebot.v11.core.event.internal.notice + +import love.forte.simbot.common.id.ID +import love.forte.simbot.common.id.StringID.Companion.ID +import love.forte.simbot.component.onebot.v11.core.bot.OneBotBot +import love.forte.simbot.component.onebot.v11.core.event.internal.eventToString +import love.forte.simbot.component.onebot.v11.core.event.notice.OneBotFriendAddEvent +import love.forte.simbot.component.onebot.v11.event.notice.FriendAddEvent + + +/** + * + * @author ForteScarlet + */ +internal class OneBotFriendAddEventImpl( + override val sourceEventRaw: String?, + override val sourceEvent: FriendAddEvent, + override val bot: OneBotBot +) : OneBotFriendAddEvent { + override val id: ID + get() = with(sourceEvent) { + "$postType-$noticeType-$userId-$time" + }.ID + + override fun toString(): String = + eventToString("OneBotFriendAddEvent") +} diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/internal/notice/OneBotFriendRecallEventImpl.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/internal/notice/OneBotFriendRecallEventImpl.kt new file mode 100644 index 0000000..7eda0e3 --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/internal/notice/OneBotFriendRecallEventImpl.kt @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot is free software: you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + * + * simbot-component-onebot 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with simbot-component-onebot. + * If not, see . + */ + +package love.forte.simbot.component.onebot.v11.core.event.internal.notice + +import love.forte.simbot.common.id.ID +import love.forte.simbot.common.id.StringID.Companion.ID +import love.forte.simbot.component.onebot.v11.core.actor.OneBotFriend +import love.forte.simbot.component.onebot.v11.core.bot.OneBotBot +import love.forte.simbot.component.onebot.v11.core.event.internal.eventToString +import love.forte.simbot.component.onebot.v11.core.event.notice.OneBotFriendRecallEvent +import love.forte.simbot.component.onebot.v11.event.notice.FriendRecallEvent + + +/** + * + * @author ForteScarlet + */ +internal class OneBotFriendRecallEventImpl( + override val sourceEventRaw: String?, + override val sourceEvent: FriendRecallEvent, + override val bot: OneBotBot +) : OneBotFriendRecallEvent { + override val id: ID + get() = with(sourceEvent) { + "$postType-$noticeType-$userId-$messageId-$time" + }.ID + + override suspend fun content(): OneBotFriend { + return bot.contactRelation.contact(sourceEvent.userId) + ?: error("Friend with id ${sourceEvent.userId} not found") + } + + override fun toString(): String = + eventToString("OneBotFriendRecallEvent") +} diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/internal/notice/OneBotGroupAdminEventImpl.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/internal/notice/OneBotGroupAdminEventImpl.kt new file mode 100644 index 0000000..0a4a889 --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/internal/notice/OneBotGroupAdminEventImpl.kt @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot is free software: you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + * + * simbot-component-onebot 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with simbot-component-onebot. + * If not, see . + */ + +package love.forte.simbot.component.onebot.v11.core.event.internal.notice + +import love.forte.simbot.common.id.ID +import love.forte.simbot.common.id.StringID.Companion.ID +import love.forte.simbot.component.onebot.v11.core.actor.OneBotGroup +import love.forte.simbot.component.onebot.v11.core.actor.OneBotMember +import love.forte.simbot.component.onebot.v11.core.actor.internal.toMember +import love.forte.simbot.component.onebot.v11.core.api.GetGroupMemberInfoApi +import love.forte.simbot.component.onebot.v11.core.bot.internal.OneBotBotImpl +import love.forte.simbot.component.onebot.v11.core.bot.requestDataBy +import love.forte.simbot.component.onebot.v11.core.event.internal.eventToString +import love.forte.simbot.component.onebot.v11.core.event.notice.OneBotGroupAdminEvent +import love.forte.simbot.component.onebot.v11.event.notice.GroupAdminEvent + +internal class OneBotGroupAdminEventImpl( + override val sourceEventRaw: String?, + override val sourceEvent: GroupAdminEvent, + override val bot: OneBotBotImpl +) : OneBotGroupAdminEvent { + override val id: ID + get() = with(sourceEvent) { + "$postType-$noticeType-$subType-$groupId-$userId-$time" + }.ID + + override suspend fun content(): OneBotMember { + // TODO 换成 groupRelation + return GetGroupMemberInfoApi.create( + groupId = sourceEvent.groupId, + userId = sourceEvent.userId + ).requestDataBy(bot).toMember(bot) + } + + override suspend fun source(): OneBotGroup { + return bot.groupRelation.group(sourceEvent.groupId) + ?: error("Group with id ${sourceEvent.groupId} not found") + } + + override fun toString(): String = + eventToString("OneBotGroupAdminEvent") +} diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/internal/notice/OneBotGroupBanEventImpl.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/internal/notice/OneBotGroupBanEventImpl.kt new file mode 100644 index 0000000..cd2ec5e --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/internal/notice/OneBotGroupBanEventImpl.kt @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot is free software: you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + * + * simbot-component-onebot 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with simbot-component-onebot. + * If not, see . + */ + +package love.forte.simbot.component.onebot.v11.core.event.internal.notice + +import love.forte.simbot.common.id.ID +import love.forte.simbot.common.id.StringID.Companion.ID +import love.forte.simbot.component.onebot.v11.core.actor.OneBotGroup +import love.forte.simbot.component.onebot.v11.core.actor.OneBotMember +import love.forte.simbot.component.onebot.v11.core.actor.internal.toMember +import love.forte.simbot.component.onebot.v11.core.api.GetGroupMemberInfoApi +import love.forte.simbot.component.onebot.v11.core.bot.internal.OneBotBotImpl +import love.forte.simbot.component.onebot.v11.core.bot.requestDataBy +import love.forte.simbot.component.onebot.v11.core.event.internal.eventToString +import love.forte.simbot.component.onebot.v11.core.event.notice.OneBotGroupBanEvent +import love.forte.simbot.component.onebot.v11.event.notice.GroupBanEvent + + +/** + * + * @author ForteScarlet + */ +internal class OneBotGroupBanEventImpl( + override val sourceEventRaw: String?, + override val sourceEvent: GroupBanEvent, + override val bot: OneBotBotImpl +) : OneBotGroupBanEvent { + override val id: ID + get() = with(sourceEvent) { + "$postType-$noticeType-$subType-$groupId-$userId-$time" + }.ID + + override suspend fun content(): OneBotMember { + // TODO 换成 groupRelation + return GetGroupMemberInfoApi.create( + groupId = sourceEvent.groupId, + userId = sourceEvent.userId + ).requestDataBy(bot).toMember(bot) + } + + override suspend fun source(): OneBotGroup { + return bot.groupRelation.group(sourceEvent.groupId) + ?: error("Group with id ${sourceEvent.groupId} not found") + } + + override fun toString(): String = + eventToString("OneBotGroupBanEvent") +} diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/internal/notice/OneBotGroupChangeEventImpl.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/internal/notice/OneBotGroupChangeEventImpl.kt new file mode 100644 index 0000000..88d7ebd --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/internal/notice/OneBotGroupChangeEventImpl.kt @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot is free software: you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + * + * simbot-component-onebot 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with simbot-component-onebot. + * If not, see . + */ + +package love.forte.simbot.component.onebot.v11.core.event.internal.notice + +import love.forte.simbot.common.id.ID +import love.forte.simbot.common.id.StringID.Companion.ID +import love.forte.simbot.component.onebot.v11.core.actor.OneBotGroup +import love.forte.simbot.component.onebot.v11.core.actor.OneBotMember +import love.forte.simbot.component.onebot.v11.core.actor.internal.toMember +import love.forte.simbot.component.onebot.v11.core.api.GetGroupMemberInfoApi +import love.forte.simbot.component.onebot.v11.core.bot.internal.OneBotBotImpl +import love.forte.simbot.component.onebot.v11.core.bot.requestDataBy +import love.forte.simbot.component.onebot.v11.core.event.internal.eventToString +import love.forte.simbot.component.onebot.v11.core.event.notice.OneBotGroupChangeEvent +import love.forte.simbot.component.onebot.v11.core.event.notice.OneBotGroupMemberDecreaseEvent +import love.forte.simbot.component.onebot.v11.core.event.notice.OneBotGroupMemberIncreaseEvent +import love.forte.simbot.component.onebot.v11.event.notice.GroupDecreaseEvent +import love.forte.simbot.component.onebot.v11.event.notice.GroupIncreaseEvent + + +/** + * + * @author ForteScarlet + */ +internal abstract class OneBotGroupChangeEventImpl : OneBotGroupChangeEvent { + override val id: ID + get() = with(sourceEvent) { + "$postType-$noticeType-$groupId-$userId-$time" + }.ID + + override suspend fun content(): OneBotGroup { + return bot.groupRelation.group(groupId) + ?: error("Group with id $groupId not found") + } +} + +internal class OneBotGroupMemberIncreaseEventImpl( + override val sourceEventRaw: String?, + override val sourceEvent: GroupIncreaseEvent, + override val bot: OneBotBotImpl +) : OneBotGroupChangeEventImpl(), OneBotGroupMemberIncreaseEvent { + override suspend fun member(): OneBotMember { + // TODO 换成 groupRelation + return GetGroupMemberInfoApi.create( + groupId = sourceEvent.groupId, + userId = sourceEvent.userId + ).requestDataBy(bot).toMember(bot) + } + + override fun toString(): String = + eventToString("OneBotGroupMemberIncreaseEvent") +} +internal class OneBotGroupMemberDecreaseEventImpl( + override val sourceEventRaw: String?, + override val sourceEvent: GroupDecreaseEvent, + override val bot: OneBotBotImpl +) : OneBotGroupChangeEventImpl(), OneBotGroupMemberDecreaseEvent { + + override fun toString(): String = + eventToString("OneBotGroupMemberDecreaseEvent") +} diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/internal/notice/OneBotGroupRecallEventImpl.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/internal/notice/OneBotGroupRecallEventImpl.kt new file mode 100644 index 0000000..427ab9f --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/internal/notice/OneBotGroupRecallEventImpl.kt @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot is free software: you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + * + * simbot-component-onebot 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with simbot-component-onebot. + * If not, see . + */ + +package love.forte.simbot.component.onebot.v11.core.event.internal.notice + +import love.forte.simbot.common.id.ID +import love.forte.simbot.common.id.StringID.Companion.ID +import love.forte.simbot.component.onebot.v11.core.actor.OneBotGroup +import love.forte.simbot.component.onebot.v11.core.bot.OneBotBot +import love.forte.simbot.component.onebot.v11.core.event.internal.eventToString +import love.forte.simbot.component.onebot.v11.core.event.notice.OneBotGroupRecallEvent +import love.forte.simbot.component.onebot.v11.event.notice.GroupRecallEvent + + +/** + * + * @author ForteScarlet + */ +internal class OneBotGroupRecallEventImpl( + override val sourceEventRaw: String?, + override val sourceEvent: GroupRecallEvent, + override val bot: OneBotBot +) : OneBotGroupRecallEvent { + override val id: ID + get() = with(sourceEvent) { + "$postType-$noticeType-$groupId-$userId-$messageId-$time" + }.ID + + override suspend fun content(): OneBotGroup { + return bot.groupRelation.group(groupId) + ?: error("Group with id $groupId not found") + } + + override fun toString(): String = + eventToString("OneBotGroupRecallEvent") +} diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/internal/notice/OneBotGroupUploadEventImpl.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/internal/notice/OneBotGroupUploadEventImpl.kt new file mode 100644 index 0000000..905e44c --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/internal/notice/OneBotGroupUploadEventImpl.kt @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot is free software: you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + * + * simbot-component-onebot 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with simbot-component-onebot. + * If not, see . + */ + +package love.forte.simbot.component.onebot.v11.core.event.internal.notice + +import love.forte.simbot.common.id.ID +import love.forte.simbot.common.id.StringID.Companion.ID +import love.forte.simbot.component.onebot.v11.core.actor.OneBotGroup +import love.forte.simbot.component.onebot.v11.core.bot.OneBotBot +import love.forte.simbot.component.onebot.v11.core.event.internal.eventToString +import love.forte.simbot.component.onebot.v11.core.event.notice.OneBotGroupUploadEvent +import love.forte.simbot.component.onebot.v11.event.notice.GroupUploadEvent + + +/** + * + * @author ForteScarlet + */ +internal class OneBotGroupUploadEventImpl( + override val sourceEventRaw: String?, + override val sourceEvent: GroupUploadEvent, + override val bot: OneBotBot +) : OneBotGroupUploadEvent { + override val id: ID + get() = with(sourceEvent) { + "$postType-$noticeType-$groupId-$userId-$time" + }.ID + + override suspend fun content(): OneBotGroup { + return bot.groupRelation.group(groupId) + ?: error("Group with id $groupId not found") + } + + override fun toString(): String = + eventToString("OneBotGroupUploadEvent") +} diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/internal/notice/OneBotNotifyEventImpl.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/internal/notice/OneBotNotifyEventImpl.kt new file mode 100644 index 0000000..34581d2 --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/internal/notice/OneBotNotifyEventImpl.kt @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot is free software: you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + * + * simbot-component-onebot 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with simbot-component-onebot. + * If not, see . + */ + +package love.forte.simbot.component.onebot.v11.core.event.internal.notice + +import love.forte.simbot.common.id.ID +import love.forte.simbot.common.id.StringID.Companion.ID +import love.forte.simbot.component.onebot.v11.core.actor.OneBotGroup +import love.forte.simbot.component.onebot.v11.core.actor.OneBotMember +import love.forte.simbot.component.onebot.v11.core.actor.internal.toMember +import love.forte.simbot.component.onebot.v11.core.api.GetGroupMemberInfoApi +import love.forte.simbot.component.onebot.v11.core.bot.internal.OneBotBotImpl +import love.forte.simbot.component.onebot.v11.core.bot.requestDataBy +import love.forte.simbot.component.onebot.v11.core.event.internal.eventToString +import love.forte.simbot.component.onebot.v11.core.event.notice.OneBotBotSelfPokeEvent +import love.forte.simbot.component.onebot.v11.core.event.notice.OneBotHonorEvent +import love.forte.simbot.component.onebot.v11.core.event.notice.OneBotLuckyKingEvent +import love.forte.simbot.component.onebot.v11.core.event.notice.OneBotMemberPokeEvent +import love.forte.simbot.component.onebot.v11.core.event.notice.OneBotNotifyEvent +import love.forte.simbot.component.onebot.v11.event.notice.NotifyEvent + + +/** + * + * @author ForteScarlet + */ +internal abstract class OneBotNotifyEventImpl( + override val sourceEventRaw: String?, + override val sourceEvent: NotifyEvent, + override val bot: OneBotBotImpl +) : OneBotNotifyEvent { + override val id: ID + get() = with(sourceEvent) { + "$postType-$noticeType-$subType-$groupId-$userId-$time" + }.ID + + override suspend fun source(): OneBotGroup { + return bot.groupRelation.group(groupId) + ?: error("Group with id $groupId not found") + } + + override suspend fun content(): OneBotMember { + // TODO 换成 groupRelation + return GetGroupMemberInfoApi.create( + groupId = sourceEvent.groupId, + userId = sourceEvent.userId + ).requestDataBy(bot).toMember(bot) + } +} + +internal class OneBotHonorEventImpl( + sourceEventRaw: String?, + sourceEvent: NotifyEvent, + bot: OneBotBotImpl +) : OneBotNotifyEventImpl(sourceEventRaw, sourceEvent, bot), + OneBotHonorEvent { + override fun toString(): String = + eventToString("OneBotHonorEvent") +} + +internal class OneBotLuckyKingEventImpl( + sourceEventRaw: String?, + sourceEvent: NotifyEvent, + bot: OneBotBotImpl +) : OneBotNotifyEventImpl(sourceEventRaw, sourceEvent, bot), + OneBotLuckyKingEvent { + override fun toString(): String = + eventToString("OneBotLuckyKingEvent") +} + +internal class OneBotMemberPokeEventImpl( + sourceEventRaw: String?, + sourceEvent: NotifyEvent, + bot: OneBotBotImpl +) : OneBotNotifyEventImpl(sourceEventRaw, sourceEvent, bot), + OneBotMemberPokeEvent { + override fun toString(): String = + eventToString("OneBotMemberPokeEvent") +} + +internal class OneBotBotSelfPokeEventImpl( + sourceEventRaw: String?, + sourceEvent: NotifyEvent, + bot: OneBotBotImpl +) : OneBotNotifyEventImpl(sourceEventRaw, sourceEvent, bot), + OneBotBotSelfPokeEvent { + override fun toString(): String = + eventToString("OneBotBotSelfPokeEvent") +} diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/internal/request/OneBotRequestEventImpl.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/internal/request/OneBotRequestEventImpl.kt index e57fdfd..843f71b 100644 --- a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/internal/request/OneBotRequestEventImpl.kt +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/internal/request/OneBotRequestEventImpl.kt @@ -19,7 +19,6 @@ package love.forte.simbot.component.onebot.v11.core.event.internal.request import love.forte.simbot.common.id.ID import love.forte.simbot.common.id.UUID -import love.forte.simbot.common.time.Timestamp import love.forte.simbot.component.onebot.v11.core.actor.OneBotGroup import love.forte.simbot.component.onebot.v11.core.actor.OneBotStranger import love.forte.simbot.component.onebot.v11.core.actor.internal.toStranger @@ -33,7 +32,6 @@ import love.forte.simbot.component.onebot.v11.core.event.internal.eventToString import love.forte.simbot.component.onebot.v11.core.event.request.OneBotFriendRequestEvent import love.forte.simbot.component.onebot.v11.core.event.request.OneBotGroupRequestEvent import love.forte.simbot.component.onebot.v11.core.event.request.OneBotRequestEvent -import love.forte.simbot.component.onebot.v11.core.utils.timestamp import love.forte.simbot.component.onebot.v11.event.request.FriendRequestEvent import love.forte.simbot.component.onebot.v11.event.request.GroupRequestEvent @@ -41,9 +39,6 @@ import love.forte.simbot.component.onebot.v11.event.request.GroupRequestEvent internal abstract class OneBotRequestEventImpl : OneBotRequestEvent { override val id: ID = UUID.random() - override val time: Timestamp - get() = sourceEvent.timestamp() - override suspend fun accept() { doSetRequest(true) } diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/message/OneBotGroupMessageEvent.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/message/OneBotGroupMessageEvent.kt index 8b177eb..a205b8f 100644 --- a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/message/OneBotGroupMessageEvent.kt +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/message/OneBotGroupMessageEvent.kt @@ -18,6 +18,7 @@ package love.forte.simbot.component.onebot.v11.core.event.message import love.forte.simbot.common.id.ID +import love.forte.simbot.common.id.LongID import love.forte.simbot.component.onebot.v11.core.actor.OneBotGroup import love.forte.simbot.component.onebot.v11.core.actor.OneBotMember import love.forte.simbot.component.onebot.v11.event.message.GroupMessageEvent @@ -58,13 +59,13 @@ public interface OneBotGroupMessageEvent : OneBotMessageEvent, ChatGroupEvent { /** * 群号 */ - public val groupId: ID + public val groupId: LongID get() = sourceEvent.groupId /** * 发送者 QQ 号 */ - public val userId: ID + public val userId: LongID get() = sourceEvent.userId /** diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/message/OneBotMessageEvent.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/message/OneBotMessageEvent.kt index 4d0be93..120d37a 100644 --- a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/message/OneBotMessageEvent.kt +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/message/OneBotMessageEvent.kt @@ -17,10 +17,8 @@ package love.forte.simbot.component.onebot.v11.core.event.message -import love.forte.simbot.common.time.Timestamp import love.forte.simbot.component.onebot.v11.core.bot.OneBotBot import love.forte.simbot.component.onebot.v11.core.event.OneBotBotEvent -import love.forte.simbot.component.onebot.v11.core.utils.timestamp import love.forte.simbot.component.onebot.v11.message.OneBotMessageContent import love.forte.simbot.component.onebot.v11.message.OneBotMessageReceipt import love.forte.simbot.component.onebot.v11.message.segment.OneBotReply @@ -43,9 +41,6 @@ public interface OneBotMessageEvent : OneBotBotEvent, MessageEvent { override val bot: OneBotBot override val sourceEvent: OBSourceMessageEvent - override val time: Timestamp - get() = sourceEvent.timestamp() - /** * 基于本事件回复一条消息 [message]。 * diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/meta/OneBotHeartbeatEvent.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/meta/OneBotHeartbeatEvent.kt index e674b39..c64a289 100644 --- a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/meta/OneBotHeartbeatEvent.kt +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/meta/OneBotHeartbeatEvent.kt @@ -17,11 +17,9 @@ package love.forte.simbot.component.onebot.v11.core.event.meta -import love.forte.simbot.annotations.Api4J import love.forte.simbot.component.onebot.v11.common.api.StatusResult import love.forte.simbot.component.onebot.v11.event.meta.HeartbeatEvent import love.forte.simbot.component.onebot.v11.event.meta.MetaEvent -import kotlin.jvm.JvmSynthetic import kotlin.time.Duration import kotlin.time.Duration.Companion.milliseconds @@ -45,14 +43,14 @@ public interface OneBotHeartbeatEvent : OneBotMetaEvent { /** * 到下次心跳的间隔,单位毫秒 */ - @Api4J - public val intervalValue: Long + public val intervalMilliseconds: Long get() = sourceEvent.interval - - /** - * 到下次心跳的间隔 - */ - @get:JvmSynthetic - public val interval: Duration - get() = sourceEvent.interval.milliseconds } + +/** + * 到下次心跳的间隔 + * + * @see OneBotHeartbeatEvent.intervalMilliseconds + */ +public inline val OneBotHeartbeatEvent.interval: Duration + get() = intervalMilliseconds.milliseconds diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/notice/OneBotFriendAddEvent.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/notice/OneBotFriendAddEvent.kt new file mode 100644 index 0000000..fdad848 --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/notice/OneBotFriendAddEvent.kt @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot is free software: you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + * + * simbot-component-onebot 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with simbot-component-onebot. + * If not, see . + */ + +package love.forte.simbot.component.onebot.v11.core.event.notice + +import love.forte.simbot.common.id.LongID +import love.forte.simbot.component.onebot.v11.event.notice.FriendAddEvent + + +/** + * 好友新增事件。 + * + * @see FriendAddEvent + */ +public interface OneBotFriendAddEvent : OneBotNoticeEvent { + override val sourceEvent: FriendAddEvent + + /** + * 此好友的ID + */ + public val userId: LongID + get() = sourceEvent.userId + + // friend? or content()? +} diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/notice/OneBotFriendRecallEvent.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/notice/OneBotFriendRecallEvent.kt new file mode 100644 index 0000000..5a86ebd --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/notice/OneBotFriendRecallEvent.kt @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot is free software: you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + * + * simbot-component-onebot 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with simbot-component-onebot. + * If not, see . + */ + +package love.forte.simbot.component.onebot.v11.core.event.notice + +import love.forte.simbot.common.id.ID +import love.forte.simbot.common.id.LongID +import love.forte.simbot.component.onebot.v11.core.actor.OneBotFriend +import love.forte.simbot.component.onebot.v11.event.notice.FriendRecallEvent +import love.forte.simbot.event.ContactEvent +import love.forte.simbot.suspendrunner.STP + + +/** + * 好友消息撤回事件 + * @see FriendRecallEvent + * @author ForteScarlet + */ +public interface OneBotFriendRecallEvent : OneBotNoticeEvent, ContactEvent { + override val sourceEvent: FriendRecallEvent + + /** + * 消息ID + */ + public val messageId: ID + get() = sourceEvent.messageId + + /** + * 消息发送人的ID + */ + public val authorId: LongID + get() = sourceEvent.userId + + /** + * 好友 + * + * @throws Exception + */ + @STP + override suspend fun content(): OneBotFriend +} diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/notice/OneBotGroupAdminEvent.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/notice/OneBotGroupAdminEvent.kt new file mode 100644 index 0000000..c9307db --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/notice/OneBotGroupAdminEvent.kt @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot is free software: you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + * + * simbot-component-onebot 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with simbot-component-onebot. + * If not, see . + */ + +package love.forte.simbot.component.onebot.v11.core.event.notice + +import love.forte.simbot.common.id.LongID +import love.forte.simbot.component.onebot.v11.core.actor.OneBotGroup +import love.forte.simbot.component.onebot.v11.core.actor.OneBotMember +import love.forte.simbot.component.onebot.v11.event.notice.GroupAdminEvent +import love.forte.simbot.event.MemberEvent +import love.forte.simbot.suspendrunner.STP + + +/** + * 群管理员变动事件 + * @see GroupAdminEvent + * + * @author ForteScarlet + */ +public interface OneBotGroupAdminEvent : OneBotNoticeEvent, MemberEvent { + override val sourceEvent: GroupAdminEvent + + /** + * 群号 + */ + public val groupId: LongID + get() = sourceEvent.groupId + + /** + * 被操作的群成员ID + */ + public val userId: LongID + get() = sourceEvent.userId + + /** + * 事件子类型,分别表示设置和取消管理员。 + * 可能的值: `set`、`unset` + * + * @see GroupAdminEvent.subType + */ + public val subType: String + get() = sourceEvent.subType + + /** + * 是被 _任职_ 为管理, + * 即 [subType] == [GroupAdminEvent.SUB_TYPE_SET]. + */ + public val isSet: Boolean + get() = subType == GroupAdminEvent.SUB_TYPE_SET + + /** + * 群 + * + * @throws Exception + */ + @STP + override suspend fun source(): OneBotGroup + + /** + * 被操作的群成员 + * + * @throws Exception + */ + @STP + override suspend fun content(): OneBotMember +} + +/** + * 是被 _免职_ , + * 即 [OneBotGroupAdminEvent.isSet] == `false`. + * + * @see OneBotGroupAdminEvent.isSet + */ +public inline val OneBotGroupAdminEvent.isNotSet: Boolean + get() = !isSet diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/notice/OneBotGroupBanEvent.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/notice/OneBotGroupBanEvent.kt new file mode 100644 index 0000000..3b562d6 --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/notice/OneBotGroupBanEvent.kt @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot is free software: you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + * + * simbot-component-onebot 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with simbot-component-onebot. + * If not, see . + */ + +package love.forte.simbot.component.onebot.v11.core.event.notice + +import love.forte.simbot.common.id.LongID +import love.forte.simbot.component.onebot.v11.core.actor.OneBotGroup +import love.forte.simbot.component.onebot.v11.core.actor.OneBotMember +import love.forte.simbot.component.onebot.v11.event.notice.GroupBanEvent +import love.forte.simbot.event.MemberEvent +import love.forte.simbot.suspendrunner.STP +import kotlin.time.Duration +import kotlin.time.Duration.Companion.seconds + + +/** + * 群禁言事件 + * + * @see GroupBanEvent + * + * @author ForteScarlet + */ +public interface OneBotGroupBanEvent : OneBotNoticeEvent, MemberEvent { + override val sourceEvent: GroupBanEvent + + /** + * 事件子类型,分别表示禁言、解除禁言。 + * 可能的值: `ban`、`lift_ban` + * + * @see GroupBanEvent.subType + */ + public val subType: String + get() = sourceEvent.subType + + /** + * 是否为禁言。 + * 即 [subType] == [GroupBanEvent.SUB_TYPE_BAN] + */ + public val isBan: Boolean + get() = subType == GroupBanEvent.SUB_TYPE_BAN + + /** + * 群号 + */ + public val groupId: LongID + get() = sourceEvent.groupId + + /** + * 被操作群成员的ID + */ + public val userId: LongID + get() = sourceEvent.userId + + /** + * 操作者的ID + */ + public val operatorId: LongID + get() = sourceEvent.operatorId + + /** + * 禁言时长,单位秒。 + * + * @see GroupBanEvent.duration + */ + public val durationSeconds: Long + get() = sourceEvent.duration + + /** + * 被禁言成员 + * + * @throws Exception + */ + @STP + override suspend fun content(): OneBotMember + + /** + * 所在群 + * + * @throws Exception + */ + @STP + override suspend fun source(): OneBotGroup +} + +/** + * 禁言时长 + * + * @see OneBotGroupBanEvent.durationSeconds + */ +public inline val OneBotGroupBanEvent.duration: Duration + get() = durationSeconds.seconds + +/** + * 是否为解除禁言。 + * 即 [OneBotGroupBanEvent.isBan] == `false` + * + * @see OneBotGroupBanEvent.isBan + */ +public inline val OneBotGroupBanEvent.isLeftBan: Boolean + get() = !isBan diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/notice/OneBotGroupChangeEvent.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/notice/OneBotGroupChangeEvent.kt new file mode 100644 index 0000000..6f241b8 --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/notice/OneBotGroupChangeEvent.kt @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot is free software: you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + * + * simbot-component-onebot 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with simbot-component-onebot. + * If not, see . + */ + +package love.forte.simbot.component.onebot.v11.core.event.notice + +import love.forte.simbot.common.id.LongID +import love.forte.simbot.component.onebot.v11.core.actor.OneBotGroup +import love.forte.simbot.component.onebot.v11.core.actor.OneBotMember +import love.forte.simbot.component.onebot.v11.event.notice.GroupDecreaseEvent +import love.forte.simbot.component.onebot.v11.event.notice.GroupIncreaseEvent +import love.forte.simbot.event.MemberDecreaseEvent +import love.forte.simbot.event.MemberIncreaseEvent +import love.forte.simbot.event.MemberIncreaseOrDecreaseEvent +import love.forte.simbot.suspendrunner.STP + +/** + * 群成员增加或减少事件 + * + * @see OneBotGroupMemberIncreaseEvent + * @see OneBotGroupMemberDecreaseEvent + */ +public interface OneBotGroupChangeEvent : OneBotNoticeEvent, MemberIncreaseOrDecreaseEvent { + /** + * 群号 + */ + public val groupId: LongID + + /** + * 增加或离去的群成员ID + */ + public val userId: LongID + + /** + * 群 + * @throws Exception + */ + @STP + override suspend fun content(): OneBotGroup + + /** + * 增加或离去的成员。 + * 如果无法获取则可能得到 `null`, + * 例如成员已经离去而无法获取。 + * @throws Exception + */ + @STP + override suspend fun member(): OneBotMember? +} + +/** + * 群成员增加事件 + * + * @see GroupIncreaseEvent + */ +public interface OneBotGroupMemberIncreaseEvent : OneBotGroupChangeEvent, MemberIncreaseEvent { + override val sourceEvent: GroupIncreaseEvent + + /** + * 群号 + */ + override val groupId: LongID + get() = sourceEvent.groupId + + /** + * 增加群成员ID + */ + override val userId: LongID + get() = sourceEvent.userId + + /** + * 群 + * @throws Exception + */ + @STP + override suspend fun content(): OneBotGroup + + /** + * 增加的成员 + * @throws Exception + */ + @STP + override suspend fun member(): OneBotMember +} + +/** + * 群成员减少事件 + * + * @see GroupDecreaseEvent + */ +public interface OneBotGroupMemberDecreaseEvent : OneBotGroupChangeEvent, MemberDecreaseEvent { + override val sourceEvent: GroupDecreaseEvent + + /** + * 群号 + */ + override val groupId: LongID + get() = sourceEvent.groupId + + /** + * 离去的群成员ID + */ + override val userId: LongID + get() = sourceEvent.userId + + /** + * 群 + * @throws Exception + */ + @STP + override suspend fun content(): OneBotGroup + + /** + * 离去的成员。已经离去无法获取, + * 始终得到 null + */ + @STP + override suspend fun member(): OneBotMember? = null +} diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/notice/OneBotGroupRecallEvent.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/notice/OneBotGroupRecallEvent.kt new file mode 100644 index 0000000..b6e5187 --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/notice/OneBotGroupRecallEvent.kt @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot is free software: you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + * + * simbot-component-onebot 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with simbot-component-onebot. + * If not, see . + */ + +package love.forte.simbot.component.onebot.v11.core.event.notice + +import love.forte.simbot.common.id.ID +import love.forte.simbot.common.id.LongID +import love.forte.simbot.component.onebot.v11.core.actor.OneBotGroup +import love.forte.simbot.component.onebot.v11.event.notice.GroupRecallEvent +import love.forte.simbot.event.ChatGroupEvent +import love.forte.simbot.suspendrunner.STP + + +/** + * 群消息撤回事件 + * + * @see GroupRecallEvent + * + * @author ForteScarlet + */ +public interface OneBotGroupRecallEvent : OneBotNoticeEvent, ChatGroupEvent { + override val sourceEvent: GroupRecallEvent + + /** + * 消息ID + */ + public val messageId: ID + get() = sourceEvent.messageId + + /** + * 群号 + */ + public val groupId: LongID + get() = sourceEvent.groupId + + /** + * 被撤回消息的发送者ID + */ + public val authorId: LongID + get() = sourceEvent.userId + + /** + * 操作者ID + */ + public val operatorId: LongID + get() = sourceEvent.operatorId + + /** + * 群 + * + * @throws Exception + */ + @STP + override suspend fun content(): OneBotGroup +} diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/notice/OneBotGroupUploadEvent.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/notice/OneBotGroupUploadEvent.kt new file mode 100644 index 0000000..7f8b295 --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/notice/OneBotGroupUploadEvent.kt @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot is free software: you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + * + * simbot-component-onebot 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with simbot-component-onebot. + * If not, see . + */ + +package love.forte.simbot.component.onebot.v11.core.event.notice + +import love.forte.simbot.common.id.LongID +import love.forte.simbot.component.onebot.v11.core.actor.OneBotGroup +import love.forte.simbot.component.onebot.v11.event.notice.GroupUploadEvent +import love.forte.simbot.event.ChatGroupEvent +import love.forte.simbot.suspendrunner.STP + + +/** + * 群文件上传事件 + * + * @see GroupUploadEvent + * @author ForteScarlet + */ +public interface OneBotGroupUploadEvent : OneBotNoticeEvent, ChatGroupEvent { + override val sourceEvent: GroupUploadEvent + + /** + * 群号 + */ + public val groupId: LongID + get() = sourceEvent.groupId + + /** + * 上传者ID + */ + public val userId: LongID + get() = sourceEvent.userId + + /** + * [GroupUploadEvent] 原始事件中的 [文件信息][GroupUploadEvent.file] + * + * @see GroupUploadEvent.file + */ + public val fileInfo: GroupUploadEvent.FileInfo + get() = sourceEvent.file + + /** + * 群 + * + * @throws Exception + */ + @STP + override suspend fun content(): OneBotGroup +} diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/notice/OneBotNoticeEvent.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/notice/OneBotNoticeEvent.kt index 06b9fde..f215622 100644 --- a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/notice/OneBotNoticeEvent.kt +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/notice/OneBotNoticeEvent.kt @@ -18,12 +18,16 @@ package love.forte.simbot.component.onebot.v11.core.event.notice import love.forte.simbot.component.onebot.v11.core.event.OneBotBotEvent +import love.forte.simbot.component.onebot.v11.event.notice.NoticeEvent /** + * 通知事件 + * + * @see NoticeEvent * * @author ForteScarlet */ public interface OneBotNoticeEvent : OneBotBotEvent { - // TODO + override val sourceEvent: NoticeEvent } diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/notice/OneBotNotifyEvent.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/notice/OneBotNotifyEvent.kt new file mode 100644 index 0000000..05c0f46 --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/event/notice/OneBotNotifyEvent.kt @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot is free software: you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + * + * simbot-component-onebot 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with simbot-component-onebot. + * If not, see . + */ + +package love.forte.simbot.component.onebot.v11.core.event.notice + +import love.forte.simbot.common.id.LongID +import love.forte.simbot.component.onebot.v11.core.actor.OneBotGroup +import love.forte.simbot.component.onebot.v11.core.actor.OneBotMember +import love.forte.simbot.component.onebot.v11.event.notice.NotifyEvent +import love.forte.simbot.event.MemberEvent +import love.forte.simbot.suspendrunner.STP + + +/** + * 群成员荣誉变更事件、红包人气王事件或戳一戳事件。 + * + * @see NotifyEvent + * @see OneBotHonorEvent + * @see OneBotLuckyKingEvent + * @see OneBotPokeEvent + * @author ForteScarlet + */ +public interface OneBotNotifyEvent : OneBotNoticeEvent, MemberEvent { + override val sourceEvent: NotifyEvent + + /** + * 荣誉类型. + * + * @see NotifyEvent.honorType + */ + public val honorType: String? + get() = sourceEvent.honorType + + /** + * 群号 + */ + public val groupId: LongID + get() = sourceEvent.groupId + + /** + * 成员ID + */ + public val userId: LongID + get() = sourceEvent.userId + + /** + * 群 + * + * @throws Exception + */ + @STP + override suspend fun source(): OneBotGroup + + /** + * 群成员 + * + * @throws Exception + */ + @STP + override suspend fun content(): OneBotMember + +} + +/** + * 群成员荣誉变更事件 + */ +public interface OneBotHonorEvent : OneBotNotifyEvent { + /** + * 荣誉类型. + * + * @see NotifyEvent.honorType + */ + override val honorType: String + get() = sourceEvent.honorType!! +} + +/** + * 群红包运气王事件 + */ +public interface OneBotLuckyKingEvent : OneBotNotifyEvent { + /** + * 人气王用户ID + */ + public val targetId: LongID + get() = sourceEvent.targetId!! +} + +/** + * 群戳一戳事件 + * + * @see OneBotMemberPokeEvent + * @see OneBotBotSelfPokeEvent + */ +public interface OneBotPokeEvent : OneBotNotifyEvent { + /** + * 被戳的用户ID + */ + public val targetId: LongID + get() = sourceEvent.targetId!! +} + +/** + * 群里Bot以外的群成员被戳一戳事件 + */ +public interface OneBotMemberPokeEvent : OneBotPokeEvent + +/** + * 群里Bot被戳一戳事件,即 [targetId] == [selfId]。 + */ +public interface OneBotBotSelfPokeEvent : OneBotPokeEvent diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonTest/kotlin/love/forte/simbot/component/onebot/v11/core/event/ResolveRawEventToEventTests.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonTest/kotlin/love/forte/simbot/component/onebot/v11/core/event/ResolveRawEventToEventTests.kt new file mode 100644 index 0000000..9946701 --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonTest/kotlin/love/forte/simbot/component/onebot/v11/core/event/ResolveRawEventToEventTests.kt @@ -0,0 +1,49 @@ +package love.forte.simbot.component.onebot.v11.core.event + +import kotlinx.serialization.KSerializer +import love.forte.simbot.component.onebot.v11.core.OneBot11 +import love.forte.simbot.component.onebot.v11.event.Event +import love.forte.simbot.component.onebot.v11.event.message.GroupMessageEvent + + +/** + * + * @author ForteScarlet + */ +class ResolveRawEventToEventTests { + + // @Test // TODO + fun resolveGroupMessageEventTest() { + val event = decodeEvent( + GroupMessageEvent.serializer(), + "" + ) + + } +} + +private fun decodeEvent( + serializer: KSerializer, + raw: String +): T { + return OneBot11.DefaultJson.decodeFromString( + serializer, + raw + ) +} + +// GroupMessageEvent +// PrivateMessageEvent +// HeartbeatEvent +// LifecycleEvent +// FriendAddEvent +// FriendRecallEvent +// GroupAdminEvent +// GroupBanEvent +// GroupDecreaseEvent +// GroupIncreaseEvent +// GroupRecallEvent +// GroupUploadEvent +// NotifyEvent +// FriendRequestEvent +// GroupRequestEvent diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-event/build.gradle.kts b/simbot-component-onebot-v11/simbot-component-onebot-v11-event/build.gradle.kts index 2e23e05..a1eaf0d 100644 --- a/simbot-component-onebot-v11/simbot-component-onebot-v11-event/build.gradle.kts +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-event/build.gradle.kts @@ -21,6 +21,7 @@ import love.forte.gradle.common.kotlin.multiplatform.applyTier1 import love.forte.gradle.common.kotlin.multiplatform.applyTier2 import love.forte.gradle.common.kotlin.multiplatform.applyTier3 import org.jetbrains.dokka.gradle.DokkaTaskPartial +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi plugins { kotlin("multiplatform") @@ -38,10 +39,12 @@ kotlin { explicitApi() applyDefaultHierarchyTemplate() - sourceSets.configureEach { - languageSettings { - optIn("love.forte.simbot.annotations.InternalSimbotAPI") - } + @OptIn(ExperimentalKotlinGradlePluginApi::class) + compilerOptions { + optIn.addAll( + "love.forte.simbot.annotations.InternalSimbotAPI", + "love.forte.simbot.component.onebot.common.annotations.InternalOneBotAPI" + ) } configKotlinJvm() diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-event/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/event/Event.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-event/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/event/Event.kt index 3731709..e403407 100644 --- a/simbot-component-onebot-v11/simbot-component-onebot-v11-event/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/event/Event.kt +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-event/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/event/Event.kt @@ -17,8 +17,8 @@ package love.forte.simbot.component.onebot.v11.event -import love.forte.simbot.annotations.InternalSimbotAPI import love.forte.simbot.common.id.LongID +import love.forte.simbot.component.onebot.common.annotations.InternalOneBotAPI /** @@ -98,7 +98,7 @@ public interface Event { * */ @Retention(AnnotationRetention.SOURCE) -@InternalSimbotAPI +@InternalOneBotAPI public annotation class ExpectEventType(val postType: String, val subType: String) /** @@ -109,5 +109,5 @@ public annotation class ExpectEventType(val postType: String, val subType: Strin * @suppress 用于项目内部代码生成器 */ @Retention(AnnotationRetention.SOURCE) -@InternalSimbotAPI +@InternalOneBotAPI public annotation class ExpectEventSubTypeProperty(val value: String, val postType: String, val name: String) diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-event/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/event/message/GroupMessageEvent.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-event/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/event/message/GroupMessageEvent.kt index d4e1cc7..c3a5cdc 100644 --- a/simbot-component-onebot-v11/simbot-component-onebot-v11-event/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/event/message/GroupMessageEvent.kt +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-event/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/event/message/GroupMessageEvent.kt @@ -55,7 +55,7 @@ public data class GroupMessageEvent @SourceEventConstructor constructor( @SerialName("message_id") override val messageId: ID, @SerialName("group_id") - public val groupId: ID, + public val groupId: LongID, @SerialName("message_type") override val messageType: String, @SerialName("sub_type") diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-event/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/event/notice/GroupAdminEvent.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-event/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/event/notice/GroupAdminEvent.kt index 873135c..af62c53 100644 --- a/simbot-component-onebot-v11/simbot-component-onebot-v11-event/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/event/notice/GroupAdminEvent.kt +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-event/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/event/notice/GroupAdminEvent.kt @@ -51,4 +51,16 @@ public data class GroupAdminEvent( public val groupId: LongID, @SerialName("user_id") public val userId: LongID, -) : NoticeEvent +) : NoticeEvent { + public companion object { + /** + * @see GroupAdminEvent.subType + */ + public const val SUB_TYPE_SET: String = "set" + + /** + * @see GroupAdminEvent.subType + */ + public const val SUB_TYPE_UNSET: String = "unset" + } +} diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-event/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/event/notice/GroupBanEvent.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-event/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/event/notice/GroupBanEvent.kt index a4c2247..2cb8633 100644 --- a/simbot-component-onebot-v11/simbot-component-onebot-v11-event/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/event/notice/GroupBanEvent.kt +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-event/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/event/notice/GroupBanEvent.kt @@ -56,4 +56,16 @@ public data class GroupBanEvent( @SerialName("user_id") public val userId: LongID, public val duration: Long, -) : NoticeEvent +) : NoticeEvent { + public companion object { + /** + * @see GroupBanEvent.subType + */ + public const val SUB_TYPE_BAN: String = "ban" + + /** + * @see GroupBanEvent.subType + */ + public const val SUB_TYPE_LIFT_BAN: String = "lift_ban" + } +} diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-event/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/event/notice/NotifyEvent.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-event/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/event/notice/NotifyEvent.kt index 98185f5..7ee0efa 100644 --- a/simbot-component-onebot-v11/simbot-component-onebot-v11-event/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/event/notice/NotifyEvent.kt +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-event/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/event/notice/NotifyEvent.kt @@ -25,14 +25,21 @@ import love.forte.simbot.common.id.LongID import love.forte.simbot.component.onebot.v11.event.ExpectEventType /** - * [群成员荣誉变更](https://github.com/botuniverse/onebot-11/blob/master/event/notice.md#群成员荣誉变更) + * [群成员荣誉变更](https://github.com/botuniverse/onebot-11/blob/master/event/notice.md#群成员荣誉变更)、 + * [群红包运气王](https://github.com/botuniverse/onebot-11/blob/master/event/notice.md#群红包运气王)、 + * [群内戳一戳](https://github.com/botuniverse/onebot-11/blob/master/event/notice.md#群内戳一戳)。 + * + * 其中,红包和戳一戳的 [subType] 分别为 `lucky_king` 和 `poke` * * @property subType 提示类型。 - * 可能的值: `honor` + * 可能的值: `honor`, `lucky_king`, `poke` * @property groupId 群号。 * @property honorType 荣誉类型,分别表示龙王、群聊之火、快乐源泉。 - * 可能的值: `talkative`、`performer`、`emotion` + * 可能的值: `talkative`、`performer`、`emotion`。 + * 当 [subType] 为 `honor` 时有值。 * @property userId 成员 QQ 号。 + * @property targetId 当 [subType] 为 `lucky_king` 时代表人气王用户ID, + * 为 `poke` 时代表被戳的人的ID,否则为 `null`。 */ @ExpectEventType( postType = NoticeEvent.POST_TYPE, @@ -52,7 +59,27 @@ public data class NotifyEvent( @SerialName("group_id") public val groupId: LongID, @SerialName("honor_type") - public val honorType: String, + public val honorType: String? = null, @SerialName("user_id") public val userId: LongID, -) : NoticeEvent + @SerialName("target_id") + public val targetId: LongID? = null +) : NoticeEvent { + public companion object { + /** + * @see NotifyEvent.subType + */ + public const val SUB_TYPE_HONOR: String = "honor" + + /** + * @see NotifyEvent.subType + */ + public const val SUB_TYPE_POKE: String = "poke" + + /** + * @see NotifyEvent.subType + */ + public const val SUB_TYPE_LUCKY_KING: String = "lucky_king" + } + +} diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-message/build.gradle.kts b/simbot-component-onebot-v11/simbot-component-onebot-v11-message/build.gradle.kts index c1cf926..6074747 100644 --- a/simbot-component-onebot-v11/simbot-component-onebot-v11-message/build.gradle.kts +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-message/build.gradle.kts @@ -21,6 +21,7 @@ import love.forte.gradle.common.kotlin.multiplatform.applyTier1 import love.forte.gradle.common.kotlin.multiplatform.applyTier2 import love.forte.gradle.common.kotlin.multiplatform.applyTier3 import org.jetbrains.dokka.gradle.DokkaTaskPartial +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi plugins { kotlin("multiplatform") @@ -38,6 +39,13 @@ kotlin { explicitApi() applyDefaultHierarchyTemplate() + @OptIn(ExperimentalKotlinGradlePluginApi::class) + compilerOptions { + optIn.addAll( + "love.forte.simbot.component.onebot.common.annotations.InternalOneBotAPI" + ) + } + configKotlinJvm() js(IR) { @@ -50,6 +58,7 @@ kotlin { sourceSets { commonMain.dependencies { + implementation(project(":simbot-component-onebot-common")) implementation(libs.simbot.api) implementation(libs.simbot.common.annotations) api(libs.kotlinx.coroutines.core) diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-message/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/message/MessageElementResolvers.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-message/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/message/MessageElementResolvers.kt index 6812a96..e343486 100644 --- a/simbot-component-onebot-v11/simbot-component-onebot-v11-message/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/message/MessageElementResolvers.kt +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-message/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/message/MessageElementResolvers.kt @@ -20,27 +20,12 @@ package love.forte.simbot.component.onebot.v11.message import kotlinx.coroutines.suspendCancellableCoroutine -import love.forte.simbot.annotations.InternalSimbotAPI import love.forte.simbot.common.id.StringID.Companion.ID import love.forte.simbot.common.id.literal -import love.forte.simbot.component.onebot.v11.message.segment.OneBotAt -import love.forte.simbot.component.onebot.v11.message.segment.OneBotFace -import love.forte.simbot.component.onebot.v11.message.segment.OneBotImage -import love.forte.simbot.component.onebot.v11.message.segment.OneBotMessageSegment -import love.forte.simbot.component.onebot.v11.message.segment.OneBotMessageSegmentElement -import love.forte.simbot.component.onebot.v11.message.segment.OneBotText -import love.forte.simbot.component.onebot.v11.message.segment.toElement -import love.forte.simbot.message.At -import love.forte.simbot.message.AtAll -import love.forte.simbot.message.Face -import love.forte.simbot.message.Image -import love.forte.simbot.message.Message -import love.forte.simbot.message.Messages -import love.forte.simbot.message.OfflineImage +import love.forte.simbot.component.onebot.common.annotations.InternalOneBotAPI +import love.forte.simbot.component.onebot.v11.message.segment.* +import love.forte.simbot.message.* import love.forte.simbot.message.OfflineImageResolver.Companion.resolve -import love.forte.simbot.message.OfflineImageValueResolver -import love.forte.simbot.message.RemoteImage -import love.forte.simbot.message.Text import love.forte.simbot.resource.Resource import love.forte.simbot.resource.toResource import love.forte.simbot.resource.toStringResource @@ -57,7 +42,7 @@ import kotlin.jvm.JvmName * | [OneBotFace] | [Face] | * | 其他 | 使用 [toElement] 转化 | */ -@InternalSimbotAPI +@InternalOneBotAPI public fun OneBotMessageSegment.resolveToMessageElement(): Message.Element { return when (this) { is OneBotAt -> if (isAll) AtAll else At(data.qq.ID) @@ -71,7 +56,7 @@ public fun OneBotMessageSegment.resolveToMessageElement(): Message.Element { * * @see resolveToOneBotSegment */ -@InternalSimbotAPI +@InternalOneBotAPI public suspend fun Message.resolveToOneBotSegmentList(): List { return when (this) { is Message.Element -> resolveToOneBotSegment() @@ -85,7 +70,7 @@ public suspend fun Message.resolveToOneBotSegmentList(): List