Bot is nearly finished, database file is still missing and api errors aren't catched

This commit is contained in:
zotan 2018-02-07 20:26:19 +01:00
parent 4b4e33865e
commit ff0b309b6d
No known key found for this signature in database
GPG key ID: A8DA209231E36475
10 changed files with 717 additions and 200 deletions

View file

@ -0,0 +1,21 @@
<?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

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

View file

@ -0,0 +1,8 @@
<?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

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

View file

@ -0,0 +1,398 @@
<?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

@ -0,0 +1,7 @@
<?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>

37
ChatEntry.cs Normal file
View file

@ -0,0 +1,37 @@
using System.Collections.Generic;
namespace TelegramRemindMe
{
public class ChatEntry
{
public long ChatId { get; }
public List<TaskEntry> _tasklist { get; set; } = new List<TaskEntry>();
public ChatStatusEnum status { get; set; } = ChatStatusEnum.Idle;
public bool IsWorkingMessage { get; set; } = false;
public int WorkingMsg { get; set; } = 0;
public bool AllTasksShown { get; set; } = false;
public ChatEntry(long chatId)
{
ChatId = chatId;
}
}
public enum ChatStatusEnum
{
Idle,
WaitingTaskTitle,
WaitingTaskComplete
}
public class TaskEntry
{
public bool Completed { get; set; } = false;
public string Title { get; }
public TaskEntry(string title)
{
Title = title;
}
}
}

View file

@ -1,200 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Telegram.Bot;
using Telegram.Bot.Args;
using Telegram.Bot.Types;
using Telegram.Bot.Types.Enums;
using Telegram.Bot.Types.InlineQueryResults;
using Telegram.Bot.Types.ReplyMarkups;
namespace TelegramRemindMe
{
public static class Program
{
//TODO: multiuser uwu
private static bool isAddingTask = false;
private static List<string> tasks = new List<string>();
private static readonly TelegramBotClient Bot = new TelegramBotClient("511835815:AAHewCgiXep58wF6tDWIW133LhfqjCbb8c4");
public static void Main(string[] args)
{
Bot.OnMessage += BotOnMessageReceived;
Bot.OnMessageEdited += BotOnMessageReceived;
Bot.OnCallbackQuery += BotOnCallbackQueryReceived;
Bot.OnInlineQuery += BotOnInlineQueryReceived;
Bot.OnInlineResultChosen += BotOnChosenInlineResultReceived;
Bot.OnReceiveError += BotOnReceiveError;
var me = Bot.GetMeAsync().Result;
Console.Title = me.Username;
Bot.StartReceiving();
Console.WriteLine($"Start listening for @{me.Username}");
Console.ReadLine();
Bot.StopReceiving();
}
private static async void BotOnMessageReceived(object sender, MessageEventArgs messageEventArgs)
{
var message = messageEventArgs.Message;
if (message == null || message.Type != MessageType.Text) return;
//IReplyMarkup keyboard = new ReplyKeyboardRemove();
var actionKeyboard = new InlineKeyboardMarkup(new[]
{
new []
{
InlineKeyboardButton.WithCallbackData("Add a new task"),
InlineKeyboardButton.WithCallbackData("List tasks"),
},
new []
{
InlineKeyboardButton.WithCallbackData("Add a new reminder"),
InlineKeyboardButton.WithCallbackData("List reminders"),
}
});
switch (message.Text.Split(' ').First())
{
case "/start":
case "/do":
case "/actions":
case "/help":
await Bot.SendChatActionAsync(message.Chat.Id, ChatAction.Typing);
//await Task.Delay(500);
await Bot.SendTextMessageAsync(
message.Chat.Id,
"What do you want me to do?",
replyMarkup: actionKeyboard);
break;
case "/echo":
await Bot.SendChatActionAsync(message.Chat.Id, ChatAction.RecordVideoNote);
await Task.Delay(500);
await Bot.SendChatActionAsync(message.Chat.Id, ChatAction.UploadDocument);
await Task.Delay(500);
await Bot.SendChatActionAsync(message.Chat.Id, ChatAction.RecordAudio);
await Task.Delay(500);
await Bot.SendChatActionAsync(message.Chat.Id, ChatAction.Typing);
await Task.Delay(500);
await Bot.SendTextMessageAsync(
message.Chat.Id,
"MEOW" + message.Text.Substring(5));
break;
default:
if (isAddingTask)
{
tasks.Add(message.Text);
await Bot.SendTextMessageAsync(
message.Chat.Id,
"Added. Anything else?",
replyMarkup: actionKeyboard);
}
break;
}
}
private static async void BotOnCallbackQueryReceived(object sender, CallbackQueryEventArgs callbackQueryEventArgs)
{
Console.WriteLine($"Received action request: {callbackQueryEventArgs.CallbackQuery.Data}");
switch (callbackQueryEventArgs.CallbackQuery.Data)
{
case "Add a new task":
await Bot.EditMessageTextAsync(
new ChatId(callbackQueryEventArgs.CallbackQuery.Message.Chat.Id),
callbackQueryEventArgs.CallbackQuery.Message.MessageId,
"Which task should I add?"
);
isAddingTask = true;
break;
case "List tasks":
var sb = new StringBuilder();
sb.AppendLine("Your tasks:");
foreach (var task in tasks)
{
sb.Append("[ ] ");
sb.AppendLine(task);
}
await Bot.EditMessageTextAsync(
new ChatId(callbackQueryEventArgs.CallbackQuery.Message.Chat.Id),
callbackQueryEventArgs.CallbackQuery.Message.MessageId,
sb.ToString()
);
break;
default:
Console.WriteLine("Wat (Unknown callback action)");
await Bot.AnswerCallbackQueryAsync(
callbackQueryEventArgs.CallbackQuery.Id,
"Wat");
break;
}
//await Bot.AnswerCallbackQueryAsync(
// callbackQueryEventArgs.CallbackQuery.Id,
// $"Received {callbackQueryEventArgs.CallbackQuery.Data}");
}
private static async void BotOnInlineQueryReceived(object sender, InlineQueryEventArgs inlineQueryEventArgs)
{
Console.WriteLine($"Received inline query from: {inlineQueryEventArgs.InlineQuery.From.Id}");
InlineQueryResultBase[] results = {
new InlineQueryResultLocation
{
Id = "1",
Latitude = 40.7058316f, // displayed result
Longitude = -74.2581888f,
Title = "New York",
InputMessageContent = new InputLocationMessageContent // message if result is selected
{
Latitude = 40.7058316f,
Longitude = -74.2581888f,
}
},
new InlineQueryResultLocation
{
Id = "2",
Longitude = 52.507629f, // displayed result
Latitude = 13.1449577f,
Title = "Berlin",
InputMessageContent = new InputLocationMessageContent // message if result is selected
{
Longitude = 52.507629f,
Latitude = 13.1449577f
}
}
};
await Bot.AnswerInlineQueryAsync(
inlineQueryEventArgs.InlineQuery.Id,
results,
isPersonal: true,
cacheTime: 0);
}
private static void BotOnChosenInlineResultReceived(object sender, ChosenInlineResultEventArgs chosenInlineResultEventArgs)
{
Console.WriteLine($"Received inline result: {chosenInlineResultEventArgs.ChosenInlineResult.ResultId}");
}
private static void BotOnReceiveError(object sender, ReceiveErrorEventArgs receiveErrorEventArgs)
{
Console.WriteLine("Received error: {0} — {1}",
receiveErrorEventArgs.ApiRequestException.ErrorCode,
receiveErrorEventArgs.ApiRequestException.Message);
}
}
}

232
ReminderBot.cs Normal file
View file

@ -0,0 +1,232 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Telegram.Bot;
using Telegram.Bot.Args;
using Telegram.Bot.Types;
using Telegram.Bot.Types.Enums;
using Telegram.Bot.Types.ReplyMarkups;
namespace TelegramRemindMe
{
public static class ReminderBot
{
private static readonly List<ChatEntry> Chats = new List<ChatEntry>();
private static readonly TelegramBotClient Bot =
new TelegramBotClient("511835815:AAHewCgiXep58wF6tDWIW133LhfqjCbb8c4");
public static void Main()
{
Bot.OnMessage += BotOnMessageReceived;
Bot.OnMessageEdited += BotOnMessageReceived;
Bot.OnCallbackQuery += BotOnCallbackQueryReceived;
//Bot.OnInlineQuery += BotOnInlineQueryReceived;
//Bot.OnInlineResultChosen += BotOnChosenInlineResultReceived;
Bot.OnReceiveError += BotOnReceiveError;
var me = Bot.GetMeAsync().Result;
Console.Title = me.Username;
Bot.StartReceiving();
Console.WriteLine($"Start listening for @{me.Username}");
Console.ReadLine();
Bot.StopReceiving();
}
private static async void BotOnMessageReceived(object sender, MessageEventArgs messageEventArgs)
{
var message = messageEventArgs.Message;
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));
var currentChat = Chats.Find(e => e.ChatId == messageEventArgs.Message.Chat.Id);
switch (currentChat.status)
{
case ChatStatusEnum.WaitingTaskTitle:
currentChat._tasklist.Add(new TaskEntry(message.Text));
await Bot.SendChatActionAsync(message.Chat.Id, ChatAction.Typing);
SendOverview(currentChat, "Task added successfully!");
return;
case ChatStatusEnum.WaitingTaskComplete:
try
{
var completedItem = int.Parse(message.Text);
if (completedItem < 1 || completedItem > currentChat._tasklist.Count(p => !p.Completed))
throw new ArgumentOutOfRangeException();
currentChat._tasklist.FindAll(p => !p.Completed)[completedItem - 1].Completed = true;
SendOverview(currentChat, "Task has been set as completed.");
}
catch (Exception e)
{
SendOverview(currentChat, $"🛑 Invalid input! [{e.Message}]");
}
return;
case ChatStatusEnum.Idle:
break;
}
switch (message.Text.Split(' ').First())
{
default:
SendOverview(currentChat);
break;
case "/echo":
await Bot.SendChatActionAsync(message.Chat.Id, ChatAction.RecordVideoNote);
await Task.Delay(500);
await Bot.SendChatActionAsync(message.Chat.Id, ChatAction.UploadDocument);
await Task.Delay(500);
await Bot.SendChatActionAsync(message.Chat.Id, ChatAction.RecordAudio);
await Task.Delay(500);
await Bot.SendChatActionAsync(message.Chat.Id, ChatAction.Typing);
await Task.Delay(500);
await Bot.SendTextMessageAsync(
message.Chat.Id,
"MEOW, you woke me up!" + message.Text.Substring(5));
break;
}
}
private static async void BotOnCallbackQueryReceived(object sender,
CallbackQueryEventArgs callbackQueryEventArgs)
{
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));
var currentChat = Chats.Find(e => e.ChatId == callbackQueryEventArgs.CallbackQuery.Message.Chat.Id);
switch (callbackQueryEventArgs.CallbackQuery.Data)
{
case "Add a new task":
currentChat.IsWorkingMessage = true;
currentChat.WorkingMsg = Bot.EditMessageTextAsync(
new ChatId(currentChat.ChatId), callbackQueryEventArgs.CallbackQuery.Message.MessageId,
"How should your new task be called?"
).Result.MessageId;
currentChat.status = ChatStatusEnum.WaitingTaskTitle;
break;
case "Set a task as completed":
var sb = new StringBuilder();
var i = 0;
foreach (var entry in currentChat._tasklist.Where(p => !p.Completed))
{
sb.AppendLine($"{++i}) {entry.Title}");
}
sb.AppendLine();
sb.AppendLine("Send me the number of the task you want to complete.");
currentChat.IsWorkingMessage = true;
currentChat.WorkingMsg =
Bot.EditMessageTextAsync(currentChat.ChatId,
callbackQueryEventArgs.CallbackQuery.Message.MessageId, sb.ToString()).Result.MessageId;
currentChat.status = ChatStatusEnum.WaitingTaskComplete;
break;
case "Show all tasks":
currentChat.AllTasksShown = true;
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");
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");
break;
default:
Console.WriteLine("Wat (Unknown callback action)");
await Bot.AnswerCallbackQueryAsync(
callbackQueryEventArgs.CallbackQuery.Id,
"Wat");
break;
}
}
private static async void SendOverview(ChatEntry chat, string prefixLine = "")
{
var actionKeyboard = new InlineKeyboardMarkup(new[]
{
new[]
{
InlineKeyboardButton.WithCallbackData("Add a new task"),
InlineKeyboardButton.WithCallbackData("Set a task as completed"),
},
new[]
{
InlineKeyboardButton.WithCallbackData(chat.AllTasksShown ? "Hide completed tasks" : "Show all tasks")
}
});
await Bot.SendChatActionAsync(chat.ChatId, ChatAction.Typing);
if (chat.IsWorkingMessage)
await Bot.DeleteMessageAsync(chat.ChatId, chat.WorkingMsg);
chat.IsWorkingMessage = false;
chat.status = ChatStatusEnum.Idle;
var sb = new StringBuilder();
sb.AppendLine("Your tasks:");
if (chat.AllTasksShown)
{
foreach (var task in chat._tasklist)
{
sb.Append(task.Completed ? "✅ " : "🔶 ");
sb.AppendLine(task.Title);
}
}
else
{
foreach (var task in chat._tasklist.Where(p => !p.Completed))
{
sb.Append("🔶 ");
sb.AppendLine(task.Title);
}
}
sb.AppendLine();
sb.AppendLine("What do you want me to do?");
if (prefixLine != "")
{
var msgid = Bot.SendTextMessageAsync(
chat.ChatId,
prefixLine)
.Result.MessageId;
await Bot.SendChatActionAsync(chat.ChatId, ChatAction.Typing);
await Task.Delay(1500);
await Bot.EditMessageTextAsync(chat.ChatId, msgid, sb.ToString(), replyMarkup: actionKeyboard);
}
else
{
await Bot.SendChatActionAsync(chat.ChatId, ChatAction.Typing);
await Bot.SendTextMessageAsync(chat.ChatId, sb.ToString(), replyMarkup: actionKeyboard);
}
}
private static void BotOnReceiveError(object sender, ReceiveErrorEventArgs receiveErrorEventArgs)
{
Console.WriteLine("Received error: {0} — {1}",
receiveErrorEventArgs.ApiRequestException.ErrorCode,
receiveErrorEventArgs.ApiRequestException.Message);
}
}
}

View file

@ -4,6 +4,7 @@
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="Telegram.Bot" Version="14.0.0-rc-367" />
</ItemGroup>
</Project>