diff --git a/ConnectorUserTelegram/ConnectorUserTelegram.sln b/ConnectorUserTelegram/ConnectorUserTelegram.sln deleted file mode 100644 index 4d412cd..0000000 --- a/ConnectorUserTelegram/ConnectorUserTelegram.sln +++ /dev/null @@ -1,31 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28307.136 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConnectorUserTelegram", "ConnectorUserTelegram\ConnectorUserTelegram.csproj", "{E66A57DD-858A-40E4-8A2F-BEA5129C31F7}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils-IoT", "..\Utils-IoT\Utils-IoT\Utils-IoT.csproj", "{B870E4D5-6806-4A0B-B233-8907EEDC5AFC}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {E66A57DD-858A-40E4-8A2F-BEA5129C31F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E66A57DD-858A-40E4-8A2F-BEA5129C31F7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E66A57DD-858A-40E4-8A2F-BEA5129C31F7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E66A57DD-858A-40E4-8A2F-BEA5129C31F7}.Release|Any CPU.Build.0 = Release|Any CPU - {B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {7C826771-09A9-44C6-BC5F-E7E8BABFD2A3} - EndGlobalSection -EndGlobal diff --git a/ConnectorUserTelegram/ConnectorUserTelegram/ConnectorUserTelegram.csproj b/ConnectorUserTelegram/ConnectorUserTelegram/ConnectorUserTelegram.csproj deleted file mode 100644 index 34ecf6b..0000000 --- a/ConnectorUserTelegram/ConnectorUserTelegram/ConnectorUserTelegram.csproj +++ /dev/null @@ -1,120 +0,0 @@ - - - - - Debug - AnyCPU - {E66A57DD-858A-40E4-8A2F-BEA5129C31F7} - Library - Properties - BlubbFish.Utils.IoT.Connector.User - ConnectorUserTelegram - v4.7.1 - 512 - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\..\..\..\packages\Microsoft.Win32.Primitives.4.3.0\lib\net46\Microsoft.Win32.Primitives.dll - - - ..\..\..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll - - - - ..\..\..\..\packages\System.AppContext.4.3.0\lib\net46\System.AppContext.dll - True - - - - ..\..\..\..\packages\System.Console.4.3.0\lib\net46\System.Console.dll - - - - ..\..\..\..\packages\System.Diagnostics.DiagnosticSource.4.3.0\lib\net46\System.Diagnostics.DiagnosticSource.dll - - - ..\..\..\..\packages\System.Globalization.Calendars.4.3.0\lib\net46\System.Globalization.Calendars.dll - - - ..\..\..\..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll - True - - - - ..\..\..\..\packages\System.IO.Compression.ZipFile.4.3.0\lib\net46\System.IO.Compression.ZipFile.dll - - - ..\..\..\..\packages\System.IO.FileSystem.4.3.0\lib\net46\System.IO.FileSystem.dll - - - ..\..\..\..\packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll - - - ..\..\..\..\packages\System.Net.Http.4.3.0\lib\net46\System.Net.Http.dll - - - ..\..\..\..\packages\System.Net.Sockets.4.3.0\lib\net46\System.Net.Sockets.dll - - - - ..\..\..\..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll - True - - - ..\..\..\..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net461\System.Security.Cryptography.Algorithms.dll - - - ..\..\..\..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll - - - ..\..\..\..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll - - - ..\..\..\..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll - - - - - - - - ..\..\..\..\packages\System.Xml.ReaderWriter.4.3.0\lib\net46\System.Xml.ReaderWriter.dll - - - ..\..\..\..\packages\Telegram.Bot.13.2.1\lib\netstandard1.1\Telegram.Bot.dll - - - - - - - - - {b870e4d5-6806-4a0b-b233-8907eedc5afc} - Utils-IoT - - - - - - - - \ No newline at end of file diff --git a/ConnectorUserTelegram/ConnectorUserTelegram/Properties/AssemblyInfo.cs b/ConnectorUserTelegram/ConnectorUserTelegram/Properties/AssemblyInfo.cs deleted file mode 100644 index 93202ab..0000000 --- a/ConnectorUserTelegram/ConnectorUserTelegram/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// Allgemeine Informationen über eine Assembly werden über die folgenden -// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, -// die einer Assembly zugeordnet sind. -[assembly: AssemblyTitle("ConnectorUserTelegram")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ConnectorUserTelegram")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly -// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von -// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. -[assembly: ComVisible(false)] - -// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird -[assembly: Guid("e66a57dd-858a-40e4-8a2f-bea5129c31f7")] - -// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: -// -// Hauptversion -// Nebenversion -// Buildnummer -// Revision -// -// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, -// indem Sie "*" wie unten gezeigt eingeben: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ConnectorUserTelegram/ConnectorUserTelegram/Telegram.cs b/ConnectorUserTelegram/ConnectorUserTelegram/Telegram.cs deleted file mode 100644 index 88fc3a7..0000000 --- a/ConnectorUserTelegram/ConnectorUserTelegram/Telegram.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using System.Collections.Generic; -using Telegram.Bot; -using Telegram.Bot.Args; -using Telegram.Bot.Exceptions; -using Telegram.Bot.Types; -using Telegram.Bot.Types.Enums; -using Telegram.Bot.Types.ReplyMarkups; - -namespace BlubbFish.Utils.IoT.Connector.User { - public class Telegram : AUserBackend { - private TelegramBotClient bot; - private ChatId chat; - - public override event TelegramMessage MessageIncomming; - public override event TelegramMessage MessageSending; - - public Telegram(Dictionary settings) : base(settings) { - this.bot = new TelegramBotClient(settings["telegram-key"]); - this.bot.OnMessage += this.Bot_OnMessage; - this.Connect(); - } - - private void Bot_OnMessage(Object sender, MessageEventArgs e) { - this.MessageIncomming?.Invoke(this, new UserMessageEventArgs(e.Message.Text, e.Message.Chat.Id, e.Message.Date)); - } - - private void Connect() { - this.bot.StartReceiving(); - this.chat = new ChatId(this.settings["chatid"]); - } - - public async override void Send(String message) { - try { - 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) { - 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 async override void Send(String message, String[] buttons) { - try { - 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); - if (i % 2 == 0) { - button[j] = new KeyboardButton[(j == button.Length - 1) ? ((buttons.Length % 2 == 0) ? 2 : buttons.Length % 2) : 2]; - } - button[j][i % 2] = new KeyboardButton(buttons[i]); - } - Message x = await this.bot.SendTextMessageAsync(this.chat, message, ParseMode.Default, false, false, 0, new ReplyKeyboardMarkup(button,true,true)); - this.MessageSending?.Invoke(this, new UserMessageEventArgs(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; - } - } - } -} diff --git a/ConnectorUserTelegram/ConnectorUserTelegram/app.config b/ConnectorUserTelegram/ConnectorUserTelegram/app.config deleted file mode 100644 index d14bbb2..0000000 --- a/ConnectorUserTelegram/ConnectorUserTelegram/app.config +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/ConnectorUserTelegram/ConnectorUserTelegram/packages.config b/ConnectorUserTelegram/ConnectorUserTelegram/packages.config deleted file mode 100644 index 40cda53..0000000 --- a/ConnectorUserTelegram/ConnectorUserTelegram/packages.config +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file