├── .gitattributes ├── .gitignore ├── InstallSteamChatBot └── InstallSteamChatBot.vdproj ├── LICENSE.md ├── README.md ├── Screenshots ├── logger.png ├── main_about.png └── triggers.png ├── SteamChatBot-Archiver_v0.0.1.exe ├── SteamChatBot.sln ├── SteamChatBot ├── AboutBox.Designer.cs ├── AboutBox.cs ├── AboutBox.resx ├── App.config ├── App.xaml ├── App.xaml.cs ├── Bot.cs ├── Log.cs ├── MainWindow.xaml ├── MainWindow.xaml.cs ├── Parser.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ ├── Settings.settings │ └── app.manifest ├── Resources │ └── scb.png ├── SteamChatBot.csproj ├── SteamHelper.cs ├── Triggers │ ├── AcceptChatInviteTrigger.cs │ ├── AcceptFriendRequestTrigger.cs │ ├── AntispamTrigger.cs │ ├── AutojoinChatTrigger.cs │ ├── BanCheckTrigger.cs │ ├── BanTrigger.cs │ ├── BaseTrigger.cs │ ├── ChangeNameTrigger.cs │ ├── ChatReplyTrigger.cs │ ├── ChooseTrigger.cs │ ├── DiscordTrigger.cs │ ├── DoormatTrigger.cs │ ├── GoogleTrigger.cs │ ├── IsUpTrigger.cs │ ├── KickTrigger.cs │ ├── LeaveChatTrigger.cs │ ├── LinkNameTrigger.cs │ ├── LockChatTrigger.cs │ ├── MessageIntervalTrigger.cs │ ├── ModerateTrigger.cs │ ├── NoteTrigger.cs │ ├── NotificationTrigger.cs │ ├── PlayGameTrigger.cs │ ├── TranslateTrigger.cs │ ├── TriggerOptions │ │ ├── AntiSpamTriggerOptions.cs │ │ ├── ChatCommand.cs │ │ ├── ChatCommandApi.cs │ │ ├── ChatReply.cs │ │ ├── DiscordOptions.cs │ │ ├── MessageIntervalOptions.cs │ │ ├── NoCommand.cs │ │ ├── NoteTriggerOptions.cs │ │ ├── NotificationOptions.cs │ │ ├── OptionType.cs │ │ ├── TriggerLists.cs │ │ ├── TriggerNumbers.cs │ │ ├── TriggerOptionsBase.cs │ │ └── Windows │ │ │ ├── AntiSpamTriggerOptionsWindow.xaml │ │ │ ├── AntiSpamTriggerOptionsWindow.xaml.cs │ │ │ ├── ChatCommandApiWindow.xaml │ │ │ ├── ChatCommandApiWindow.xaml.cs │ │ │ ├── ChatCommandWindow.xaml │ │ │ ├── ChatCommandWindow.xaml.cs │ │ │ ├── ChatReplyWindow.xaml │ │ │ ├── ChatReplyWindow.xaml.cs │ │ │ ├── DiscordTriggerOptionsWindow.xaml │ │ │ ├── DiscordTriggerOptionsWindow.xaml.cs │ │ │ ├── MessageIntervalOptionsWindow.xaml │ │ │ ├── MessageIntervalOptionsWindow.xaml.cs │ │ │ ├── NoCommandWindow.xaml │ │ │ ├── NoCommandWindow.xaml.cs │ │ │ ├── NoteTriggerOptionsWindow.xaml │ │ │ ├── NoteTriggerOptionsWindow.xaml.cs │ │ │ ├── NotificationOptionsWindow.xaml │ │ │ ├── NotificationOptionsWindow.xaml.cs │ │ │ ├── TriggerListWindow.xaml │ │ │ └── TriggerListWindow.xaml.cs │ ├── TriggerType.cs │ ├── UnbanTrigger.cs │ ├── UnlockChatTrigger.cs │ ├── UnmoderateTrigger.cs │ ├── WeatherTrigger.cs │ └── YoutubeTrigger.cs ├── UserInfo.cs ├── packages.config └── scb.ico └── TRIGGERS.md /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | 65 | ############################################################################## 66 | *.manifest binary 67 | *.application binary 68 | *.deploy binary 69 | *.config binary -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | !SteamChatBot/publish/[^.]* 2 | !SteamChatBot/publish/Application Files/*/[^.]* 3 | 4 | ## Ignore Visual Studio temporary files, build results, and 5 | ## files generated by popular Visual Studio add-ons. 6 | 7 | # User-specific files 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Build results 17 | [Dd]ebug/ 18 | [Dd]ebugPublic/ 19 | [Rr]elease/ 20 | [Rr]eleases/ 21 | x64/ 22 | x86/ 23 | build/ 24 | bld/ 25 | [Bb]in/ 26 | [Oo]bj/ 27 | 28 | # Visual Studio 2015 cache/options directory 29 | .vs/ 30 | 31 | # MSTest test Results 32 | [Tt]est[Rr]esult*/ 33 | [Bb]uild[Ll]og.* 34 | 35 | # NUNIT 36 | *.VisualState.xml 37 | TestResult.xml 38 | 39 | # Build Results of an ATL Project 40 | [Dd]ebugPS/ 41 | [Rr]eleasePS/ 42 | dlldata.c 43 | 44 | # DNX 45 | project.lock.json 46 | artifacts/ 47 | 48 | *_i.c 49 | *_p.c 50 | *_i.h 51 | *.ilk 52 | *.meta 53 | *.obj 54 | *.pch 55 | *.pdb 56 | *.pgc 57 | *.pgd 58 | *.rsp 59 | *.sbr 60 | *.tlb 61 | *.tli 62 | *.tlh 63 | *.tmp 64 | *.tmp_proj 65 | *.log 66 | *.vspscc 67 | *.vssscc 68 | .builds 69 | *.pidb 70 | *.svclog 71 | *.scc 72 | 73 | # Chutzpah Test files 74 | _Chutzpah* 75 | 76 | # Visual C++ cache files 77 | ipch/ 78 | *.aps 79 | *.ncb 80 | *.opensdf 81 | *.sdf 82 | *.cachefile 83 | 84 | # Visual Studio profiler 85 | *.psess 86 | *.vsp 87 | *.vspx 88 | 89 | # TFS 2012 Local Workspace 90 | $tf/ 91 | 92 | # Guidance Automation Toolkit 93 | *.gpState 94 | 95 | # ReSharper is a .NET coding add-in 96 | _ReSharper*/ 97 | *.[Rr]e[Ss]harper 98 | *.DotSettings.user 99 | 100 | # JustCode is a .NET coding add-in 101 | .JustCode 102 | 103 | # TeamCity is a build add-in 104 | _TeamCity* 105 | 106 | # DotCover is a Code Coverage Tool 107 | *.dotCover 108 | 109 | # NCrunch 110 | _NCrunch_* 111 | .*crunch*.local.xml 112 | 113 | # MightyMoose 114 | *.mm.* 115 | AutoTest.Net/ 116 | 117 | # Web workbench (sass) 118 | .sass-cache/ 119 | 120 | # Installshield output folder 121 | [Ee]xpress/ 122 | 123 | # DocProject is a documentation generator add-in 124 | DocProject/buildhelp/ 125 | DocProject/Help/*.HxT 126 | DocProject/Help/*.HxC 127 | DocProject/Help/*.hhc 128 | DocProject/Help/*.hhk 129 | DocProject/Help/*.hhp 130 | DocProject/Help/Html2 131 | DocProject/Help/html 132 | 133 | # Click-Once directory 134 | 135 | 136 | # Publish Web Output 137 | *.[Pp]ublish.xml 138 | *.azurePubxml 139 | ## TODO: Comment the next line if you want to checkin your 140 | ## web deploy settings but do note that will include unencrypted 141 | ## passwords 142 | #*.pubxml 143 | 144 | *.publishproj 145 | 146 | # NuGet Packages 147 | *.nupkg 148 | # The packages folder can be ignored because of Package Restore 149 | **/packages/* 150 | # except build/, which is used as an MSBuild target. 151 | !**/packages/build/ 152 | # Uncomment if necessary however generally it will be regenerated when needed 153 | #!**/packages/repositories.config 154 | 155 | # Windows Azure Build Output 156 | csx/ 157 | *.build.csdef 158 | 159 | # Windows Store app package directory 160 | AppPackages/ 161 | 162 | # Visual Studio cache files 163 | # files ending in .cache can be ignored 164 | *.[Cc]ache 165 | # but keep track of directories ending in .cache 166 | !*.[Cc]ache/ 167 | 168 | # Others 169 | ClientBin/ 170 | [Ss]tyle[Cc]op.* 171 | ~$* 172 | *~ 173 | *.dbmdl 174 | *.dbproj.schemaview 175 | *.pfx 176 | *.publishsettings 177 | node_modules/ 178 | orleans.codegen.cs 179 | 180 | # RIA/Silverlight projects 181 | Generated_Code/ 182 | 183 | # Backup & report files from converting an old project file 184 | # to a newer Visual Studio version. Backup files are not needed, 185 | # because we have git ;-) 186 | _UpgradeReport_Files/ 187 | Backup*/ 188 | UpgradeLog*.XML 189 | UpgradeLog*.htm 190 | 191 | # SQL Server files 192 | *.mdf 193 | *.ldf 194 | 195 | # Business Intelligence projects 196 | *.rdl.data 197 | *.bim.layout 198 | *.bim_*.settings 199 | 200 | # Microsoft Fakes 201 | FakesAssemblies/ 202 | 203 | # Node.js Tools for Visual Studio 204 | .ntvs_analysis.dat 205 | 206 | # Visual Studio 6 build log 207 | *.plg 208 | 209 | # Visual Studio 6 workspace options file 210 | *.opt 211 | 212 | # LightSwitch generated files 213 | GeneratedArtifacts/ 214 | _Pvt_Extensions/ 215 | ModelManifest.xml 216 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Kyle Smith 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This is a WIP of a C#/.NET port of [node-steam-chat-bot](https://github.com/Steam-Chat-Bot/node-steam-chat-bot). 2 | 3 | Credits to Jessecar96 for the custom logger used in his steambot, found [here](https://github.com/jessecar96/steambot). 4 | 5 | Note: If you want to build the InstallSteamChatBot project in vs (it's the one that packages the installer file), you need to download [an addon](https://visualstudiogallery.msdn.microsoft.com/f1cc3f3e-c300-40a7-8797-c509fb8933b9) for visual studio. 6 | 7 | **Update February 28, 2016**: I would like to say that I am almost done with this project. The main bot code is done, now all that's left really is to just add triggers and make it better. 8 | 9 | **Update May 27, 2016**: First release of SteamChatBot. When you run the application, a pop up will (most likely) appear saying something along the lines of "Windows smartscreen protected your PC". This is because I don't have the applation signed because it costs a lot of money. Just press "more info" and then "Run anyways" when that pops up. 10 | 11 | 12 | ### Screenshots 13 | 14 | ##### Main Window + About 15 | 16 | ![Main + About](https://raw.githubusercontent.com/Steam-Chat-Bot/SteamChatBot/master/Screenshots/main_about.png) 17 | 18 | ##### Trigger options 19 | 20 | ![Triggers](https://raw.githubusercontent.com/Steam-Chat-Bot/SteamChatBot/master/Screenshots/triggers.png) 21 | 22 | ##### Logger window (while bot is running) 23 | 24 | ![Logger](https://raw.githubusercontent.com/Steam-Chat-Bot/SteamChatBot/master/Screenshots/logger.png) 25 | -------------------------------------------------------------------------------- /Screenshots/logger.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Steam-Chat-Bot/SteamChatBot/1c1c083569acb5a18052edb3939cb7a110167de8/Screenshots/logger.png -------------------------------------------------------------------------------- /Screenshots/main_about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Steam-Chat-Bot/SteamChatBot/1c1c083569acb5a18052edb3939cb7a110167de8/Screenshots/main_about.png -------------------------------------------------------------------------------- /Screenshots/triggers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Steam-Chat-Bot/SteamChatBot/1c1c083569acb5a18052edb3939cb7a110167de8/Screenshots/triggers.png -------------------------------------------------------------------------------- /SteamChatBot-Archiver_v0.0.1.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Steam-Chat-Bot/SteamChatBot/1c1c083569acb5a18052edb3939cb7a110167de8/SteamChatBot-Archiver_v0.0.1.exe -------------------------------------------------------------------------------- /SteamChatBot.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SteamChatBot", "SteamChatBot\SteamChatBot.csproj", "{7765B712-A1A7-4B94-8465-68D76C72E588}" 7 | EndProject 8 | Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "InstallSteamChatBot", "InstallSteamChatBot\InstallSteamChatBot.vdproj", "{9FFB8D8B-974D-43C8-A7C3-1219483C80AF}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {7765B712-A1A7-4B94-8465-68D76C72E588}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {7765B712-A1A7-4B94-8465-68D76C72E588}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {7765B712-A1A7-4B94-8465-68D76C72E588}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {7765B712-A1A7-4B94-8465-68D76C72E588}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {9FFB8D8B-974D-43C8-A7C3-1219483C80AF}.Debug|Any CPU.ActiveCfg = Debug 21 | {9FFB8D8B-974D-43C8-A7C3-1219483C80AF}.Debug|Any CPU.Build.0 = Debug 22 | {9FFB8D8B-974D-43C8-A7C3-1219483C80AF}.Release|Any CPU.ActiveCfg = Release 23 | {9FFB8D8B-974D-43C8-A7C3-1219483C80AF}.Release|Any CPU.Build.0 = Release 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /SteamChatBot/AboutBox.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace SteamChatBot 2 | { 3 | partial class AboutBox 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | protected override void Dispose(bool disposing) 14 | { 15 | if (disposing && (components != null)) 16 | { 17 | components.Dispose(); 18 | } 19 | base.Dispose(disposing); 20 | } 21 | 22 | #region Windows Form Designer generated code 23 | 24 | /// 25 | /// Required method for Designer support - do not modify 26 | /// the contents of this method with the code editor. 27 | /// 28 | private void InitializeComponent() 29 | { 30 | this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); 31 | this.logoPictureBox = new System.Windows.Forms.PictureBox(); 32 | this.linkLabelProductName = new System.Windows.Forms.LinkLabel(); 33 | this.labelVersion = new System.Windows.Forms.Label(); 34 | this.labelCopyright = new System.Windows.Forms.Label(); 35 | this.labelDescription = new System.Windows.Forms.Label(); 36 | this.okButton = new System.Windows.Forms.Button(); 37 | this.tableLayoutPanel.SuspendLayout(); 38 | ((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).BeginInit(); 39 | this.SuspendLayout(); 40 | // 41 | // tableLayoutPanel 42 | // 43 | this.tableLayoutPanel.ColumnCount = 1; 44 | this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); 45 | this.tableLayoutPanel.Controls.Add(this.logoPictureBox, 0, 0); 46 | this.tableLayoutPanel.Controls.Add(this.linkLabelProductName, 0, 2); 47 | this.tableLayoutPanel.Controls.Add(this.labelVersion, 0, 3); 48 | this.tableLayoutPanel.Controls.Add(this.labelCopyright, 0, 4); 49 | this.tableLayoutPanel.Controls.Add(this.labelDescription, 0, 5); 50 | this.tableLayoutPanel.Controls.Add(this.okButton, 0, 6); 51 | this.tableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill; 52 | this.tableLayoutPanel.Location = new System.Drawing.Point(9, 9); 53 | this.tableLayoutPanel.Name = "tableLayoutPanel"; 54 | this.tableLayoutPanel.RowCount = 7; 55 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle()); 56 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle()); 57 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle()); 58 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle()); 59 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle()); 60 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle()); 61 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); 62 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); 63 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); 64 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); 65 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); 66 | this.tableLayoutPanel.Size = new System.Drawing.Size(280, 297); 67 | this.tableLayoutPanel.TabIndex = 0; 68 | // 69 | // logoPictureBox 70 | // 71 | this.logoPictureBox.BackColor = System.Drawing.SystemColors.Control; 72 | this.logoPictureBox.Dock = System.Windows.Forms.DockStyle.Fill; 73 | this.logoPictureBox.Image = global::SteamChatBot.Properties.Resources.scb; 74 | this.logoPictureBox.InitialImage = global::SteamChatBot.Properties.Resources.scb; 75 | this.logoPictureBox.Location = new System.Drawing.Point(3, 3); 76 | this.logoPictureBox.Name = "logoPictureBox"; 77 | this.tableLayoutPanel.SetRowSpan(this.logoPictureBox, 2); 78 | this.logoPictureBox.Size = new System.Drawing.Size(274, 184); 79 | this.logoPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; 80 | this.logoPictureBox.TabIndex = 12; 81 | this.logoPictureBox.TabStop = false; 82 | // 83 | // linkLabelProductName 84 | // 85 | this.linkLabelProductName.AutoSize = true; 86 | this.linkLabelProductName.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; 87 | this.linkLabelProductName.LinkColor = System.Drawing.Color.Black; 88 | this.linkLabelProductName.Location = new System.Drawing.Point(3, 190); 89 | this.linkLabelProductName.Name = "linkLabelProductName"; 90 | this.linkLabelProductName.Size = new System.Drawing.Size(80, 13); 91 | this.linkLabelProductName.TabIndex = 13; 92 | this.linkLabelProductName.TabStop = true; 93 | this.linkLabelProductName.Text = "SteamChatBot"; 94 | this.linkLabelProductName.VisitedLinkColor = System.Drawing.Color.Black; 95 | this.linkLabelProductName.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabelProductName_LinkClicked); 96 | // 97 | // labelVersion 98 | // 99 | this.labelVersion.AutoSize = true; 100 | this.labelVersion.Location = new System.Drawing.Point(3, 203); 101 | this.labelVersion.Name = "labelVersion"; 102 | this.labelVersion.Size = new System.Drawing.Size(84, 13); 103 | this.labelVersion.TabIndex = 14; 104 | this.labelVersion.Text = "Version" + AssemblyVersion; 105 | // 106 | // labelCopyright 107 | // 108 | this.labelCopyright.AutoSize = true; 109 | this.labelCopyright.Location = new System.Drawing.Point(3, 216); 110 | this.labelCopyright.Name = "labelCopyright"; 111 | this.labelCopyright.Size = new System.Drawing.Size(128, 13); 112 | this.labelCopyright.TabIndex = 15; 113 | this.labelCopyright.Text = "© 2016 Steam-Chat-Bot"; 114 | // 115 | // labelDescription 116 | // 117 | this.labelDescription.AutoSize = true; 118 | this.labelDescription.Location = new System.Drawing.Point(3, 229); 119 | this.labelDescription.Name = "labelDescription"; 120 | this.labelDescription.Size = new System.Drawing.Size(270, 13); 121 | this.labelDescription.TabIndex = 16; 122 | this.labelDescription.Text = "A simplified interface for running a Steam chat bot."; 123 | // 124 | // okButton 125 | // 126 | this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 127 | this.okButton.ImageAlign = System.Drawing.ContentAlignment.BottomRight; 128 | this.okButton.Location = new System.Drawing.Point(202, 271); 129 | this.okButton.Name = "okButton"; 130 | this.okButton.Size = new System.Drawing.Size(75, 23); 131 | this.okButton.TabIndex = 1; 132 | this.okButton.Text = "OK"; 133 | this.okButton.UseVisualStyleBackColor = true; 134 | this.okButton.Click += new System.EventHandler(this.okButton_Click); 135 | // 136 | // AboutBox 137 | // 138 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 139 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 140 | this.ClientSize = new System.Drawing.Size(298, 315); 141 | this.Controls.Add(this.tableLayoutPanel); 142 | this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 143 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 144 | this.MaximizeBox = false; 145 | this.MinimizeBox = false; 146 | this.Name = "AboutBox"; 147 | this.Padding = new System.Windows.Forms.Padding(9); 148 | this.ShowIcon = false; 149 | this.ShowInTaskbar = false; 150 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 151 | this.Text = "About"; 152 | this.tableLayoutPanel.ResumeLayout(false); 153 | this.tableLayoutPanel.PerformLayout(); 154 | ((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).EndInit(); 155 | this.ResumeLayout(false); 156 | 157 | } 158 | 159 | #endregion 160 | 161 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel; 162 | private System.Windows.Forms.PictureBox logoPictureBox; 163 | private System.Windows.Forms.LinkLabel linkLabelProductName; 164 | private System.Windows.Forms.Label labelVersion; 165 | private System.Windows.Forms.Label labelCopyright; 166 | private System.Windows.Forms.Label labelDescription; 167 | private System.Windows.Forms.Button okButton; 168 | } 169 | } 170 | -------------------------------------------------------------------------------- /SteamChatBot/AboutBox.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Drawing; 5 | using System.Linq; 6 | using System.Reflection; 7 | using System.Threading.Tasks; 8 | using System.Windows.Forms; 9 | 10 | namespace SteamChatBot 11 | { 12 | partial class AboutBox : Form 13 | { 14 | public AboutBox() 15 | { 16 | InitializeComponent(); 17 | this.Text = String.Format("About {0}", AssemblyTitle); 18 | this.linkLabelProductName.Text = AssemblyProduct; 19 | this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion); 20 | this.labelCopyright.Text = AssemblyCopyright; 21 | this.labelDescription.Text = AssemblyDescription; 22 | } 23 | 24 | #region Assembly Attribute Accessors 25 | 26 | public string AssemblyTitle 27 | { 28 | get 29 | { 30 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false); 31 | if (attributes.Length > 0) 32 | { 33 | AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0]; 34 | if (titleAttribute.Title != "") 35 | { 36 | return titleAttribute.Title; 37 | } 38 | } 39 | return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase); 40 | } 41 | } 42 | 43 | public string AssemblyVersion 44 | { 45 | get 46 | { 47 | return Assembly.GetExecutingAssembly().GetName().Version.ToString(); 48 | } 49 | } 50 | 51 | public string AssemblyDescription 52 | { 53 | get 54 | { 55 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false); 56 | if (attributes.Length == 0) 57 | { 58 | return ""; 59 | } 60 | return ((AssemblyDescriptionAttribute)attributes[0]).Description; 61 | } 62 | } 63 | 64 | public string AssemblyProduct 65 | { 66 | get 67 | { 68 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false); 69 | if (attributes.Length == 0) 70 | { 71 | return ""; 72 | } 73 | return ((AssemblyProductAttribute)attributes[0]).Product; 74 | } 75 | } 76 | 77 | public string AssemblyCopyright 78 | { 79 | get 80 | { 81 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); 82 | if (attributes.Length == 0) 83 | { 84 | return ""; 85 | } 86 | return ((AssemblyCopyrightAttribute)attributes[0]).Copyright; 87 | } 88 | } 89 | 90 | public string AssemblyCompany 91 | { 92 | get 93 | { 94 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false); 95 | if (attributes.Length == 0) 96 | { 97 | return ""; 98 | } 99 | return ((AssemblyCompanyAttribute)attributes[0]).Company; 100 | } 101 | } 102 | #endregion 103 | 104 | private void linkLabelProductName_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) 105 | { 106 | linkLabelProductName.LinkVisited = true; 107 | System.Diagnostics.Process.Start("https://github.com/Steam-Chat-Bot/SteamChatBot"); 108 | } 109 | 110 | private void okButton_Click(object sender, EventArgs e) 111 | { 112 | Close(); //cause it won't close automatically 113 | } 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /SteamChatBot/AboutBox.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /SteamChatBot/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /SteamChatBot/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /SteamChatBot/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace SteamChatBot 10 | { 11 | /// 12 | /// Interaction logic for App.xaml 13 | /// 14 | public partial class App : Application 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /SteamChatBot/Log.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Linq; 4 | 5 | namespace SteamChatBot 6 | { 7 | public class Log : IDisposable 8 | { 9 | 10 | private static Log instance; 11 | private string logFile; 12 | private string botName; 13 | private LogLevel consoleLogLevel; 14 | private LogLevel fileLogLevel; 15 | 16 | public static Log Instance 17 | { 18 | get 19 | { 20 | if (instance == null) 21 | { 22 | throw new InvalidOperationException("Call Log.CreateInstance to create the instance"); 23 | } 24 | else 25 | { 26 | return instance; 27 | } 28 | } 29 | } 30 | 31 | /* 32 | private Log(string logFile, string botName, LogLevel consoleLogLevel, LogLevel fileLogLevel) 33 | { 34 | this.logFile = logFile; 35 | this.botName = botName; 36 | this.consoleLogLevel = consoleLogLevel; 37 | this.fileLogLevel = fileLogLevel; 38 | } 39 | */ 40 | 41 | public static Log CreateInstance(string logFile, string botName, LogLevel consoleLogLevel, LogLevel fileLogLevel) 42 | { 43 | return instance ?? (instance = new Log(logFile, botName, consoleLogLevel, fileLogLevel)); 44 | } 45 | 46 | public enum LogLevel 47 | { 48 | Silly, 49 | Debug, 50 | Verbose, 51 | Info, 52 | Warn, 53 | Error 54 | } 55 | 56 | 57 | protected StreamWriter _FileStream; 58 | protected string _botName; 59 | private bool disposed; 60 | private static string path; 61 | public LogLevel OutputLevel; 62 | public LogLevel FileLogLevel; 63 | public ConsoleColor DefaultConsoleColor = ConsoleColor.White; 64 | public bool ShowBotName { get; set; } 65 | 66 | private Log(string logFile, string botName = "", LogLevel consoleLogLevel = LogLevel.Info, LogLevel fileLogLevel = LogLevel.Info) 67 | { 68 | this.logFile = logFile; 69 | this.botName = botName; 70 | this.consoleLogLevel = consoleLogLevel; 71 | this.fileLogLevel = fileLogLevel; 72 | 73 | path = Path.Combine(Bot.username + "/logs", logFile); 74 | Directory.CreateDirectory(Bot.username + "/logs"); 75 | _botName = botName; 76 | OutputLevel = consoleLogLevel; 77 | FileLogLevel = fileLogLevel; 78 | Console.ForegroundColor = DefaultConsoleColor; 79 | ShowBotName = true; 80 | } 81 | 82 | ~Log() 83 | { 84 | Dispose(false); 85 | } 86 | 87 | // This outputs a log entry of the level info. 88 | public void Info(string data, params object[] formatParams) 89 | { 90 | _OutputLine(LogLevel.Info, data, formatParams); 91 | } 92 | 93 | // This outputs a log entry of the level debug. 94 | public void Debug(string data, params object[] formatParams) 95 | { 96 | _OutputLine(LogLevel.Debug, data, formatParams); 97 | } 98 | 99 | // This outputs a log entry of the level success. 100 | public void Silly(string data, params object[] formatParams) 101 | { 102 | _OutputLine(LogLevel.Silly, data, formatParams); 103 | } 104 | 105 | // This outputs a log entry of the level warn. 106 | public void Warn(string data, params object[] formatParams) 107 | { 108 | _OutputLine(LogLevel.Warn, data, formatParams); 109 | } 110 | 111 | // This outputs a log entry of the level error. 112 | public void Error(string data, params object[] formatParams) 113 | { 114 | _OutputLine(LogLevel.Error, data, formatParams); 115 | } 116 | 117 | public void Verbose(string data, params object[] formatParams) 118 | { 119 | _OutputLine(LogLevel.Verbose, data, formatParams); 120 | } 121 | 122 | // Outputs a line to both the log and the console, if 123 | // applicable. 124 | protected void _OutputLine(LogLevel level, string line, params object[] formatParams) 125 | { 126 | if (disposed) 127 | return; 128 | string formattedString = string.Format( 129 | "[{0}{1}] {2}: {3}", 130 | GetLogBotName(), 131 | DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), 132 | _LogLevel(level).ToUpper(), (formatParams != null && formatParams.Any() ? String.Format(line, formatParams) : line) 133 | ); 134 | 135 | if (level >= FileLogLevel) 136 | { 137 | //_FileStream.WriteLine(formattedString); 138 | Write(formattedString); 139 | } 140 | if (level >= OutputLevel) 141 | { 142 | _OutputLineToConsole(level, formattedString); 143 | } 144 | } 145 | 146 | public static void Write(string data) 147 | { 148 | using (var sw = File.AppendText(path)) 149 | { 150 | sw.WriteLine(data); 151 | } 152 | } 153 | 154 | private string GetLogBotName() 155 | { 156 | if (_botName == null) 157 | { 158 | return "(SYSTEM) "; 159 | } 160 | else if (ShowBotName) 161 | { 162 | return _botName + " "; 163 | } 164 | return ""; 165 | } 166 | 167 | // Outputs a line to the console, with the correct color 168 | // formatting. 169 | protected void _OutputLineToConsole(LogLevel level, string line) 170 | { 171 | Console.ForegroundColor = _LogColor(level); 172 | Console.WriteLine(line); 173 | Console.ForegroundColor = DefaultConsoleColor; 174 | if(level == LogLevel.Error) 175 | { 176 | if(!Directory.Exists(Bot.username + "/logs/errors")) 177 | { 178 | Directory.CreateDirectory(Bot.username + "/logs/errors"); 179 | } 180 | File.WriteAllText(Bot.username + "/logs/errors/err_" + (long)(DateTime.Now - new DateTime(1970, 1, 1)).TotalMilliseconds + ".txt", line); 181 | } 182 | } 183 | 184 | // Determine the string equivalent of the LogLevel. 185 | protected string _LogLevel(LogLevel level) 186 | { 187 | switch (level) 188 | { 189 | case LogLevel.Info: 190 | return "info"; 191 | case LogLevel.Debug: 192 | return "debug"; 193 | case LogLevel.Silly: 194 | return "silly"; 195 | case LogLevel.Warn: 196 | return "warn"; 197 | case LogLevel.Error: 198 | return "error"; 199 | case LogLevel.Verbose: 200 | return "verbose"; 201 | default: 202 | return "undef"; 203 | } 204 | } 205 | 206 | // Determine the color to be used when outputting to the 207 | // console. 208 | protected ConsoleColor _LogColor(LogLevel level) 209 | { 210 | switch (level) 211 | { 212 | case LogLevel.Info: 213 | return ConsoleColor.Green; 214 | case LogLevel.Debug: 215 | return ConsoleColor.DarkBlue; 216 | case LogLevel.Silly: 217 | return ConsoleColor.Magenta; 218 | case LogLevel.Warn: 219 | return ConsoleColor.Yellow; 220 | case LogLevel.Error: 221 | return ConsoleColor.Red; 222 | case LogLevel.Verbose: 223 | return ConsoleColor.Cyan; 224 | default: 225 | return DefaultConsoleColor; 226 | } 227 | } 228 | 229 | private void Dispose(bool disposing) 230 | { 231 | if (disposed) 232 | return; 233 | if (disposing) 234 | _FileStream.Dispose(); 235 | disposed = true; 236 | } 237 | 238 | public void Dispose() 239 | { 240 | Dispose(true); 241 | GC.SuppressFinalize(this); 242 | } 243 | } 244 | } 245 | -------------------------------------------------------------------------------- /SteamChatBot/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 |