Add .json state storage

This commit is contained in:
zotan 2018-02-08 08:00:36 +01:00
parent ff0b309b6d
commit 7b9efdf002
No known key found for this signature in database
GPG key ID: A8DA209231E36475
8 changed files with 59 additions and 460 deletions

4
.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
.idea/
config.json
bin/
obj/

View file

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ContentModelStore">
<e p="$USER_HOME$/.Rider2017.3/system/resharper-host/local/Transient/ReSharperHost/v11/SolutionCaches/_TelegramRemindMe.906015204.00" t="ExcludeRecursive" />
<e p="$PROJECT_DIR$" t="IncludeRecursive">
<e p="ChatEntry.cs" t="Include" />
<e p="ReminderBot.cs" t="Include" />
<e p="TelegramRemindMe.csproj" t="IncludeRecursive" />
<e p="TelegramRemindMe.sln" t="IncludeFlat" />
<e p="bin" t="ExcludeRecursive" />
<e p="obj" t="ExcludeRecursive">
<e p="Debug" t="Include">
<e p="netcoreapp2.0" t="Include">
<e p="TelegramRemindMe.AssemblyInfo.cs" t="Include" />
</e>
</e>
</e>
<e p="packages" t="ExcludeRecursive" />
</e>
</component>
</project>

View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ContentModelUserStore">
<explicitIncludes />
<explicitExcludes />
</component>
</project>

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/.idea.TelegramRemindMe/riderModule.iml" filepath="$PROJECT_DIR$/.idea/.idea.TelegramRemindMe/riderModule.iml" />
</modules>
</component>
</project>

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View file

@ -1,398 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="e84d6f8d-d18c-4b5e-b283-5588f0c5d8fe" name="Default" comment="">
<change beforePath="" afterPath="$PROJECT_DIR$/.idea/.idea.TelegramRemindMe/.idea/contentModel.xml" />
<change beforePath="" afterPath="$PROJECT_DIR$/.idea/.idea.TelegramRemindMe/.idea/indexLayout.xml" />
<change beforePath="" afterPath="$PROJECT_DIR$/.idea/.idea.TelegramRemindMe/.idea/modules.xml" />
<change beforePath="" afterPath="$PROJECT_DIR$/.idea/.idea.TelegramRemindMe/.idea/vcs.xml" />
<change beforePath="" afterPath="$PROJECT_DIR$/.idea/.idea.TelegramRemindMe/riderModule.iml" />
<change beforePath="" afterPath="$PROJECT_DIR$/ChatEntry.cs" />
<change beforePath="$PROJECT_DIR$/Program.cs" afterPath="$PROJECT_DIR$/ReminderBot.cs" />
<change beforePath="$PROJECT_DIR$/TelegramRemindMe.csproj" afterPath="$PROJECT_DIR$/TelegramRemindMe.csproj" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" 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="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="675">
<file leaf-file-name="ReminderBot.cs" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/ReminderBot.cs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="306">
<caret line="193" column="13" lean-forward="true" selection-start-line="193" selection-start-column="13" selection-end-line="193" selection-end-column="13" />
<folding>
<marker date="1518030794924" expanded="false" signature="6:257" ph="..." />
<marker date="1518030794924" expanded="true" signature="285:9850" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="323:9848" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="584:1223" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="778:901" ph="/* Bot.OnInlineQuery += BotOnInlineQueryReceived; ... */" />
<marker date="1518030794924" expanded="true" signature="1329:3920" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="1768:2958" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="2183:2675" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="2715:2846" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="3012:3910" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="4056:7262" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="4636:7252" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="5351:5459" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="7350:9519" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="7437:7855" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="7477:7660" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="7700:7841" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="8262:8488" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="8329:8474" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="8505:8732" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="8597:8718" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="8854:9280" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="9297:9509" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="9626:9842" ph="{...}" />
</folding>
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FindInProjectRecents">
<findStrings>
<find>received action</find>
<find>successfi</find>
<find>list task</find>
<find>reminders</find>
<find>delete</find>
<find>success</find>
<find>task added succ</find>
<find>Set a task as completed</find>
<find>foreach</find>
<find>isworkingm</find>
<find>complete</find>
<find>invalid inp</find>
<find>== 0</find>
<find>set a task</find>
<find>5000</find>
<find>doo</find>
</findStrings>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="HighlightingSettingsPerFile">
<setting file="file://$PROJECT_DIR$/ChatEntry.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/ReminderBot.cs" root0="FORCE_HIGHLIGHTING" />
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/Program.cs" />
<option value="$PROJECT_DIR$/User.cs" />
<option value="$PROJECT_DIR$/Task.cs" />
<option value="$PROJECT_DIR$/TaskList.cs" />
<option value="$PROJECT_DIR$/Chat.cs" />
<option value="$PROJECT_DIR$/ChatItem.cs" />
<option value="$PROJECT_DIR$/Emoji.cs" />
<option value="$PROJECT_DIR$/ChatEntry.cs" />
<option value="$PROJECT_DIR$/ReminderBot.cs" />
</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="1540" />
<option name="y" value="57" />
<option name="width" value="1400" />
<option name="height" value="1000" />
</component>
<component name="ProjectLevelVcsManager">
<ConfirmationsSetting value="2" id="Add" />
</component>
<component name="ProjectView">
<navigator currentView="SolutionExplorer" proportions="" version="1">
<flattenPackages />
<showMembers />
<showModules />
<showLibraryContents />
<hideEmptyPackages />
<abbreviatePackageNames />
<autoscrollToSource />
<autoscrollFromSource />
<sortByType />
<manualOrder />
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scratches" />
<pane id="SolutionExplorer">
<subPane>
<expand>
<path>
<item name="" type="13324e5d:SolutionExplorerViewPane$ProjectViewPaneTreeStructure$createRoot$1" />
<item name="TelegramRemindMe (1 project)" type="977d5f41:SolutionExplorerNodeRider" />
</path>
<path>
<item name="" type="13324e5d:SolutionExplorerViewPane$ProjectViewPaneTreeStructure$createRoot$1" />
<item name="TelegramRemindMe (1 project)" type="977d5f41:SolutionExplorerNodeRider" />
<item name="TelegramRemindMe" type="977d5f41:SolutionExplorerNodeRider" />
</path>
</expand>
<select />
</subPane>
<option name="show-file-system" value="false" />
<option name="show-all-items" value="false" />
</pane>
</panes>
</component>
<component name="PropertiesComponent">
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="settings.editor.selected.configurable" value="reference.settingsdialog.IDE.editor.colors.Color Scheme Font" />
</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="Default" type="DotNetProject" factoryName=".NET Project">
<option name="EXE_PATH" value="$PROJECT_DIR$/bin/Debug/netcoreapp2.0/TelegramRemindMe.dll" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="PASS_PARENT_ENVS" value="1" />
<envs>
<env name="ASPNETCORE_ENVIRONMENT" value="Development" />
<env name="ASPNETCORE_URLS" value="http://localhost:5000" />
</envs>
<option name="USE_MONO" value="0" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="PROJECT_PATH" value="$PROJECT_DIR$/TelegramRemindMe.csproj" />
<option name="PROJECT_EXE_PATH_TRACKING" value="1" />
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="1" />
<option name="PROJECT_KIND" value="DotNetCore" />
<option name="PROJECT_TFM" value=".NETCoreApp,Version=v2.0" />
<browser url="http://localhost:5000" />
</configuration>
</component>
<component name="ShelveChangesManager" show_recycled="false">
<option name="remove_strategy" value="false" />
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="e84d6f8d-d18c-4b5e-b283-5588f0c5d8fe" name="Default" comment="" />
<created>1518017570500</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1518017570500</updated>
<workItem from="1518017573234" duration="768000" />
<workItem from="1518018367402" duration="24000" />
<workItem from="1518018476844" duration="10188000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="10980000" />
</component>
<component name="TodoView">
<todo-panel id="selected-file">
<is-autoscroll-to-source value="true" />
</todo-panel>
<todo-panel id="all">
<are-packages-shown value="true" />
<is-autoscroll-to-source value="true" />
</todo-panel>
</component>
<component name="ToolWindowManager">
<frame x="1280" y="34" width="1920" height="1046" extended-state="6" />
<layout>
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Errors In Solution" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Unit Tests" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32869378" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32939914" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="NuGet" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.2027897" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.11354167" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Docker" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Build" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32869378" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
</layout>
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" />
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager />
<watches-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/ReminderBot.cs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<marker date="1518030794924" expanded="false" signature="6:257" ph="..." />
<marker date="1518030794924" expanded="true" signature="285:9850" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="323:9848" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="584:1223" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="778:901" ph="/* Bot.OnInlineQuery += BotOnInlineQueryReceived; ... */" />
<marker date="1518030794924" expanded="true" signature="1329:3920" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="1768:2958" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="2183:2675" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="2715:2846" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="3012:3910" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="4056:7262" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="4636:7252" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="5351:5459" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="7350:9519" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="7437:7855" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="7477:7660" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="7700:7841" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="8262:8488" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="8329:8474" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="8505:8732" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="8597:8718" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="8854:9280" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="9297:9509" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="9626:9842" ph="{...}" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/ReminderBot.cs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="858">
<caret line="37" column="7" lean-forward="false" selection-start-line="37" selection-start-column="7" selection-end-line="37" selection-end-column="7" />
<folding>
<marker date="1518030794924" expanded="false" signature="6:257" ph="..." />
<marker date="1518030794924" expanded="true" signature="285:9850" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="323:9848" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="584:1223" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="778:901" ph="/* Bot.OnInlineQuery += BotOnInlineQueryReceived; ... */" />
<marker date="1518030794924" expanded="true" signature="1329:3920" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="1768:2958" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="2183:2675" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="2715:2846" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="3012:3910" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="4056:7262" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="4636:7252" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="5351:5459" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="7350:9519" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="7437:7855" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="7477:7660" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="7700:7841" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="8262:8488" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="8329:8474" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="8505:8732" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="8597:8718" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="8854:9280" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="9297:9509" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="9626:9842" ph="{...}" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Task.cs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="38">
<caret line="2" column="29" lean-forward="false" selection-start-line="2" selection-start-column="29" selection-end-line="2" selection-end-column="29" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/TaskList.cs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="76">
<caret line="4" column="4" lean-forward="false" selection-start-line="4" selection-start-column="4" selection-end-line="4" selection-end-column="4" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Emoji.cs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="34">
<caret line="2" column="29" lean-forward="false" selection-start-line="2" selection-start-column="29" selection-end-line="2" selection-end-column="29" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/ChatEntry.cs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="170">
<caret line="11" column="56" lean-forward="false" selection-start-line="11" selection-start-column="56" selection-end-line="11" selection-end-column="56" />
<folding>
<marker date="1518029985375" expanded="true" signature="61:893" ph="{...}" />
<marker date="1518029985375" expanded="true" signature="90:554" ph="{...}" />
<marker date="1518029985375" expanded="true" signature="499:548" ph="{...}" />
<marker date="1518029985375" expanded="true" signature="586:666" ph="{...}" />
<marker date="1518029985375" expanded="true" signature="694:891" ph="{...}" />
<marker date="1518029985375" expanded="true" signature="838:885" ph="{...}" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/ReminderBot.cs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="306">
<caret line="193" column="13" lean-forward="true" selection-start-line="193" selection-start-column="13" selection-end-line="193" selection-end-column="13" />
<folding>
<marker date="1518030794924" expanded="false" signature="6:257" ph="..." />
<marker date="1518030794924" expanded="true" signature="285:9850" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="323:9848" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="584:1223" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="778:901" ph="/* Bot.OnInlineQuery += BotOnInlineQueryReceived; ... */" />
<marker date="1518030794924" expanded="true" signature="1329:3920" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="1768:2958" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="2183:2675" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="2715:2846" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="3012:3910" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="4056:7262" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="4636:7252" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="5351:5459" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="7350:9519" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="7437:7855" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="7477:7660" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="7700:7841" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="8262:8488" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="8329:8474" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="8505:8732" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="8597:8718" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="8854:9280" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="9297:9509" ph="{...}" />
<marker date="1518030794924" expanded="true" signature="9626:9842" ph="{...}" />
</folding>
</state>
</provider>
</entry>
</component>
</project>

View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="RIDER_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$/../.." />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View file

@ -1,4 +1,5 @@
using System;
using
System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -8,12 +9,13 @@ using Telegram.Bot.Args;
using Telegram.Bot.Types;
using Telegram.Bot.Types.Enums;
using Telegram.Bot.Types.ReplyMarkups;
using Newtonsoft.Json;
namespace TelegramRemindMe
{
public static class ReminderBot
{
private static readonly List<ChatEntry> Chats = new List<ChatEntry>();
private static List<ChatEntry> _chats = new List<ChatEntry>();
private static readonly TelegramBotClient Bot =
new TelegramBotClient("511835815:AAHewCgiXep58wF6tDWIW133LhfqjCbb8c4");
@ -26,7 +28,9 @@ namespace TelegramRemindMe
//Bot.OnInlineQuery += BotOnInlineQueryReceived;
//Bot.OnInlineResultChosen += BotOnChosenInlineResultReceived;
Bot.OnReceiveError += BotOnReceiveError;
if(!System.IO.File.Exists("config.json"))
SaveToJson(_chats);
_chats = ReadJson();
var me = Bot.GetMeAsync().Result;
Console.Title = me.Username;
@ -43,10 +47,10 @@ namespace TelegramRemindMe
if (message == null || message.Type != MessageType.Text) return;
if (Chats.Find(e => e.ChatId == messageEventArgs.Message.Chat.Id) == null)
Chats.Add(new ChatEntry(messageEventArgs.Message.Chat.Id));
if (_chats.Find(e => e.ChatId == messageEventArgs.Message.Chat.Id) == null)
_chats.Add(new ChatEntry(messageEventArgs.Message.Chat.Id));
var currentChat = Chats.Find(e => e.ChatId == messageEventArgs.Message.Chat.Id);
var currentChat = _chats.Find(e => e.ChatId == messageEventArgs.Message.Chat.Id);
switch (currentChat.status)
{
@ -103,10 +107,10 @@ namespace TelegramRemindMe
Console.WriteLine(
$"Received action request from @{callbackQueryEventArgs.CallbackQuery.Message.Chat.Username}: {callbackQueryEventArgs.CallbackQuery.Data}");
if (Chats.Find(e => e.ChatId == callbackQueryEventArgs.CallbackQuery.Message.Chat.Id) == null)
Chats.Add(new ChatEntry(callbackQueryEventArgs.CallbackQuery.Message.Chat.Id));
if (_chats.Find(e => e.ChatId == callbackQueryEventArgs.CallbackQuery.Message.Chat.Id) == null)
_chats.Add(new ChatEntry(callbackQueryEventArgs.CallbackQuery.Message.Chat.Id));
var currentChat = Chats.Find(e => e.ChatId == callbackQueryEventArgs.CallbackQuery.Message.Chat.Id);
var currentChat = _chats.Find(e => e.ChatId == callbackQueryEventArgs.CallbackQuery.Message.Chat.Id);
switch (callbackQueryEventArgs.CallbackQuery.Data)
{
@ -140,14 +144,16 @@ namespace TelegramRemindMe
currentChat.IsWorkingMessage = true;
currentChat.WorkingMsg = callbackQueryEventArgs.CallbackQuery.Message.MessageId;
SendOverview(currentChat);
currentChat.WorkingMsg = callbackQueryEventArgs.CallbackQuery.Message.MessageId;Bot.AnswerCallbackQueryAsync(callbackQueryEventArgs.CallbackQuery.Id, "Showing all tasks");
currentChat.WorkingMsg = callbackQueryEventArgs.CallbackQuery.Message.MessageId;
await Bot.AnswerCallbackQueryAsync(callbackQueryEventArgs.CallbackQuery.Id, "Showing all tasks");
break;
case "Hide completed tasks":
currentChat.AllTasksShown = false;
currentChat.IsWorkingMessage = true;
currentChat.WorkingMsg = callbackQueryEventArgs.CallbackQuery.Message.MessageId;
SendOverview(currentChat);
await Bot.AnswerCallbackQueryAsync(callbackQueryEventArgs.CallbackQuery.Id, "Showing only uncompleted tasks");
await Bot.AnswerCallbackQueryAsync(callbackQueryEventArgs.CallbackQuery.Id,
"Showing only uncompleted tasks");
break;
default:
Console.WriteLine("Wat (Unknown callback action)");
@ -160,21 +166,24 @@ namespace TelegramRemindMe
private static async void SendOverview(ChatEntry chat, string prefixLine = "")
{
SaveToJson(_chats);
var actionKeyboard = new InlineKeyboardMarkup(new[]
{
new[]
{
InlineKeyboardButton.WithCallbackData("Add a new task"),
InlineKeyboardButton.WithCallbackData("Set a task as completed"),
InlineKeyboardButton.WithCallbackData("Set a task as completed"),
},
new[]
{
InlineKeyboardButton.WithCallbackData(chat.AllTasksShown ? "Hide completed tasks" : "Show all tasks")
InlineKeyboardButton.WithCallbackData(
chat.AllTasksShown ? "Hide completed tasks" : "Show all tasks")
}
});
await Bot.SendChatActionAsync(chat.ChatId, ChatAction.Typing);
//TODO: why is this firing when workingmsg already deleted?
if (chat.IsWorkingMessage)
await Bot.DeleteMessageAsync(chat.ChatId, chat.WorkingMsg);
@ -228,5 +237,38 @@ namespace TelegramRemindMe
receiveErrorEventArgs.ApiRequestException.ErrorCode,
receiveErrorEventArgs.ApiRequestException.Message);
}
private static void SaveToJson(List<ChatEntry> chats)
{
var str = JsonConvert.SerializeObject(chats);
while (true)
{
try
{
System.IO.File.WriteAllText("config.json", str);
break;
}
catch
{
Console.WriteLine("Unable to write to config.json, retrying...");
}
}
}
private static List<ChatEntry> ReadJson()
{
while (true)
{
try
{
var str = System.IO.File.ReadAllText("config.json");
return JsonConvert.DeserializeObject<List<ChatEntry>>(str);
}
catch
{
Console.WriteLine("Unable to read from config.json, retrying...");
}
}
}
}
}