Added the extensions to abilities

This commit is contained in:
romangraef 2018-11-10 00:51:00 +01:00
parent ffc1f713dc
commit d515d8e44f
No known key found for this signature in database
GPG Key ID: 5FF81499D091C626
5 changed files with 725 additions and 53 deletions

View File

@ -632,6 +632,11 @@
<option value="$PROJECT_DIR$/pom.xml" /> <option value="$PROJECT_DIR$/pom.xml" />
</list> </list>
</option> </option>
<option name="ignoredFiles">
<set>
<option value="$PROJECT_DIR$/telegrambots-extensions/pom.xml" />
</set>
</option>
</component> </component>
<component name="Palette2"> <component name="Palette2">
<group name="Swing"> <group name="Swing">
@ -755,7 +760,7 @@
</group> </group>
</component> </component>
<component name="ProjectCodeStyleConfiguration"> <component name="ProjectCodeStyleConfiguration">
<option name="PREFERRED_PROJECT_CODE_STYLE" value="GoogleStyle" /> <option name="USE_PER_PROJECT_SETTINGS" value="true" />
<code_scheme name="Project" version="173"> <code_scheme name="Project" version="173">
<DBN-PSQL> <DBN-PSQL>
<case-options enabled="false"> <case-options enabled="false">
@ -781,30 +786,13 @@
<option name="ITERATION_ELEMENTS_WRAPPING" value="chop_down_if_not_single" /> <option name="ITERATION_ELEMENTS_WRAPPING" value="chop_down_if_not_single" />
</formatting-settings> </formatting-settings>
</DBN-SQL> </DBN-SQL>
<DBN-PSQL> <codeStyleSettings language="JAVA">
<case-options enabled="false"> <indentOptions>
<option name="KEYWORD_CASE" value="lower" /> <option name="INDENT_SIZE" value="2" />
<option name="FUNCTION_CASE" value="lower" /> <option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="PARAMETER_CASE" value="lower" /> <option name="TAB_SIZE" value="2" />
<option name="DATATYPE_CASE" value="lower" /> </indentOptions>
<option name="OBJECT_CASE" value="preserve" /> </codeStyleSettings>
</case-options>
<formatting-settings enabled="false" />
</DBN-PSQL>
<DBN-SQL>
<case-options enabled="false">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
<option name="DATATYPE_CASE" value="lower" />
<option name="OBJECT_CASE" value="preserve" />
</case-options>
<formatting-settings enabled="false">
<option name="STATEMENT_SPACING" value="one_line" />
<option name="CLAUSE_CHOP_DOWN" value="chop_down_if_statement_long" />
<option name="ITERATION_ELEMENTS_WRAPPING" value="chop_down_if_not_single" />
</formatting-settings>
</DBN-SQL>
</code_scheme> </code_scheme>
</component> </component>
<component name="ProjectCodeStyleSettingsManager"> <component name="ProjectCodeStyleSettingsManager">

640
Bots.iws Normal file
View File

@ -0,0 +1,640 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="95d6a3d5-a09b-46d6-b883-5f336b2666c0" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/util/AbilityExtension.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/telegrambots-abilities/src/test/java/org/telegram/abilitybots/api/bot/TestAbilityBot.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Bots.ipr" beforeDir="false" afterPath="$PROJECT_DIR$/Bots.ipr" afterDir="false" />
<change beforePath="$PROJECT_DIR$/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java" beforeDir="false" afterPath="$PROJECT_DIR$/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java" afterDir="false" />
</list>
<ignored path="$PROJECT_DIR$/telegrambots-spring-boot-starter/target/" />
<ignored path="$PROJECT_DIR$/target/" />
<ignored path="$PROJECT_DIR$/telegrambots/target/" />
<ignored path="$PROJECT_DIR$/telegrambots-meta/target/" />
<ignored path="$PROJECT_DIR$/telegrambots-abilities/target/" />
<ignored path="$PROJECT_DIR$/telegrambots-extensions/target/" />
<ignored path="$PROJECT_DIR$/telegrambots-chat-session-bot/target/" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FUSProjectUsageTrigger">
<session id="1779234380">
<usages-collector id="statistics.lifecycle.project">
<counts>
<entry key="project.open.time.5" value="1" />
<entry key="project.opened" value="1" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.extensions.open">
<counts>
<entry key="class" value="1" />
<entry key="java" value="7" />
<entry key="md" value="1" />
<entry key="png" value="1" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.types.open">
<counts>
<entry key="CLASS" value="1" />
<entry key="Image" value="1" />
<entry key="JAVA" value="7" />
<entry key="Markdown" value="1" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.extensions.edit">
<counts>
<entry key="java" value="2434" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.types.edit">
<counts>
<entry key="JAVA" value="2434" />
</counts>
</usages-collector>
</session>
</component>
<component name="FileEditorManager">
<leaf>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-586">
<caret line="597" column="82" selection-start-line="597" selection-start-column="82" selection-end-line="597" selection-end-column="82" />
<folding>
<element signature="e#22905#22906#0" expanded="true" />
<element signature="e#22968#22969#0" expanded="true" />
<element signature="e#27360#27361#0" expanded="true" />
<element signature="e#27394#27395#0" expanded="true" />
<element signature="e#27435#27436#0" expanded="true" />
<element signature="e#27473#27474#0" expanded="true" />
<element signature="e#27540#27541#0" expanded="true" />
<element signature="e#27573#27574#0" expanded="true" />
<element signature="e#30186#30187#0" expanded="true" />
<element signature="e#30231#30232#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/telegrambots-abilities/src/test/java/org/telegram/abilitybots/api/bot/AbilityBotI18nTest.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1058">
<caret line="66" column="15" selection-start-line="66" selection-start-column="15" selection-end-line="66" selection-end-column="15" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/telegrambots-abilities/src/test/java/org/telegram/abilitybots/api/bot/TestAbilityBot.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="176">
<caret line="35" column="20" lean-forward="true" selection-start-line="35" selection-start-column="20" selection-end-line="38" selection-end-column="37" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#264#265#0" expanded="true" />
<element signature="e#302#303#0" expanded="true" />
<element signature="e#130#131#0" expanded="true" />
<element signature="e#148#149#0" expanded="true" />
<element signature="e#1091#1092#0" expanded="true" />
<element signature="e#1131#1132#0" expanded="true" />
<element signature="e#1083#1084#0" expanded="true" />
<element signature="e#1124#1125#0" expanded="true" />
<element signature="e#1298#1299#0" expanded="true" />
<element signature="e#1340#1341#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Interface" />
<option value="Class" />
</list>
</option>
</component>
<component name="FindInProjectRecents">
<findStrings>
<find>abilities</find>
</findStrings>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/util/AbilityExtension.java" />
<option value="$PROJECT_DIR$/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java" />
<option value="$PROJECT_DIR$/telegrambots-abilities/src/test/java/org/telegram/abilitybots/api/bot/AbilityExtensionTest.java" />
<option value="$PROJECT_DIR$/telegrambots-abilities/src/test/java/org/telegram/abilitybots/api/bot/TestAbilityBot.java" />
</list>
</option>
</component>
<component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
<component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
<component name="JsGulpfileManager">
<detection-done>true</detection-done>
<sorting>DEFINITION_ORDER</sorting>
</component>
<component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="8" />
<option name="width" value="620" />
<option name="height" value="442" />
</component>
<component name="ProjectView">
<navigator proportions="" version="1">
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope">
<subPane subId="Scope 'Project Files'; set:Project Files; class com.intellij.psi.search.scope.ProjectFilesScope">
<expand>
<path>
<item name="Bots" type="3d21c010:ScopeViewTreeModel$ProjectNode" />
<item name="telegrambots-abilities" type="2674bda8:ScopeViewTreeModel$GroupNode" />
</path>
<path>
<item name="Bots" type="3d21c010:ScopeViewTreeModel$ProjectNode" />
<item name="telegrambots-abilities" type="2674bda8:ScopeViewTreeModel$GroupNode" />
<item name="src" type="9f88c78c:ScopeViewTreeModel$FileNode" />
</path>
</expand>
<select />
</subPane>
</pane>
<pane id="ProjectPane">
<subPane>
<expand>
<path>
<item name="Bots" type="b2602c69:ProjectViewProjectNode" />
<item name="TelegramBots" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Bots" type="b2602c69:ProjectViewProjectNode" />
<item name="TelegramBots" type="462c0819:PsiDirectoryNode" />
<item name="telegrambots-abilities" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Bots" type="b2602c69:ProjectViewProjectNode" />
<item name="TelegramBots" type="462c0819:PsiDirectoryNode" />
<item name="telegrambots-abilities" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Bots" type="b2602c69:ProjectViewProjectNode" />
<item name="TelegramBots" type="462c0819:PsiDirectoryNode" />
<item name="telegrambots-abilities" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="main" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Bots" type="b2602c69:ProjectViewProjectNode" />
<item name="TelegramBots" type="462c0819:PsiDirectoryNode" />
<item name="telegrambots-abilities" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="main" type="462c0819:PsiDirectoryNode" />
<item name="java" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Bots" type="b2602c69:ProjectViewProjectNode" />
<item name="TelegramBots" type="462c0819:PsiDirectoryNode" />
<item name="telegrambots-abilities" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="main" type="462c0819:PsiDirectoryNode" />
<item name="java" type="462c0819:PsiDirectoryNode" />
<item name="org" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Bots" type="b2602c69:ProjectViewProjectNode" />
<item name="TelegramBots" type="462c0819:PsiDirectoryNode" />
<item name="telegrambots-abilities" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="main" type="462c0819:PsiDirectoryNode" />
<item name="java" type="462c0819:PsiDirectoryNode" />
<item name="org" type="462c0819:PsiDirectoryNode" />
<item name="telegram" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Bots" type="b2602c69:ProjectViewProjectNode" />
<item name="TelegramBots" type="462c0819:PsiDirectoryNode" />
<item name="telegrambots-abilities" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="main" type="462c0819:PsiDirectoryNode" />
<item name="java" type="462c0819:PsiDirectoryNode" />
<item name="org" type="462c0819:PsiDirectoryNode" />
<item name="telegram" type="462c0819:PsiDirectoryNode" />
<item name="abilitybots" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Bots" type="b2602c69:ProjectViewProjectNode" />
<item name="TelegramBots" type="462c0819:PsiDirectoryNode" />
<item name="telegrambots-abilities" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="main" type="462c0819:PsiDirectoryNode" />
<item name="java" type="462c0819:PsiDirectoryNode" />
<item name="org" type="462c0819:PsiDirectoryNode" />
<item name="telegram" type="462c0819:PsiDirectoryNode" />
<item name="abilitybots" type="462c0819:PsiDirectoryNode" />
<item name="api" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Bots" type="b2602c69:ProjectViewProjectNode" />
<item name="TelegramBots" type="462c0819:PsiDirectoryNode" />
<item name="telegrambots-abilities" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="main" type="462c0819:PsiDirectoryNode" />
<item name="java" type="462c0819:PsiDirectoryNode" />
<item name="org" type="462c0819:PsiDirectoryNode" />
<item name="telegram" type="462c0819:PsiDirectoryNode" />
<item name="abilitybots" type="462c0819:PsiDirectoryNode" />
<item name="api" type="462c0819:PsiDirectoryNode" />
<item name="bot" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Bots" type="b2602c69:ProjectViewProjectNode" />
<item name="TelegramBots" type="462c0819:PsiDirectoryNode" />
<item name="telegrambots-abilities" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="main" type="462c0819:PsiDirectoryNode" />
<item name="java" type="462c0819:PsiDirectoryNode" />
<item name="org" type="462c0819:PsiDirectoryNode" />
<item name="telegram" type="462c0819:PsiDirectoryNode" />
<item name="abilitybots" type="462c0819:PsiDirectoryNode" />
<item name="api" type="462c0819:PsiDirectoryNode" />
<item name="objects" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Bots" type="b2602c69:ProjectViewProjectNode" />
<item name="TelegramBots" type="462c0819:PsiDirectoryNode" />
<item name="telegrambots-abilities" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="main" type="462c0819:PsiDirectoryNode" />
<item name="java" type="462c0819:PsiDirectoryNode" />
<item name="org" type="462c0819:PsiDirectoryNode" />
<item name="telegram" type="462c0819:PsiDirectoryNode" />
<item name="abilitybots" type="462c0819:PsiDirectoryNode" />
<item name="api" type="462c0819:PsiDirectoryNode" />
<item name="util" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Bots" type="b2602c69:ProjectViewProjectNode" />
<item name="TelegramBots" type="462c0819:PsiDirectoryNode" />
<item name="telegrambots-abilities" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="main" type="462c0819:PsiDirectoryNode" />
<item name="resources" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Bots" type="b2602c69:ProjectViewProjectNode" />
<item name="TelegramBots" type="462c0819:PsiDirectoryNode" />
<item name="telegrambots-abilities" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="test" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Bots" type="b2602c69:ProjectViewProjectNode" />
<item name="TelegramBots" type="462c0819:PsiDirectoryNode" />
<item name="telegrambots-abilities" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="test" type="462c0819:PsiDirectoryNode" />
<item name="java" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Bots" type="b2602c69:ProjectViewProjectNode" />
<item name="TelegramBots" type="462c0819:PsiDirectoryNode" />
<item name="telegrambots-abilities" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="test" type="462c0819:PsiDirectoryNode" />
<item name="java" type="462c0819:PsiDirectoryNode" />
<item name="org" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Bots" type="b2602c69:ProjectViewProjectNode" />
<item name="TelegramBots" type="462c0819:PsiDirectoryNode" />
<item name="telegrambots-abilities" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="test" type="462c0819:PsiDirectoryNode" />
<item name="java" type="462c0819:PsiDirectoryNode" />
<item name="org" type="462c0819:PsiDirectoryNode" />
<item name="telegram" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Bots" type="b2602c69:ProjectViewProjectNode" />
<item name="TelegramBots" type="462c0819:PsiDirectoryNode" />
<item name="telegrambots-abilities" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="test" type="462c0819:PsiDirectoryNode" />
<item name="java" type="462c0819:PsiDirectoryNode" />
<item name="org" type="462c0819:PsiDirectoryNode" />
<item name="telegram" type="462c0819:PsiDirectoryNode" />
<item name="abilitybots" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Bots" type="b2602c69:ProjectViewProjectNode" />
<item name="TelegramBots" type="462c0819:PsiDirectoryNode" />
<item name="telegrambots-abilities" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="test" type="462c0819:PsiDirectoryNode" />
<item name="java" type="462c0819:PsiDirectoryNode" />
<item name="org" type="462c0819:PsiDirectoryNode" />
<item name="telegram" type="462c0819:PsiDirectoryNode" />
<item name="abilitybots" type="462c0819:PsiDirectoryNode" />
<item name="api" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Bots" type="b2602c69:ProjectViewProjectNode" />
<item name="TelegramBots" type="462c0819:PsiDirectoryNode" />
<item name="telegrambots-abilities" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="test" type="462c0819:PsiDirectoryNode" />
<item name="java" type="462c0819:PsiDirectoryNode" />
<item name="org" type="462c0819:PsiDirectoryNode" />
<item name="telegram" type="462c0819:PsiDirectoryNode" />
<item name="abilitybots" type="462c0819:PsiDirectoryNode" />
<item name="api" type="462c0819:PsiDirectoryNode" />
<item name="bot" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Bots" type="b2602c69:ProjectViewProjectNode" />
<item name="TelegramBots" type="462c0819:PsiDirectoryNode" />
<item name="telegrambots-abilities" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="test" type="462c0819:PsiDirectoryNode" />
<item name="java" type="462c0819:PsiDirectoryNode" />
<item name="org" type="462c0819:PsiDirectoryNode" />
<item name="telegram" type="462c0819:PsiDirectoryNode" />
<item name="abilitybots" type="462c0819:PsiDirectoryNode" />
<item name="api" type="462c0819:PsiDirectoryNode" />
<item name="db" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Bots" type="b2602c69:ProjectViewProjectNode" />
<item name="TelegramBots" type="462c0819:PsiDirectoryNode" />
<item name="telegrambots-abilities" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="test" type="462c0819:PsiDirectoryNode" />
<item name="java" type="462c0819:PsiDirectoryNode" />
<item name="org" type="462c0819:PsiDirectoryNode" />
<item name="telegram" type="462c0819:PsiDirectoryNode" />
<item name="abilitybots" type="462c0819:PsiDirectoryNode" />
<item name="api" type="462c0819:PsiDirectoryNode" />
<item name="objects" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Bots" type="b2602c69:ProjectViewProjectNode" />
<item name="TelegramBots" type="462c0819:PsiDirectoryNode" />
<item name="telegrambots-abilities" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="test" type="462c0819:PsiDirectoryNode" />
<item name="java" type="462c0819:PsiDirectoryNode" />
<item name="org" type="462c0819:PsiDirectoryNode" />
<item name="telegram" type="462c0819:PsiDirectoryNode" />
<item name="abilitybots" type="462c0819:PsiDirectoryNode" />
<item name="api" type="462c0819:PsiDirectoryNode" />
<item name="sender" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Bots" type="b2602c69:ProjectViewProjectNode" />
<item name="TelegramBots" type="462c0819:PsiDirectoryNode" />
<item name="telegrambots-abilities" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="test" type="462c0819:PsiDirectoryNode" />
<item name="resources" type="462c0819:PsiDirectoryNode" />
</path>
</expand>
<select />
</subPane>
</pane>
<pane id="PackagesPane" />
</panes>
</component>
<component name="PropertiesComponent">
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="aspect.path.notification.shown" value="true" />
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1541807343779" />
<property name="settings.editor.selected.configurable" value="preferences.sourceCode.Java" />
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="RunManager">
<configuration name="TestAbilityBot" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="org.telegram.abilitybots.api.bot.TestAbilityBot" />
<module name="telegrambots-abilities" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="org.telegram.abilitybots.api.bot.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<recent_temporary>
<list>
<item itemvalue="Application.TestAbilityBot" />
</list>
</recent_temporary>
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="95d6a3d5-a09b-46d6-b883-5f336b2666c0" name="Default Changelist" comment="" />
<created>1541802659942</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1541802659942</updated>
<workItem from="1541802666520" duration="3999000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="3999000" />
</component>
<component name="ToolWindowManager">
<frame x="0" y="0" width="1366" height="732" extended-state="6" />
<editor active="true" />
<layout>
<window_info id="Designer" />
<window_info id="Image Layers" />
<window_info id="UI Designer" />
<window_info id="Favorites" side_tool="true" />
<window_info id="Capture Tool" />
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.29452056" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info anchor="bottom" id="Spring" />
<window_info anchor="bottom" id="Terminal" weight="0.32935154" />
<window_info anchor="bottom" id="Tool Output" />
<window_info anchor="bottom" id="Event Log" side_tool="true" weight="0.32935154" />
<window_info anchor="bottom" id="Java Enterprise" />
<window_info anchor="bottom" id="Database Changes" show_stripe_button="false" />
<window_info anchor="bottom" id="Version Control" />
<window_info anchor="bottom" id="ANTLR Preview" />
<window_info anchor="bottom" id="Messages" weight="0.32820514" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" />
<window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.32935154" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="right" id="Cargo" />
<window_info anchor="right" id="Palette" />
<window_info anchor="right" id="Capture Analysis" />
<window_info anchor="right" id="PsiViewer" />
<window_info anchor="right" id="Maven Projects" />
<window_info anchor="right" id="Database" />
<window_info anchor="right" id="Palette&#9;" />
<window_info anchor="right" id="Theme Preview" />
<window_info anchor="right" id="Bean Validation" />
<window_info anchor="right" id="Commander" order="0" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
</layout>
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" />
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="com.vaadin.designer2.intellij.settings.SizePresetsSettingsComponent">
<option name="sizePresets">
<list>
<SizePreset>
<option name="caption" value="Phone" />
<option name="height" value="568" />
<option name="width" value="320" />
</SizePreset>
<SizePreset>
<option name="caption" value="Tablet" />
<option name="height" value="1024" />
<option name="width" value="768" />
</SizePreset>
<SizePreset>
<option name="caption" value="Desktop" />
<option name="height" value="900" />
<option name="width" value="1440" />
</SizePreset>
</list>
</option>
</component>
<component name="designer2.settings">
<option name="autodetectServerAddress" value="true" />
<option name="serverIp" value="localhost" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/eclipse configuration.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="FIRST">
<first_editor relative-caret-position="-511" />
<second_editor />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/jetbrains.png">
<provider selected="true" editor-type-id="images" />
</entry>
<entry file="file://$PROJECT_DIR$/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/util/AbilityExtension.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="92">
<caret line="3" column="114" selection-start-line="3" selection-start-column="114" selection-end-line="3" selection-end-column="114" />
</state>
</provider>
</entry>
<entry file="jar:///usr/lib/jvm/java-1.8.0-openjdk/jre/lib/rt.jar!/java/util/stream/Stream.class">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="177">
<caret line="32" column="18" selection-start-line="32" selection-start-column="18" selection-end-line="32" selection-end-column="18" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/telegrambots-abilities/src/test/java/org/telegram/abilitybots/api/bot/AbilityBotTest.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="115">
<caret line="120" column="11" selection-start-line="120" selection-start-column="11" selection-end-line="120" selection-end-column="24" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/telegrambots-abilities/src/test/java/org/telegram/abilitybots/api/objects/AbilityTest.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="253">
<caret line="50" column="15" lean-forward="true" selection-start-line="50" selection-start-column="15" selection-end-line="50" selection-end-column="15" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-586">
<caret line="597" column="82" selection-start-line="597" selection-start-column="82" selection-end-line="597" selection-end-column="82" />
<folding>
<element signature="e#22905#22906#0" expanded="true" />
<element signature="e#22968#22969#0" expanded="true" />
<element signature="e#27360#27361#0" expanded="true" />
<element signature="e#27394#27395#0" expanded="true" />
<element signature="e#27435#27436#0" expanded="true" />
<element signature="e#27473#27474#0" expanded="true" />
<element signature="e#27540#27541#0" expanded="true" />
<element signature="e#27573#27574#0" expanded="true" />
<element signature="e#30186#30187#0" expanded="true" />
<element signature="e#30231#30232#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/telegrambots-abilities/src/test/java/org/telegram/abilitybots/api/bot/AbilityExtensionTest.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="138">
<caret line="6" column="2" selection-start-line="6" selection-start-column="2" selection-end-line="6" selection-end-column="2" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/telegrambots-abilities/src/test/java/org/telegram/abilitybots/api/bot/AbilityBotI18nTest.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1058">
<caret line="66" column="15" selection-start-line="66" selection-start-column="15" selection-end-line="66" selection-end-column="15" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/telegrambots-abilities/src/test/java/org/telegram/abilitybots/api/bot/TestAbilityBot.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="176">
<caret line="35" column="20" lean-forward="true" selection-start-line="35" selection-start-column="20" selection-end-line="38" selection-end-column="37" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#264#265#0" expanded="true" />
<element signature="e#302#303#0" expanded="true" />
<element signature="e#130#131#0" expanded="true" />
<element signature="e#148#149#0" expanded="true" />
<element signature="e#1091#1092#0" expanded="true" />
<element signature="e#1131#1132#0" expanded="true" />
<element signature="e#1083#1084#0" expanded="true" />
<element signature="e#1124#1125#0" expanded="true" />
<element signature="e#1298#1299#0" expanded="true" />
<element signature="e#1340#1341#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</component>
</project>

BIN
TestMobileBot Normal file

Binary file not shown.

View File

@ -12,6 +12,7 @@ import org.telegram.abilitybots.api.objects.*;
import org.telegram.abilitybots.api.sender.DefaultSender; import org.telegram.abilitybots.api.sender.DefaultSender;
import org.telegram.abilitybots.api.sender.MessageSender; import org.telegram.abilitybots.api.sender.MessageSender;
import org.telegram.abilitybots.api.sender.SilentSender; import org.telegram.abilitybots.api.sender.SilentSender;
import org.telegram.abilitybots.api.util.AbilityExtension;
import org.telegram.abilitybots.api.util.AbilityUtils; import org.telegram.abilitybots.api.util.AbilityUtils;
import org.telegram.abilitybots.api.util.Pair; import org.telegram.abilitybots.api.util.Pair;
import org.telegram.abilitybots.api.util.Trio; import org.telegram.abilitybots.api.util.Trio;
@ -36,7 +37,9 @@ import java.lang.reflect.Method;
import java.util.*; import java.util.*;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.function.BiFunction; import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Predicate; import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import static com.google.common.base.Strings.isNullOrEmpty; import static com.google.common.base.Strings.isNullOrEmpty;
@ -93,7 +96,7 @@ import static org.telegram.abilitybots.api.util.AbilityUtils.*;
* @author Abbas Abou Daya * @author Abbas Abou Daya
*/ */
@SuppressWarnings({"ConfusingArgumentToVarargsMethod", "UnusedReturnValue", "WeakerAccess", "unused", "ConstantConditions"}) @SuppressWarnings({"ConfusingArgumentToVarargsMethod", "UnusedReturnValue", "WeakerAccess", "unused", "ConstantConditions"})
public abstract class BaseAbilityBot extends DefaultAbsSender { public abstract class BaseAbilityBot extends DefaultAbsSender implements AbilityExtension {
private static final String TAG = BaseAbilityBot.class.getSimpleName(); private static final String TAG = BaseAbilityBot.class.getSimpleName();
// DB objects // DB objects
@ -611,22 +614,31 @@ public abstract class BaseAbilityBot extends DefaultAbsSender {
*/ */
private void registerAbilities() { private void registerAbilities() {
try { try {
abilities = stream(this.getClass().getMethods()) List<AbilityExtension>extensions = stream(this.getClass().getMethods())
.filter(method -> method.getReturnType().equals(Ability.class)) .filter(checkReturnType(AbilityExtension.class))
.map(this::returnAbility) .map(this.returnExtension(this))
.collect(Collectors.toList());
extensions.add(this);
abilities = extensions.stream()
.flatMap(ext -> stream(ext.getClass().getMethods())
.filter(checkReturnType(Ability.class))
.map(this.returnAbility(ext)))
.collect(ImmutableMap::<String, Ability>builder, .collect(ImmutableMap::<String, Ability>builder,
(b, a) -> b.put(a.name(), a), (b, a) -> b.put(a.name(), a),
(b1, b2) -> b1.putAll(b2.build())) (b1, b2) -> b1.putAll(b2.build()))
.build(); .build();
Stream<Reply> methodReplies = stream(this.getClass().getMethods()) Stream<Reply> extensionReplies = extensions.stream()
.filter(method -> method.getReturnType().equals(Reply.class)) .flatMap(ext -> stream(ext.getClass().getMethods())
.map(this::returnReply); .filter(checkReturnType(Reply.class))
.map(this.returnReply(ext)));
Stream<Reply> abilityReplies = abilities.values().stream() Stream<Reply> abilityReplies = abilities.values().stream()
.flatMap(ability -> ability.replies().stream()); .flatMap(ability -> ability.replies().stream());
replies = Stream.concat(methodReplies, abilityReplies).collect( replies = Stream.concat(abilityReplies, extensionReplies).collect(
ImmutableList::<Reply>builder, ImmutableList::<Reply>builder,
Builder::add, Builder::add,
(b1, b2) -> b1.addAll(b2.build())) (b1, b2) -> b1.addAll(b2.build()))
@ -638,34 +650,59 @@ public abstract class BaseAbilityBot extends DefaultAbsSender {
} }
private Predicate<Method> checkReturnType(Class<?> clazz) {
return method -> clazz.isAssignableFrom(method.getReturnType());
}
/** /**
* Invokes the method and retrieves its return {@link Ability}. * Invokes the method curried and retrieves its return {@link Reply}.
* *
* @param method a method that returns an ability * @param obj an bot or extension that this method is invoked with
* @return the ability returned by the method * @return a {@link Function} which returns the {@link Reply} returned by the given method
*/ */
private Ability returnAbility(Method method) { private Function<? super Method, AbilityExtension> returnExtension(Object obj) {
return method -> {
try { try {
return (Ability) method.invoke(this); return (AbilityExtension) method.invoke(obj);
} catch (IllegalAccessException | InvocationTargetException e) { } catch (IllegalAccessException | InvocationTargetException e) {
BotLogger.error("Could not add ability", TAG, e); BotLogger.error("Could not add ability", TAG, e);
throw propagate(e); throw propagate(e);
} }
};
}
/**
* Invokes the method curried and retrieves its return {@link Ability}.
*
* @param obj an bot or extension that this method is invoked with
* @return a {@link Function} which returns the {@link Ability} returned by the given method
*/
private Function<? super Method, Ability> returnAbility(Object obj) {
return method -> {
try {
return (Ability) method.invoke(obj);
} catch (IllegalAccessException | InvocationTargetException e) {
BotLogger.error("Could not add ability", TAG, e);
throw propagate(e);
}
};
} }
/** /**
* Invokes the method and retrieves its returned Reply. * Invokes the method curried and retrieves its return {@link Reply}.
* *
* @param method a method that returns a reply * @param obj an bot or extension that this method is invoked with
* @return the reply returned by the method * @return a {@link Function} which returns the {@link Reply} returned by the given method
*/ */
private Reply returnReply(Method method) { private Function<? super Method, Reply> returnReply(Object obj) {
return method -> {
try { try {
return (Reply) method.invoke(this); return (Reply) method.invoke(obj);
} catch (IllegalAccessException | InvocationTargetException e) { } catch (IllegalAccessException | InvocationTargetException e) {
BotLogger.error("Could not add reply", TAG, e); BotLogger.error("Could not add ability", TAG, e);
throw propagate(e); throw propagate(e);
} }
};
} }
private void postConsumption(Pair<MessageContext, Ability> pair) { private void postConsumption(Pair<MessageContext, Ability> pair) {

View File

@ -0,0 +1,7 @@
package org.telegram.abilitybots.api.util;
/**
* An interface to mark a class as an extension. Similar to when a method returns an Ability, it is added to the bot, a method which returns an AbilityExtension will add all Abilities or Replies from this Extension to the bot.
*/
public interface AbilityExtension {
}