add dependencys
fixing tiny stuff so its up to date add .gitignore
This commit is contained in:
parent
04e226fd4a
commit
b498114f48
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
/packages
|
||||||
|
/.vs
|
||||||
|
/ConnectorUserTelegram/obj
|
||||||
|
/ConnectorUserTelegram/bin
|
@ -1,31 +1,37 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 15
|
# Visual Studio 15
|
||||||
VisualStudioVersion = 15.0.28307.136
|
VisualStudioVersion = 15.0.28307.136
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConnectorUserTelegram", "ConnectorUserTelegram\ConnectorUserTelegram.csproj", "{E66A57DD-858A-40E4-8A2F-BEA5129C31F7}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConnectorUserTelegram", "ConnectorUserTelegram\ConnectorUserTelegram.csproj", "{E66A57DD-858A-40E4-8A2F-BEA5129C31F7}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils-IoT", "..\Utils-IoT\Utils-IoT\Utils-IoT.csproj", "{B870E4D5-6806-4A0B-B233-8907EEDC5AFC}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils-IoT", "..\Utils-IoT\Utils-IoT\Utils-IoT.csproj", "{B870E4D5-6806-4A0B-B233-8907EEDC5AFC}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "litjson_4.7.1", "..\..\Librarys\litjson\litjson\litjson_4.7.1.csproj", "{91A14CD2-2940-4500-8193-56D37EDDDBAA}"
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
EndProject
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Global
|
||||||
Release|Any CPU = Release|Any CPU
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
EndGlobalSection
|
Debug|Any CPU = Debug|Any CPU
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
Release|Any CPU = Release|Any CPU
|
||||||
{E66A57DD-858A-40E4-8A2F-BEA5129C31F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
EndGlobalSection
|
||||||
{E66A57DD-858A-40E4-8A2F-BEA5129C31F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{E66A57DD-858A-40E4-8A2F-BEA5129C31F7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{E66A57DD-858A-40E4-8A2F-BEA5129C31F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{E66A57DD-858A-40E4-8A2F-BEA5129C31F7}.Release|Any CPU.Build.0 = Release|Any CPU
|
{E66A57DD-858A-40E4-8A2F-BEA5129C31F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{E66A57DD-858A-40E4-8A2F-BEA5129C31F7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{E66A57DD-858A-40E4-8A2F-BEA5129C31F7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Release|Any CPU.Build.0 = Release|Any CPU
|
{B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
EndGlobalSection
|
{B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
{B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
HideSolutionNode = FALSE
|
{91A14CD2-2940-4500-8193-56D37EDDDBAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
EndGlobalSection
|
{91A14CD2-2940-4500-8193-56D37EDDDBAA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
{91A14CD2-2940-4500-8193-56D37EDDDBAA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
SolutionGuid = {7C826771-09A9-44C6-BC5F-E7E8BABFD2A3}
|
{91A14CD2-2940-4500-8193-56D37EDDDBAA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {7C826771-09A9-44C6-BC5F-E7E8BABFD2A3}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
|
@ -1,120 +1,76 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProjectGuid>{E66A57DD-858A-40E4-8A2F-BEA5129C31F7}</ProjectGuid>
|
<ProjectGuid>{E66A57DD-858A-40E4-8A2F-BEA5129C31F7}</ProjectGuid>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>BlubbFish.Utils.IoT.Connector.User</RootNamespace>
|
<RootNamespace>BlubbFish.Utils.IoT.Connector.User</RootNamespace>
|
||||||
<AssemblyName>ConnectorUserTelegram</AssemblyName>
|
<AssemblyName>ConnectorUserTelegram</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<TargetFrameworkProfile />
|
<TargetFrameworkProfile />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>bin\Debug\</OutputPath>
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Microsoft.Win32.Primitives, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System" />
|
||||||
<HintPath>..\..\..\..\packages\Microsoft.Win32.Primitives.4.3.0\lib\net46\Microsoft.Win32.Primitives.dll</HintPath>
|
<Reference Include="System.AppContext, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
</Reference>
|
<HintPath>..\..\..\..\packages\System.AppContext.4.3.0\lib\net46\System.AppContext.dll</HintPath>
|
||||||
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
<Private>True</Private>
|
||||||
<HintPath>..\..\..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
</Reference>
|
||||||
</Reference>
|
<Reference Include="System.ComponentModel.Composition" />
|
||||||
<Reference Include="System" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.AppContext, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.IO.Compression, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\..\..\packages\System.AppContext.4.3.0\lib\net46\System.AppContext.dll</HintPath>
|
<HintPath>..\..\..\..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.ComponentModel.Composition" />
|
<Reference Include="System.IO.Compression.FileSystem" />
|
||||||
<Reference Include="System.Console, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Net.Http" />
|
||||||
<HintPath>..\..\..\..\packages\System.Console.4.3.0\lib\net46\System.Console.dll</HintPath>
|
<Reference Include="System.Numerics" />
|
||||||
</Reference>
|
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<Reference Include="System.Core" />
|
<HintPath>..\..\..\..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
|
||||||
<Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Private>True</Private>
|
||||||
<HintPath>..\..\..\..\packages\System.Diagnostics.DiagnosticSource.4.3.0\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
|
</Reference>
|
||||||
</Reference>
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Globalization.Calendars, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
<HintPath>..\..\..\..\packages\System.Globalization.Calendars.4.3.0\lib\net46\System.Globalization.Calendars.dll</HintPath>
|
<Reference Include="Microsoft.CSharp" />
|
||||||
</Reference>
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.IO.Compression, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
<Reference Include="System.Xml" />
|
||||||
<HintPath>..\..\..\..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll</HintPath>
|
<Reference Include="Telegram.Bot, Version=13.2.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<Private>True</Private>
|
<HintPath>..\packages\Telegram.Bot.13.2.1\lib\netstandard1.1\Telegram.Bot.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.IO.Compression.FileSystem" />
|
</ItemGroup>
|
||||||
<Reference Include="System.IO.Compression.ZipFile, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
<ItemGroup>
|
||||||
<HintPath>..\..\..\..\packages\System.IO.Compression.ZipFile.4.3.0\lib\net46\System.IO.Compression.ZipFile.dll</HintPath>
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</Reference>
|
<Compile Include="Telegram.cs" />
|
||||||
<Reference Include="System.IO.FileSystem, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
</ItemGroup>
|
||||||
<HintPath>..\..\..\..\packages\System.IO.FileSystem.4.3.0\lib\net46\System.IO.FileSystem.dll</HintPath>
|
<ItemGroup>
|
||||||
</Reference>
|
<ProjectReference Include="..\..\Utils-IoT\Utils-IoT\Utils-IoT.csproj">
|
||||||
<Reference Include="System.IO.FileSystem.Primitives, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Project>{b870e4d5-6806-4a0b-b233-8907eedc5afc}</Project>
|
||||||
<HintPath>..\..\..\..\packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll</HintPath>
|
<Name>Utils-IoT</Name>
|
||||||
</Reference>
|
</ProjectReference>
|
||||||
<Reference Include="System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
</ItemGroup>
|
||||||
<HintPath>..\..\..\..\packages\System.Net.Http.4.3.0\lib\net46\System.Net.Http.dll</HintPath>
|
<ItemGroup>
|
||||||
</Reference>
|
<None Include="app.config" />
|
||||||
<Reference Include="System.Net.Sockets, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<None Include="packages.config" />
|
||||||
<HintPath>..\..\..\..\packages\System.Net.Sockets.4.3.0\lib\net46\System.Net.Sockets.dll</HintPath>
|
</ItemGroup>
|
||||||
</Reference>
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<Reference Include="System.Numerics" />
|
|
||||||
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\..\..\..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
|
|
||||||
<Private>True</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\..\..\..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net461\System.Security.Cryptography.Algorithms.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\..\..\..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\..\..\..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\..\..\..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Xml.Linq" />
|
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
|
||||||
<Reference Include="Microsoft.CSharp" />
|
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
<Reference Include="System.Xml.ReaderWriter, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\..\..\..\packages\System.Xml.ReaderWriter.4.3.0\lib\net46\System.Xml.ReaderWriter.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Telegram.Bot, Version=13.2.1.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\..\..\..\packages\Telegram.Bot.13.2.1\lib\netstandard1.1\Telegram.Bot.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
<Compile Include="Telegram.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\..\..\Utils-IoT.csproj">
|
|
||||||
<Project>{b870e4d5-6806-4a0b-b233-8907eedc5afc}</Project>
|
|
||||||
<Name>Utils-IoT</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="app.config" />
|
|
||||||
<None Include="packages.config" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
</Project>
|
</Project>
|
@ -1,69 +1,73 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Telegram.Bot;
|
using BlubbFish.Utils.IoT.Events;
|
||||||
using Telegram.Bot.Args;
|
using Telegram.Bot;
|
||||||
using Telegram.Bot.Exceptions;
|
using Telegram.Bot.Args;
|
||||||
using Telegram.Bot.Types;
|
using Telegram.Bot.Exceptions;
|
||||||
using Telegram.Bot.Types.Enums;
|
using Telegram.Bot.Types;
|
||||||
using Telegram.Bot.Types.ReplyMarkups;
|
using Telegram.Bot.Types.Enums;
|
||||||
|
using Telegram.Bot.Types.ReplyMarkups;
|
||||||
namespace BlubbFish.Utils.IoT.Connector.User {
|
|
||||||
public class Telegram : AUserBackend {
|
namespace BlubbFish.Utils.IoT.Connector.User {
|
||||||
private TelegramBotClient bot;
|
public class Telegram : AUserBackend {
|
||||||
private ChatId chat;
|
private TelegramBotClient bot;
|
||||||
|
private ChatId chat;
|
||||||
public override event TelegramMessage MessageIncomming;
|
|
||||||
public override event TelegramMessage MessageSending;
|
public override Boolean IsConnected {
|
||||||
|
get {
|
||||||
public Telegram(Dictionary<String, String> settings) : base(settings) {
|
return true;
|
||||||
this.bot = new TelegramBotClient(settings["telegram-key"]);
|
}
|
||||||
this.bot.OnMessage += this.Bot_OnMessage;
|
}
|
||||||
this.Connect();
|
|
||||||
}
|
public Telegram(Dictionary<String, String> settings) : base(settings) {
|
||||||
|
this.bot = new TelegramBotClient(settings["telegram-key"]);
|
||||||
private void Bot_OnMessage(Object sender, MessageEventArgs e) {
|
this.bot.OnMessage += this.Bot_OnMessage;
|
||||||
this.MessageIncomming?.Invoke(this, new UserMessageEventArgs(e.Message.Text, e.Message.Chat.Id, e.Message.Date));
|
this.Connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Connect() {
|
private void Bot_OnMessage(Object sender, MessageEventArgs e) {
|
||||||
this.bot.StartReceiving();
|
this.NotifyClientIncomming(new UserEvent(e.Message.Text, e.Message.Chat.Id, e.Message.Date));
|
||||||
this.chat = new ChatId(this.settings["chatid"]);
|
}
|
||||||
}
|
|
||||||
|
private void Connect() {
|
||||||
public async override void Send(String message) {
|
this.bot.StartReceiving();
|
||||||
try {
|
this.chat = new ChatId(this.settings["chatid"]);
|
||||||
Message x = await this.bot.SendTextMessageAsync(this.chat, message, ParseMode.Default, false, false, 0, new ReplyKeyboardRemove());
|
}
|
||||||
this.MessageSending?.Invoke(this, new UserMessageEventArgs(x.Text, x.Chat.Id, x.Date));
|
|
||||||
} catch(ApiRequestException e) {
|
public async override void Send(String message) {
|
||||||
Console.ForegroundColor = ConsoleColor.Red;
|
try {
|
||||||
Console.WriteLine(e.Message+" "+e.ErrorCode+" "+e.Parameters);
|
Message x = await this.bot.SendTextMessageAsync(this.chat, message, ParseMode.Default, false, false, 0, new ReplyKeyboardRemove());
|
||||||
Console.ForegroundColor = ConsoleColor.White;
|
this.NotifyClientSending(new UserEvent(x.Text, x.Chat.Id, x.Date));
|
||||||
}
|
} catch(ApiRequestException e) {
|
||||||
|
Console.ForegroundColor = ConsoleColor.Red;
|
||||||
}
|
Console.WriteLine(e.Message+" "+e.ErrorCode+" "+e.Parameters);
|
||||||
|
Console.ForegroundColor = ConsoleColor.White;
|
||||||
public override void Dispose() {
|
}
|
||||||
this.bot.StopReceiving();
|
|
||||||
this.bot = null;
|
}
|
||||||
}
|
|
||||||
|
public override void Dispose() {
|
||||||
public async override void Send(String message, String[] buttons) {
|
this.bot.StopReceiving();
|
||||||
try {
|
this.bot = null;
|
||||||
KeyboardButton[][] button = new KeyboardButton[(Int32)Math.Ceiling(((Double)buttons.Length)/2)][];
|
}
|
||||||
for(Int32 i = 0; i < buttons.Length; i++) {
|
|
||||||
Int32 j = (Int32)Math.Floor(((Double)i) / 2);
|
public async override void Send(String message, String[] buttons) {
|
||||||
if (i % 2 == 0) {
|
try {
|
||||||
button[j] = new KeyboardButton[(j == button.Length - 1) ? ((buttons.Length % 2 == 0) ? 2 : buttons.Length % 2) : 2];
|
KeyboardButton[][] button = new KeyboardButton[(Int32)Math.Ceiling(((Double)buttons.Length)/2)][];
|
||||||
}
|
for(Int32 i = 0; i < buttons.Length; i++) {
|
||||||
button[j][i % 2] = new KeyboardButton(buttons[i]);
|
Int32 j = (Int32)Math.Floor(((Double)i) / 2);
|
||||||
}
|
if (i % 2 == 0) {
|
||||||
Message x = await this.bot.SendTextMessageAsync(this.chat, message, ParseMode.Default, false, false, 0, new ReplyKeyboardMarkup(button,true,true));
|
button[j] = new KeyboardButton[(j == button.Length - 1) ? ((buttons.Length % 2 == 0) ? 2 : buttons.Length % 2) : 2];
|
||||||
this.MessageSending?.Invoke(this, new UserMessageEventArgs(x.Text, x.Chat.Id, x.Date));
|
}
|
||||||
} catch (ApiRequestException e) {
|
button[j][i % 2] = new KeyboardButton(buttons[i]);
|
||||||
Console.ForegroundColor = ConsoleColor.Red;
|
}
|
||||||
Console.WriteLine(e.Message + " " + e.ErrorCode + " " + e.Parameters);
|
Message x = await this.bot.SendTextMessageAsync(this.chat, message, ParseMode.Default, false, false, 0, new ReplyKeyboardMarkup(button,true,true));
|
||||||
Console.ForegroundColor = ConsoleColor.White;
|
this.NotifyClientSending(new UserEvent(x.Text, x.Chat.Id, x.Date));
|
||||||
}
|
} catch (ApiRequestException e) {
|
||||||
}
|
Console.ForegroundColor = ConsoleColor.Red;
|
||||||
}
|
Console.WriteLine(e.Message + " " + e.ErrorCode + " " + e.Parameters);
|
||||||
}
|
Console.ForegroundColor = ConsoleColor.White;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user