├── .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 | 
17 |
18 | ##### Trigger options
19 |
20 | 
21 |
22 | ##### Logger window (while bot is running)
23 |
24 | 
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 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
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 |
--------------------------------------------------------------------------------
/SteamChatBot/Parser.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Web.Script.Serialization;
4 | using System.Xml;
5 | using System.Xml.Serialization;
6 |
7 | namespace SteamChatBot
8 | {
9 | public static class Parser
10 | {
11 | private static JavaScriptSerializer json;
12 | private static JavaScriptSerializer JSON
13 | {
14 | get
15 | {
16 | return json ?? (json = new JavaScriptSerializer());
17 | }
18 | }
19 |
20 | public static Stream ToStream(this string @this)
21 | {
22 | MemoryStream stream = new MemoryStream();
23 | StreamWriter writer = new StreamWriter(stream);
24 | writer.Write(@this);
25 | writer.Flush();
26 | stream.Position = 0;
27 | return stream;
28 | }
29 |
30 | public static T ParseXML(this string @this) where T : class
31 | {
32 | XmlRootAttribute root = new XmlRootAttribute();
33 | root.ElementName = "profile";
34 | root.IsNullable = true;
35 |
36 | var reader = XmlReader.Create(@this.Trim().ToStream(), new XmlReaderSettings()
37 | {
38 | ConformanceLevel = ConformanceLevel.Document
39 | });
40 | return new XmlSerializer(typeof(T), root).Deserialize(reader) as T;
41 | }
42 |
43 | public static T ParseJSON(this string @this) where T : class
44 | {
45 | return JSON.Deserialize(@this.Trim());
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/SteamChatBot/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("SteamChatBot")]
11 | [assembly: AssemblyDescription("A simplified interface for a Steam chat bot.")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("Steam-Chat-Bot")]
14 | [assembly: AssemblyProduct("SteamChatBot")]
15 | [assembly: AssemblyCopyright("Copyright © 2016")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Setting ComVisible to false makes the types in this assembly not visible
20 | // to COM components. If you need to access a type in this assembly from
21 | // COM, set the ComVisible attribute to true on that type.
22 | [assembly: ComVisible(false)]
23 |
24 | //In order to begin building localizable applications, set
25 | //CultureYouAreCodingWith in your .csproj file
26 | //inside a . For example, if you are using US english
27 | //in your source files, set the to en-US. Then uncomment
28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
29 | //the line below to match the UICulture setting in the project file.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36 | //(used if a resource is not found in the page,
37 | // or application resource dictionaries)
38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39 | //(used if a resource is not found in the page,
40 | // app, or any theme specific resource dictionaries)
41 | )]
42 |
43 |
44 | // Version information for an assembly consists of the following four values:
45 | //
46 | // Major Version
47 | // Minor Version
48 | // Build Number
49 | // Revision
50 | //
51 | // You can specify all the values or you can default the Build and Revision Numbers
52 | // by using the '*' as shown below:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("0.0.1.0")]
55 | [assembly: AssemblyFileVersion("0.0.1.0")]
56 | [assembly: NeutralResourcesLanguage("en-US")]
57 |
58 |
--------------------------------------------------------------------------------
/SteamChatBot/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace SteamChatBot.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SteamChatBot.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 |
63 | ///
64 | /// Looks up a localized resource of type System.Drawing.Bitmap.
65 | ///
66 | internal static System.Drawing.Bitmap scb {
67 | get {
68 | object obj = ResourceManager.GetObject("scb", resourceCulture);
69 | return ((System.Drawing.Bitmap)(obj));
70 | }
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/SteamChatBot/Properties/Resources.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 |
121 |
122 | ..\Resources\scb.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
123 |
124 |
--------------------------------------------------------------------------------
/SteamChatBot/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace SteamChatBot.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/SteamChatBot/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/SteamChatBot/Properties/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
48 |
55 |
56 |
70 |
--------------------------------------------------------------------------------
/SteamChatBot/Resources/scb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Steam-Chat-Bot/SteamChatBot/1c1c083569acb5a18052edb3939cb7a110167de8/SteamChatBot/Resources/scb.png
--------------------------------------------------------------------------------
/SteamChatBot/SteamHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | using SteamKit2;
8 |
9 | namespace SteamChatBot
10 | {
11 | class SteamHelper
12 | {
13 | public Dictionary ChatRoomMembers { get; set; }
14 |
15 | public static SteamID ToClanID(SteamID steamID)
16 | {
17 | if(steamID.AccountInstance == (uint)SteamID.ChatInstanceFlags.Clan)
18 | {
19 | steamID.AccountType = EAccountType.Clan;
20 | steamID.AccountInstance = 0;
21 | }
22 |
23 | return steamID;
24 | }
25 |
26 | public static SteamID ToChatID(SteamID steamID)
27 | {
28 | if(steamID.AccountType == EAccountType.Clan)
29 | {
30 | steamID.AccountInstance = (uint)SteamID.ChatInstanceFlags.Clan;
31 | steamID.AccountType = EAccountType.Chat;
32 | }
33 |
34 | return steamID;
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/AcceptChatInviteTrigger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | using SteamKit2;
8 |
9 | using SteamChatBot.Triggers.TriggerOptions;
10 |
11 | namespace SteamChatBot.Triggers
12 | {
13 | class AcceptChatInviteTrigger : BaseTrigger
14 | {
15 | public AcceptChatInviteTrigger(TriggerType type, string name, TriggerOptionsBase tl) : base(type, name, tl)
16 | { }
17 |
18 | public override bool respondToChatInvite(SteamID roomID, string roomName, SteamID inviterId)
19 | {
20 | if (Options.TriggerLists.Rooms.Contains(roomID) || Options.TriggerLists.Rooms == null || Options.TriggerLists.Rooms.Count == 0)
21 | {
22 | Bot.steamFriends.JoinChat(roomID);
23 | return true;
24 | }
25 | else
26 | {
27 | return false;
28 | }
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/AcceptFriendRequestTrigger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | using SteamKit2;
8 |
9 | using SteamChatBot.Triggers.TriggerOptions;
10 |
11 | namespace SteamChatBot.Triggers
12 | {
13 | class AcceptFriendRequestTrigger : BaseTrigger
14 | {
15 | public AcceptFriendRequestTrigger(TriggerType type, string name, TriggerOptionsBase tl) : base(type, name, tl)
16 | { }
17 |
18 | public override bool respondToFriendRequest(SteamID userID)
19 | {
20 | Bot.steamFriends.AddFriend(userID);
21 | return true;
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/AntispamTrigger.cs:
--------------------------------------------------------------------------------
1 | using SteamChatBot.Triggers.TriggerOptions;
2 | using SteamKit2;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using System.Timers;
9 |
10 | namespace SteamChatBot.Triggers
11 | {
12 | class AntispamTrigger : BaseTrigger
13 | {
14 | public AntispamTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
15 | {
16 | options.AntiSpamTriggerOptions.groups = new Dictionary>();
17 | Timer reducePenT = new Timer(options.AntiSpamTriggerOptions.ptimer.resolution);
18 | reducePenT.Elapsed += ReducePenT_Tick;
19 | reducePenT.Start();
20 | }
21 |
22 | private void ReducePenT_Tick(object sender, EventArgs e)
23 | {
24 | ReducePenalties();
25 | }
26 |
27 | public override bool respondToChatMessage(SteamID roomID, SteamID chatterId, string message)
28 | {
29 | return Respond(roomID, chatterId, message);
30 | }
31 |
32 | private bool Respond(SteamID toID, SteamID userID, string message)
33 | {
34 | Dictionary> groups = Options.AntiSpamTriggerOptions.groups;
35 | AntiSpamTriggerOptions options = Options.AntiSpamTriggerOptions;
36 |
37 | if(!groups.ContainsKey(toID))
38 | {
39 | groups[toID] = new Dictionary();
40 | }
41 | if(!groups[toID].ContainsKey(userID))
42 | {
43 | groups[toID][userID] = 0;
44 | }
45 |
46 | groups[toID][userID] += options.msgPenalty;
47 |
48 | if(groups[toID][userID] >= options.score.warn && groups[toID][userID] <= options.score.warnMax)
49 | {
50 | Log("warning", userID, toID);
51 | SendMessageAfterDelay(userID, options.warnMessage, false);
52 | return true;
53 | }
54 | else if(groups[toID][userID] >= options.score.kick)
55 | {
56 | Log("kicking", userID, toID);
57 | Bot.steamFriends.KickChatMember(toID, userID);
58 | return true;
59 | }
60 | else if (groups[toID][userID] >= options.score.ban)
61 | {
62 | Log("banning", userID, toID);
63 | Timer unban = new Timer(options.timers.unban);
64 | unban.Elapsed += new ElapsedEventHandler((sender, e) => Unban_Elapsed(sender, e, toID, userID));
65 | return true;
66 | }
67 | else if (groups[toID][userID] >= options.score.tattle && groups[toID][userID] <= options.score.tattleMax)
68 | {
69 | Log("tattling on", userID, toID);
70 | foreach(SteamID admin in options.admins)
71 | {
72 | SendMessageAfterDelay(admin, Bot.steamFriends.GetFriendPersonaName(userID) + " is spamming in https://steamcommunity.com/gid/" + toID.ToString(), false);
73 | }
74 | return true;
75 | }
76 | return false;
77 | }
78 |
79 | #region timers
80 |
81 | private void Unban_Elapsed(object sender, ElapsedEventArgs e, SteamID toID, SteamID userID)
82 | {
83 | Log("**UNbanning**", userID, toID, "timeout");
84 | Bot.steamFriends.UnbanChatMember(toID, userID);
85 | }
86 |
87 | ///
88 | /// Reduces the score of every user by (options.ptimer.amount) every (options.ptimer.resolution) ms
89 | ///
90 | private void ReducePenalties()
91 | {
92 | foreach(Dictionary users in Options.AntiSpamTriggerOptions.groups.Values)
93 | {
94 | try
95 | {
96 | foreach (SteamID user in users.Keys)
97 | {
98 | users[user] -= Options.AntiSpamTriggerOptions.ptimer.amount;
99 | if (users[user] <= 0)
100 | {
101 | users.Remove(user);
102 | return;
103 | }
104 | }
105 | }
106 | catch (Exception e) { return; }
107 | }
108 | }
109 |
110 | #endregion
111 |
112 | ///
113 | /// Logs bot actions to the console
114 | ///
115 | /// Action that was taken
116 | /// The user to act upon
117 | /// The group the action is taking place in
118 | /// Reason they had action taken upon them
119 | private void Log(string prefix, SteamID userID, SteamID groupID)
120 | {
121 | string message = string.Format("{0}/{1}: {2} {3} for spamming in https://steamcommunity.com/gid/{4}", Bot.username, Name, prefix, Bot.steamFriends.GetFriendPersonaName(userID), groupID.ToString());
122 | SteamChatBot.Log.Instance.Info(message);
123 | }
124 |
125 | ///
126 | /// Logs bot actions to the console
127 | ///
128 | /// Action that was taken
129 | /// The user to act upon
130 | /// The group the action is taking place in
131 | /// Reason they had action taken upon them
132 | private void Log(string prefix, SteamID userID, SteamID groupID, string reason)
133 | {
134 | string message = string.Format("{0}/{1}: {2} {3} for spamming in https://steamcommunity.com/gid/{4} to prevent spam ({5})", Bot.username, Name, prefix, Bot.steamFriends.GetFriendPersonaName(userID), groupID.ToString(), reason);
135 | SteamChatBot.Log.Instance.Info(message);
136 | }
137 | }
138 | }
139 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/AutojoinChatTrigger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | using SteamKit2;
8 |
9 | using SteamChatBot.Triggers.TriggerOptions;
10 |
11 | namespace SteamChatBot.Triggers
12 | {
13 | class AutojoinChatTrigger : BaseTrigger
14 | {
15 | public AutojoinChatTrigger(TriggerType type, string name, TriggerOptionsBase tl) : base(type, name, tl)
16 | { }
17 |
18 | public override bool OnLoggedOn()
19 | {
20 | if(Options.TriggerLists.Rooms.Count == 0 || Options.TriggerLists.Rooms == null)
21 | {
22 | throw new InvalidOperationException("Must include rooms!");
23 | }
24 | else
25 | {
26 | foreach (SteamID roomID in Options.TriggerLists.Rooms)
27 | {
28 | Log.Instance.Verbose("Joining chat room " + roomID.ToString());
29 | Bot.steamFriends.JoinChat(roomID);
30 | }
31 | return true;
32 | }
33 | }
34 |
35 |
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/BanCheckTrigger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.IO;
6 | using System.Threading.Tasks;
7 | using System.Net;
8 | using System.Web.Script.Serialization;
9 |
10 | using SteamKit2;
11 |
12 | using SteamChatBot.Triggers.TriggerOptions;
13 |
14 | namespace SteamChatBot.Triggers
15 | {
16 | class BanCheckTrigger : BaseTrigger
17 | {
18 | public BanCheckTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
19 | { }
20 |
21 | public override bool respondToChatMessage(SteamID roomID, SteamID chatterId, string message)
22 | {
23 | return Respond(roomID, chatterId, message, true);
24 | }
25 |
26 | public override bool respondToFriendMessage(SteamID userID, string message)
27 | {
28 | return Respond(userID, userID, message, false);
29 | }
30 |
31 | private bool Respond(SteamID toID, SteamID userID, string message, bool room)
32 | {
33 | string[] query = StripCommand(message, Options.ChatCommandApi.ChatCommand.Command);
34 |
35 | if(Options.ChatCommandApi.ApiKey == null || Options.ChatCommandApi.ApiKey == "")
36 | {
37 | SendMessageAfterDelay(toID, "You must declare a Steam API key to use this trigger.", room);
38 | return false;
39 | }
40 |
41 | if(query != null && query.Length == 1)
42 | {
43 | SendMessageAfterDelay(toID, "Usage: " + Options.ChatCommandApi.ChatCommand.Command + " ", room);
44 | return true;
45 | }
46 | else if(query != null && query[1] != null)
47 | {
48 | if (query[1] != null)
49 | {
50 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(string.Format("http://api.steampowered.com/ISteamUser/GetPlayerBans/v1/?key={0}&steamids={1}", Options.ChatCommandApi.ApiKey, query[1]));
51 |
52 | string text = "";
53 | BanCheckResponse bans = null;
54 |
55 | try {
56 | using (var steamwebresponse = (HttpWebResponse)request.GetResponse())
57 | {
58 | using (var sr = new StreamReader(steamwebresponse.GetResponseStream()))
59 | {
60 | JavaScriptSerializer js = new JavaScriptSerializer();
61 | text = sr.ReadToEnd();
62 | bans = (BanCheckResponse)js.Deserialize(text, typeof(BanCheckResponse));
63 | }
64 | }
65 | }
66 | catch(ArgumentException e)
67 | {
68 | Log.Instance.Error(e.StackTrace);
69 | }
70 |
71 | bool communitybanned = false;
72 | bool vacced = false;
73 | int vac_number = 0;
74 | bool econban = false;
75 | int bancount = 0;
76 |
77 | if (bans.CommunityBanned == true)
78 | {
79 | communitybanned = true;
80 | bancount++;
81 | }
82 | if (bans.VACBanned)
83 | {
84 | vacced = true;
85 | vac_number = bans.NumberOfVACBans;
86 | bancount++;
87 | }
88 | if (bans.EconomyBan != "none" && bans.EconomyBan != null)
89 | {
90 | econban = true;
91 | bancount++;
92 | }
93 |
94 | string msg;
95 | int commas = bancount - 1;
96 |
97 | if (bancount > 0)
98 | {
99 | msg = "WARNING: " + Bot.steamFriends.GetFriendPersonaName(new SteamID(Convert.ToUInt64(query[1]))) + " has the following bans: ";
100 | if (vacced)
101 | {
102 | msg += bans.NumberOfVACBans + " VAC bans" + (commas > 0 ? ", " : ".");
103 | }
104 | if (communitybanned)
105 | {
106 | msg += "a community ban" + (commas > 0 ? ", " : ".");
107 | }
108 | if (econban)
109 | {
110 | msg += "an economy ban (" + bans.EconomyBan + ").";
111 | }
112 | SendMessageAfterDelay(toID, msg, room);
113 | return true;
114 | }
115 | else
116 | {
117 | SendMessageAfterDelay(toID, Bot.steamFriends.GetFriendPersonaName(userID) + " has no bans.", room);
118 | return true;
119 | }
120 | }
121 | }
122 | return false;
123 | }
124 | }
125 |
126 | class BanCheckResponse
127 | {
128 | public bool CommunityBanned { get; set; }
129 | public bool VACBanned { get; set; }
130 | public int NumberOfVACBans { get; set; }
131 | public string EconomyBan { get; set; }
132 | }
133 | }
134 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/BanTrigger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | using SteamKit2;
8 |
9 | using SteamChatBot.Triggers.TriggerOptions;
10 |
11 | namespace SteamChatBot.Triggers
12 | {
13 | class BanTrigger : BaseTrigger
14 | {
15 | public BanTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
16 | { }
17 |
18 | public override bool respondToChatMessage(SteamID roomID, SteamID chatterId, string message)
19 | {
20 | return Respond(roomID, chatterId, message);
21 | }
22 |
23 | private bool Respond(SteamID roomID, SteamID userID, string message)
24 | {
25 | string[] query = StripCommand(message, Options.ChatCommand.Command);
26 | if (query != null && query[1] != null)
27 | {
28 | Bot.steamFriends.BanChatMember(roomID, new SteamID(Convert.ToUInt64(query[1])));
29 | return true;
30 | }
31 | return false;
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/ChangeNameTrigger.cs:
--------------------------------------------------------------------------------
1 | using SteamChatBot.Triggers.TriggerOptions;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using SteamKit2;
8 |
9 | namespace SteamChatBot.Triggers
10 | {
11 | class ChangeNameTrigger : BaseTrigger
12 | {
13 | public ChangeNameTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
14 | { }
15 |
16 | public override bool respondToChatMessage(SteamID roomID, SteamID chatterId, string message)
17 | {
18 | return Respond(roomID, chatterId, message, true);
19 | }
20 |
21 | public override bool respondToFriendMessage(SteamID userID, string message)
22 | {
23 | return Respond(userID, userID, message, false);
24 | }
25 |
26 | private bool Respond(SteamID toID, SteamID userID, string message, bool room)
27 | {
28 | string[] query = StripCommand(message, Options.ChatCommand.Command);
29 | if (query != null && query.Length == 1)
30 | {
31 | SendMessageAfterDelay(toID, "Usage: " + Options.ChatCommand.Command + " ", room);
32 | return true;
33 | }
34 | else if (query != null && query.Length >= 2)
35 | {
36 | string name = "";
37 | for (int i = 1; i < query.Length; i++)
38 | {
39 | name += query[i] + " ";
40 | }
41 | name = name.Substring(0, name.Length - 1);
42 |
43 | Bot.steamFriends.SetPersonaName(name);
44 | Bot.displayName = name;
45 | Bot.WriteData();
46 | return true;
47 | }
48 | return false;
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/ChatReplyTrigger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | using SteamKit2;
8 |
9 | using SteamChatBot.Triggers.TriggerOptions;
10 |
11 | namespace SteamChatBot.Triggers
12 | {
13 | class ChatReplyTrigger : BaseTrigger
14 | {
15 | public ChatReplyTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
16 | { }
17 |
18 | public override bool respondToFriendMessage(SteamID userID, string message)
19 | {
20 | return Respond(userID, userID, message, false);
21 | }
22 |
23 | public override bool respondToChatMessage(SteamID roomID, SteamID chatterID, string message)
24 | {
25 | return Respond(roomID, chatterID, message, true);
26 | }
27 |
28 | private bool Respond(SteamID toID, SteamID userID, string message, bool room)
29 | {
30 | if(CheckMessage(message) != false)
31 | {
32 | string response = PickResponse();
33 | SendMessageAfterDelay(toID, response, room);
34 | return true;
35 | }
36 | return false;
37 | }
38 |
39 | private bool CheckMessage(string message)
40 | {
41 | if(Options.ChatReply.Matches != null && Options.ChatReply.Matches.Count > 0)
42 | {
43 | for (int i = 0; i < Options.ChatReply.Matches.Count; i++)
44 | {
45 | string match = Options.ChatReply.Matches[i];
46 | if (message.ToLower() == match.ToLower())
47 | {
48 | return true;
49 | }
50 | }
51 | }
52 | else
53 | {
54 | return false;
55 | }
56 | return false;
57 | }
58 |
59 | private string PickResponse()
60 | {
61 | if(Options.ChatReply.Responses != null && Options.ChatReply.Responses.Count > 0)
62 | {
63 | Random rnd = new Random();
64 | int index = rnd.Next(0, Options.ChatReply.Responses.Count);
65 | return Options.ChatReply.Responses[index];
66 | }
67 | return "";
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/ChooseTrigger.cs:
--------------------------------------------------------------------------------
1 | using SteamChatBot.Triggers.TriggerOptions;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using SteamKit2;
8 |
9 | namespace SteamChatBot.Triggers
10 | {
11 | public class ChooseTrigger : BaseTrigger
12 | {
13 | public ChooseTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
14 | { }
15 |
16 | public override bool respondToChatMessage(SteamID roomID, SteamID chatterId, string message)
17 | {
18 | return Respond(roomID, chatterId, message, true);
19 | }
20 |
21 | public override bool respondToFriendMessage(SteamID userID, string message)
22 | {
23 | return Respond(userID, userID, message, false);
24 | }
25 |
26 | private bool Respond(SteamID toID, SteamID userID, string message, bool room)
27 | {
28 | string[] query = StripCommand(message, Options.ChatCommand.Command);
29 | if(query != null && query.Length == 1)
30 | {
31 | SendMessageAfterDelay(toID, "Usage: " + Options.ChatCommand.Command + " ...", room);
32 | return true;
33 | }
34 | else if(query != null && query.Length > 2)
35 | {
36 | List removed = new List();
37 | for (int i = 1; i < query.Length; i++)
38 | {
39 | removed.Add(query[i]);
40 | }
41 | Random rng = new Random();
42 | string choice = removed[rng.Next(0, removed.Count)];
43 | SendMessageAfterDelay(toID, "I have chosen " + choice, room);
44 | return true;
45 | }
46 | return false;
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/DiscordTrigger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | using Discord;
8 | using SteamKit2;
9 | using SteamChatBot.Triggers.TriggerOptions;
10 |
11 | namespace SteamChatBot.Triggers
12 | {
13 | class DiscordTrigger : BaseTrigger
14 | {
15 | private DiscordClient client;
16 |
17 | public DiscordTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
18 | { }
19 |
20 | public override bool onLoggedOn()
21 | {
22 | client = new DiscordClient();
23 | client.Connect(Options.DiscordOptions.Token);
24 |
25 | client.Ready += Client_Ready;
26 | client.MessageReceived += Client_MessageReceived;
27 | client.UserJoined += Client_UserJoined;
28 | client.UserLeft += Client_UserLeft;
29 | client.ChannelUpdated += Client_ChannelUpdated;
30 | client.UserUpdated += Client_UserUpdated;
31 | client.UserBanned += Client_UserBanned;
32 |
33 | return true;
34 | }
35 |
36 | private void Client_UserBanned(object sender, UserEventArgs e)
37 | {
38 | if(e.Server.Id == Options.DiscordOptions.DiscordServerID)
39 | {
40 | SendMessageAfterDelay(Options.DiscordOptions.SteamChat, string.Format("{0} was banned from Discord", e.User.Name), true);
41 | }
42 | }
43 |
44 | /**
45 | * Discord Section
46 | */
47 |
48 | private void Client_UserLeft(object sender, UserEventArgs e)
49 | {
50 | if(e.Server.Id == Options.DiscordOptions.DiscordServerID)
51 | {
52 | SendMessageAfterDelay(Options.DiscordOptions.SteamChat, string.Format("{0} has left Discord", e.User.Name), true);
53 | }
54 | }
55 |
56 | private void Client_UserJoined(object sender, UserEventArgs e)
57 | {
58 | if(e.Server.Id == Options.DiscordOptions.DiscordServerID)
59 | {
60 | SendMessageAfterDelay(Options.DiscordOptions.SteamChat, string.Format("{0} has joined Discord", e.User.Name), true);
61 | }
62 | }
63 |
64 | private void Client_ChannelUpdated(object sender, ChannelUpdatedEventArgs e)
65 | {
66 | if(e.Server.Id == Options.DiscordOptions.DiscordServerID && e.After.Topic != "" && e.After.Topic != e.Before.Topic)
67 | {
68 | SendMessageAfterDelay(Options.DiscordOptions.SteamChat, "The topic in Discord has been changed to:\n" + e.After.Topic, true);
69 | }
70 | }
71 |
72 | private void Client_UserUpdated(object sender, UserUpdatedEventArgs e)
73 | {
74 | if(e.After.Name != e.Before.Name)
75 | {
76 | SendMessageAfterDelay(Options.DiscordOptions.SteamChat, string.Format("{0} has changed their name in Discord to {1}", e.Before.Name, e.After.Name), true);
77 | }
78 | }
79 |
80 | private void Client_MessageReceived(object sender, MessageEventArgs e)
81 | {
82 | if (e.Channel.Id == Options.DiscordOptions.DiscordServerID && !e.Message.IsAuthor)
83 | {
84 | SendMessageAfterDelay(Options.DiscordOptions.SteamChat, string.Format("{0} sent a message in Discord: {1}", e.Message.User.Name, e.Message.Text), true);
85 | }
86 | }
87 |
88 | private void Client_Ready(object sender, EventArgs e)
89 | {
90 | Log.Instance.Verbose(Bot.username + "/" + Name + ": Connected to Discord with sessionID " + client.SessionId);
91 | SendMessageAfterDelay(Options.DiscordOptions.SteamChat, "Connected to Discord as " + client.CurrentUser.Name, true);
92 | }
93 |
94 | /**
95 | * Steam Section
96 | */
97 |
98 | public override bool respondToChatMessage(SteamID roomID, SteamID chatterId, string message)
99 | {
100 | SendSteamMessage(message, chatterId);
101 | return true;
102 | }
103 |
104 | public override bool respondToEnteredMessage(SteamID roomID, SteamID userID)
105 | {
106 | SendSteamAction("joined Steam", userID);
107 | return true;
108 | }
109 |
110 | public override bool respondToLeftMessage(SteamID roomID, SteamID userID)
111 | {
112 | SendSteamAction("left Steam", userID);
113 | return true;
114 | }
115 |
116 | public override bool respondToKick(SteamID roomID, SteamID kickedId, SteamID kickerId)
117 | {
118 | SendSteamAction("was kicked from Steam", kickedId, kickerId);
119 | return true;
120 | }
121 |
122 | public override bool respondToBan(SteamID roomID, SteamID bannedId, SteamID bannerId)
123 | {
124 | SendSteamAction("was banned from Steam", bannedId, bannerId);
125 | return true;
126 | }
127 |
128 | private void SendSteamMessage(string message, SteamID userID)
129 | {
130 | Channel channel = client.GetChannel(Options.DiscordOptions.DiscordServerID);
131 | channel.SendMessage(string.Format("** {0}: {1} **", Bot.steamFriends.GetFriendPersonaName(userID), message));
132 | }
133 |
134 | private void SendSteamAction(string action, SteamID userID)
135 | {
136 | Channel channel = client.GetChannel(Options.DiscordOptions.DiscordServerID);
137 | channel.SendMessage(string.Format("** {0} {1} **", Bot.steamFriends.GetFriendPersonaName(userID), action));
138 | }
139 |
140 | private void SendSteamAction(string action, SteamID userID, SteamID fromID)
141 | {
142 | Channel channel = client.GetChannel(Options.DiscordOptions.DiscordServerID);
143 | channel.SendMessage(string.Format("** {0} {1} by {2} **", Bot.steamFriends.GetFriendPersonaName(userID), action, Bot.steamFriends.GetFriendPersonaName(fromID)));
144 | }
145 | }
146 | }
147 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/DoormatTrigger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | using SteamKit2;
8 |
9 | using SteamChatBot.Triggers.TriggerOptions;
10 |
11 | namespace SteamChatBot.Triggers
12 | {
13 | class DoormatTrigger : BaseTrigger
14 | {
15 | public DoormatTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
16 | { }
17 |
18 | public override bool respondToEnteredMessage(SteamID roomID, SteamID userID)
19 | {
20 | return SendGreeting(roomID, userID);
21 | }
22 |
23 | private bool SendGreeting(SteamID groupID, SteamID userID)
24 | {
25 | SendMessageAfterDelay(groupID, "Hello " + Bot.steamFriends.GetFriendPersonaName(userID), true);
26 | return true;
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/GoogleTrigger.cs:
--------------------------------------------------------------------------------
1 | using SteamChatBot.Triggers.TriggerOptions;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using SteamKit2;
8 | using System.Net;
9 | using System.IO;
10 | using HtmlAgilityPack;
11 |
12 | namespace SteamChatBot.Triggers
13 | {
14 | class GoogleTrigger : BaseTrigger
15 | {
16 | public GoogleTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
17 | { }
18 |
19 | public override bool respondToChatMessage(SteamID roomID, SteamID chatterId, string message)
20 | {
21 | return Respond(roomID, chatterId, message, true);
22 | }
23 |
24 | public override bool respondToFriendMessage(SteamID userID, string message)
25 | {
26 | return Respond(userID, userID, message, false);
27 | }
28 |
29 | private bool Respond(SteamID toID, SteamID userID, string message, bool room)
30 | {
31 | string[] query = StripCommand(message, Options.ChatCommand.Command);
32 | if (query != null && query.Length == 1)
33 | {
34 | SendMessageAfterDelay(toID, "Usage: " + Options.ChatCommand.Command + " ", room);
35 | return true;
36 | }
37 | else if (query != null && query.Length >= 2)
38 | {
39 | string q = "";
40 | for (int i = 1; i < query.Length; i++)
41 | {
42 | q += query[i] + " ";
43 | }
44 | q = q.Trim();
45 |
46 | StringBuilder sb = new StringBuilder();
47 | byte[] ResultsBuffer = new byte[8192];
48 | string SearchResults = "http://google.com/search?q=" + q;
49 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(SearchResults);
50 | HttpWebResponse response = (HttpWebResponse)request.GetResponse();
51 |
52 | Stream resStream = response.GetResponseStream();
53 | string tempString = null;
54 | int count = 0;
55 | do
56 | {
57 | count = resStream.Read(ResultsBuffer, 0, ResultsBuffer.Length);
58 | if (count != 0)
59 | {
60 | tempString = Encoding.ASCII.GetString(ResultsBuffer, 0, count);
61 | sb.Append(tempString);
62 | }
63 | }
64 | while (count > 0);
65 |
66 | string sbb = sb.ToString();
67 |
68 | HtmlDocument html = new HtmlDocument();
69 | html.OptionOutputAsXml = true;
70 | html.LoadHtml(sbb);
71 | HtmlNode doc = html.DocumentNode;
72 |
73 | foreach (HtmlNode link in doc.SelectNodes("//a[@href]"))
74 | {
75 | string hrefValue = link.GetAttributeValue("href", "");
76 | if (!hrefValue.ToString().ToUpper().Contains("GOOGLE") && hrefValue.ToString().Contains("/url?q=") && hrefValue.ToString().ToUpper().Contains("HTTP://"))
77 | {
78 | int index = hrefValue.IndexOf("&");
79 | if (index > 0)
80 | {
81 | hrefValue = hrefValue.Substring(0, index);
82 | SendMessageAfterDelay(toID, hrefValue.Replace("/url?q=", ""), room);
83 | return true;
84 | }
85 | }
86 | }
87 | }
88 | return false;
89 | }
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/IsUpTrigger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Net;
7 |
8 | using SteamKit2;
9 |
10 | using SteamChatBot.Triggers.TriggerOptions;
11 |
12 | namespace SteamChatBot.Triggers
13 | {
14 | class IsUpTrigger : BaseTrigger
15 | {
16 | public IsUpTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
17 | { }
18 |
19 | public override bool respondToFriendMessage(SteamID userID, string message)
20 | {
21 | return Respond(userID, userID, message, false);
22 | }
23 |
24 | public override bool respondToChatMessage(SteamID roomID, SteamID chatterID, string message)
25 | {
26 | return Respond(roomID, chatterID, message, true);
27 | }
28 |
29 | private bool Respond(SteamID toID, SteamID userID, string message, bool room)
30 | {
31 | string[] query = StripCommand(message, Options.ChatCommand.Command);
32 | if (query != null && query.Length == 1)
33 | {
34 | SendMessageAfterDelay(toID, "Usage: " + Options.ChatCommand.Command + " ", room);
35 | return true;
36 | }
37 | else if (query != null && query.Length == 2)
38 | {
39 | HttpWebResponse response;
40 | try
41 | {
42 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(query[1]);
43 | response = (HttpWebResponse)request.GetResponse();
44 | }
45 | catch (UriFormatException e)
46 | {
47 | Log.Instance.Error(Bot.username + "/" + Name + ": " + e.StackTrace);
48 | SendMessageAfterDelay(toID, "Uri was not in the correct format (missing http:// probably).", true);
49 | response = null;
50 | return false;
51 | }
52 | catch (WebException e)
53 | {
54 | response = ((HttpWebResponse)e.Response);
55 | }
56 | SendMessageAfterDelay(toID, response.StatusCode.ToString() + " (" + (int)response.StatusCode + ")", room);
57 | return true;
58 | }
59 | return false;
60 | }
61 |
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/KickTrigger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | using SteamKit2;
8 |
9 | using SteamChatBot.Triggers.TriggerOptions;
10 |
11 | namespace SteamChatBot.Triggers
12 | {
13 | class KickTrigger : BaseTrigger
14 | {
15 | public KickTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
16 | { }
17 |
18 | public override bool respondToChatMessage(SteamID roomID, SteamID chatterId, string message)
19 | {
20 | return Respond(roomID, chatterId, message);
21 | }
22 |
23 | private bool Respond(SteamID toID, SteamID userID, string message)
24 | {
25 | string[] query = StripCommand(message, Options.ChatCommand.Command);
26 | if (query != null && query.Length == 1)
27 | {
28 | SendMessageAfterDelay(toID, "Usage: " + Options.ChatCommand.Command + " ", true);
29 | return true;
30 | }
31 | else if (query != null && query[1] != null)
32 | {
33 | Bot.steamFriends.KickChatMember(toID, new SteamID(Convert.ToUInt64(query[1])));
34 | return true;
35 | }
36 | return false;
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/LeaveChatTrigger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | using SteamKit2;
8 |
9 | using SteamChatBot.Triggers.TriggerOptions;
10 |
11 | namespace SteamChatBot.Triggers
12 | {
13 | class LeaveChatTrigger : BaseTrigger
14 | {
15 | public LeaveChatTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
16 | { }
17 |
18 | public override bool respondToChatMessage(SteamID roomID, SteamID chatterId, string message)
19 | {
20 | return Respond(roomID, chatterId, message);
21 | }
22 |
23 | private bool Respond(SteamID roomID, SteamID userID, string message)
24 | {
25 | string[] query = StripCommand(message, Options.ChatCommand.Command);
26 | if(query != null)
27 | {
28 | Bot.steamFriends.LeaveChat(roomID);
29 | return true;
30 | }
31 | return false;
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/LinkNameTrigger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Text.RegularExpressions;
6 | using System.Threading.Tasks;
7 | using System.Net;
8 |
9 | using SteamKit2;
10 |
11 | using SteamChatBot.Triggers.TriggerOptions;
12 |
13 | namespace SteamChatBot.Triggers
14 | {
15 | class LinkNameTrigger : BaseTrigger
16 | {
17 | public LinkNameTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
18 | { }
19 |
20 | public override bool respondToChatMessage(SteamID roomID, SteamID chatterId, string message)
21 | {
22 | return Respond(roomID, message, true);
23 | }
24 |
25 | public override bool respondToFriendMessage(SteamID userID, string message)
26 | {
27 | return Respond(userID, message, false);
28 | }
29 |
30 | private bool Respond(SteamID toID, string message, bool room)
31 | {
32 | string pattern = @"\]*\>\s*(?[\s\S]*?)\";
33 | Uri uriResult;
34 | string[] splitmes = message.Split(' ');
35 | for (int i = 0; i < splitmes.Length; i++)
36 | {
37 | try
38 | {
39 | bool result = Uri.TryCreate(splitmes[i], UriKind.Absolute, out uriResult) && (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps);
40 | if (result)
41 | {
42 | using (WebClient client = new WebClient())
43 | {
44 | string body = client.DownloadString(splitmes[i]);
45 | string title = Regex.Match(body, pattern, RegexOptions.IgnoreCase).Groups["Title"].Value;
46 | if (title != null)
47 | {
48 | SendMessageAfterDelay(toID, title.ToString(), room);
49 | return true;
50 | }
51 | }
52 | }
53 | else
54 | {
55 | return false;
56 | }
57 | }
58 | catch (WebException e)
59 | {
60 | Log.Instance.Error(e.StackTrace);
61 | }
62 | }
63 | return false;
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/LockChatTrigger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | using SteamKit2;
8 | using SteamKit2.Internal;
9 |
10 | using SteamChatBot.Triggers.TriggerOptions;
11 |
12 | namespace SteamChatBot.Triggers
13 | {
14 | class LockChatTrigger : BaseTrigger
15 | {
16 | public LockChatTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
17 | { }
18 |
19 | public override bool respondToChatMessage(SteamID roomID, SteamID chatterId, string message)
20 | {
21 | return Respond(roomID, message);
22 | }
23 |
24 | private bool Respond(SteamID roomID, string message)
25 | {
26 | string[] query = StripCommand(message, Options.ChatCommand.Command);
27 | if (query != null)
28 | {
29 | var msg = new ClientMsg();
30 | msg.Body.SteamIdChat = SteamHelper.ToChatID(roomID);
31 | msg.Body.SteamIdUserToActOn = SteamHelper.ToChatID(roomID);
32 | msg.Body.ChatAction = EChatAction.LockChat;
33 |
34 | Bot.steamClient.Send(msg);
35 | return true;
36 | }
37 | return false;
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/MessageIntervalTrigger.cs:
--------------------------------------------------------------------------------
1 | using SteamChatBot.Triggers.TriggerOptions;
2 | using System;
3 | using System.Timers;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using SteamKit2;
9 | using System.ComponentModel;
10 |
11 | namespace SteamChatBot.Triggers
12 | {
13 | class MessageIntervalTrigger : BaseTrigger
14 | {
15 | public MessageIntervalTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
16 | { }
17 |
18 | public override bool onLoad()
19 | {
20 | Timer t = new Timer(Options.MessageIntervalOptions.Interval);
21 | t.Elapsed += T_Elapsed;
22 | t.Enabled = true;
23 | return true;
24 | }
25 |
26 | private void T_Elapsed(object sender, EventArgs e)
27 | {
28 | try
29 | {
30 | foreach(SteamID destination in Options.MessageIntervalOptions.Destinations)
31 | {
32 | SendMessageAfterDelay(destination, Options.MessageIntervalOptions.Message, true);
33 | }
34 | }
35 | catch(Exception err)
36 | {
37 | Log.Instance.Error(err.StackTrace);
38 | }
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/ModerateTrigger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | using SteamKit2;
8 | using SteamKit2.Internal;
9 |
10 | using SteamChatBot.Triggers.TriggerOptions;
11 |
12 | namespace SteamChatBot.Triggers
13 | {
14 | class ModerateChatTrigger : BaseTrigger
15 | {
16 | public ModerateChatTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
17 | { }
18 |
19 | public override bool respondToChatMessage(SteamID roomID, SteamID chatterId, string message)
20 | {
21 | return Respond(roomID, message);
22 | }
23 |
24 | private bool Respond(SteamID roomID, string message)
25 | {
26 | string[] query = StripCommand(message, Options.ChatCommand.Command);
27 |
28 | if(query != null)
29 | {
30 | var msg = new ClientMsg();
31 | msg.Body.SteamIdChat = SteamHelper.ToChatID(roomID);
32 | msg.Body.SteamIdUserToActOn = SteamHelper.ToChatID(roomID);
33 | msg.Body.ChatAction = EChatAction.SetModerated;
34 |
35 | Bot.steamClient.Send(msg);
36 | return true;
37 | }
38 | return false;
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/NoteTrigger.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using Newtonsoft.Json.Converters;
3 | using SteamChatBot.Triggers.TriggerOptions;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.IO;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 | using System.Timers;
11 | using SteamKit2;
12 |
13 | namespace SteamChatBot.Triggers
14 | {
15 | public class NoteTrigger : BaseTrigger
16 | {
17 | private Timer saveNoteTimer;
18 |
19 | public NoteTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
20 | {
21 | saveNoteTimer = new Timer(options.NoteTriggerOptions.SaveTimer);
22 | saveNoteTimer.Elapsed += SaveNoteTimer_Elapsed;
23 | }
24 |
25 | private void SaveNoteTimer_Elapsed(object sender, ElapsedEventArgs e)
26 | {
27 | string json = JsonConvert.SerializeObject(Options.NoteTriggerOptions.Notes);
28 | File.WriteAllText(Options.NoteTriggerOptions.NoteFile, json);
29 | Log.Instance.Silly("{0}/{1}: Wrote notes to {2}", Bot.username, Name, Options.NoteTriggerOptions.NoteFile);
30 | }
31 |
32 | public override bool onLoggedOn()
33 | {
34 | try
35 | {
36 | Options.NoteTriggerOptions.Notes = JsonConvert.DeserializeObject>>(File.ReadAllText(Options.NoteTriggerOptions.NoteFile));
37 | Log.Instance.Silly(Bot.username + "/" + Name + ": Loaded notes from " + Options.NoteTriggerOptions.NoteFile);
38 | }
39 | catch (FileNotFoundException fnfe)
40 | {
41 | File.Create(Options.NoteTriggerOptions.NoteFile);
42 |
43 | }
44 | catch (Exception e)
45 | {
46 | Log.Instance.Error(e.Message + ": " + e.StackTrace);
47 | return false;
48 | }
49 |
50 | if (Options.NoteTriggerOptions.Notes == null)
51 | {
52 | Options.NoteTriggerOptions.Notes = new Dictionary>();
53 | }
54 |
55 | saveNoteTimer.Start();
56 |
57 | return true;
58 | }
59 |
60 | public override bool respondToChatMessage(SteamID roomID, SteamID chatterId, string message)
61 | {
62 | return Respond(roomID, chatterId, message);
63 | }
64 |
65 | private bool Respond(SteamID roomID, SteamID userID, string message)
66 | {
67 | Dictionary db;
68 | ulong room = roomID.ConvertToUInt64();
69 |
70 | if (!Options.NoteTriggerOptions.Notes.ContainsKey(room))
71 | {
72 | Options.NoteTriggerOptions.Notes[room] = new Dictionary();
73 | db = Options.NoteTriggerOptions.Notes[room];
74 | }
75 | else
76 | {
77 | db = Options.NoteTriggerOptions.Notes[room];
78 | }
79 |
80 | string[] query = StripCommand(message, Options.NoteTriggerOptions.NotesCommand);
81 | if(query != null && query.Length == 1)
82 | {
83 | List _notes = new List();
84 | string notes = "";
85 | foreach(string note in db.Keys)
86 | {
87 | _notes.Add(note);
88 | }
89 | notes = string.Join(", ", _notes.ToArray());
90 | SendMessageAfterDelay(roomID, "Please see your personal chat for a list of all the notes in this chat room", true);
91 | SendMessageAfterDelay(userID, "Notes in " + roomID.ConvertToUInt64() + ": " + notes, false);
92 | return true;
93 | }
94 |
95 | query = StripCommand(message, Options.NoteTriggerOptions.DeleteCommand);
96 | if(query != null && query.Length == 1)
97 | {
98 | SendMessageAfterDelay(roomID, "Usage: " + Options.NoteTriggerOptions.DeleteCommand + " ", true);
99 | return true;
100 | }
101 | else if (query != null && query.Length == 2)
102 | {
103 | string name = query[1];
104 | if (!db.ContainsKey(name))
105 | {
106 | SendMessageAfterDelay(roomID, string.Format("The note \"{0}\" does not exist. Use \"{1}\" to create it.", name, Options.NoteTriggerOptions.NoteCommand + " " + name + " "), true);
107 | return true;
108 | }
109 | else
110 | {
111 | db.Remove(name);
112 | SendMessageAfterDelay(roomID, string.Format("Note \"{0}\" deleted", name), true);
113 | return true;
114 | }
115 | }
116 |
117 | query = StripCommand(message, Options.NoteTriggerOptions.InfoCommand);
118 | if (query != null && query.Length == 1)
119 | {
120 | SendMessageAfterDelay(roomID, "Usage: " + Options.NoteTriggerOptions.InfoCommand + " ", true);
121 | return true;
122 | }
123 | else if (query != null && query.Length == 2)
124 | {
125 | string name = query[1];
126 | if (!db.ContainsKey(name))
127 | {
128 | SendMessageAfterDelay(roomID, string.Format("The note \"{0}\" does not exist. Use \"{1}\" to create it.", name, Options.NoteTriggerOptions.NoteCommand + " " + name + " "), true);
129 | return true;
130 | }
131 | else
132 | {
133 | Note note = db[name];
134 | SendMessageAfterDelay(roomID, string.Format("The note \"{0}\" with definition \"{1}\" was last modified by {2} on {3}", name, note.Definition, note.ModifiedBy, note.ModifiedWhen), true);
135 | return true;
136 | }
137 | }
138 |
139 | query = StripCommand(message, Options.NoteTriggerOptions.NoteCommand);
140 | if (query != null && query.Length == 1)
141 | {
142 | SendMessageAfterDelay(roomID, "Usage: " + Options.NoteTriggerOptions.NoteCommand + " [note content]", true);
143 | return true;
144 | }
145 | else if (query != null && query.Length == 2)
146 | {
147 | string name = query[1];
148 | if (!db.ContainsKey(name))
149 | {
150 | SendMessageAfterDelay(roomID, string.Format("The note \"{0}\" does not exist. Use \"{1}\" to create it.", name, Options.NoteTriggerOptions.NoteCommand + " " + name + " "), true);
151 | return true;
152 | }
153 | else
154 | {
155 | Note note = db[name];
156 | SendMessageAfterDelay(roomID, "\"" + note.Definition + "\"", true);
157 | return true;
158 | }
159 | }
160 | else if (query != null && query.Length >= 3)
161 | {
162 | Note note = new Note();
163 |
164 | string name = query[1];
165 | List def = new List();
166 |
167 | for (int i = 2; i < query.Length; i++)
168 | {
169 | def.Add(query[i]);
170 | }
171 |
172 | string definition = string.Join(" ", def);
173 |
174 | note.Definition = definition;
175 | note.ModifiedBy = Bot.steamFriends.GetFriendPersonaName(userID) + " (" + userID.ConvertToUInt64().ToString() + ")";
176 | note.ModifiedWhen = DateTime.Now.ToString();
177 |
178 | if (!db.ContainsKey(name))
179 | {
180 | db.Add(name, note);
181 | }
182 | else
183 | {
184 | db.Remove(name);
185 | db.Add(name, note);
186 | }
187 |
188 | SendMessageAfterDelay(roomID, string.Format("Note \"{0}\" saved", name), true);
189 | return true;
190 | }
191 | return false;
192 | }
193 | }
194 | }
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/PlayGameTrigger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | using SteamChatBot.Triggers.TriggerOptions;
8 | using SteamKit2;
9 | using SteamKit2.Internal;
10 | using SteamKit2.GC;
11 |
12 | namespace SteamChatBot.Triggers
13 | {
14 | class PlayGameTrigger : BaseTrigger
15 | {
16 | public PlayGameTrigger(TriggerType type, string name, TriggerOptionsBase cc) : base(type, name, cc)
17 | { }
18 |
19 | public override bool respondToFriendMessage(SteamID userID, string message)
20 | {
21 | return Respond(userID, message, false);
22 | }
23 |
24 | public override bool respondToChatMessage(SteamID roomID, SteamID chatterId, string message)
25 | {
26 | return Respond(roomID, message, true);
27 | }
28 |
29 | private bool Respond(SteamID toID, string message, bool room)
30 | {
31 | string[] query = StripCommand(message, Options.ChatCommand.Command);
32 | if (query != null && query.Length == 1)
33 | {
34 | SendMessageAfterDelay(toID, "Usage: " + Options.ChatCommand.Command + " ", room);
35 | return true;
36 | }
37 | else if (query != null && query.Length == 2)
38 | {
39 | var gamesPlayed = new ClientMsgProtobuf(EMsg.ClientGamesPlayed);
40 | if(query[1] == "clear")
41 | {
42 | gamesPlayed.Body.games_played.Clear();
43 | Bot.steamClient.Send(gamesPlayed);
44 | return true;
45 | }
46 | else
47 | {
48 | gamesPlayed.Body.games_played.Add(new CMsgClientGamesPlayed.GamePlayed
49 | {
50 | game_id = new GameID(Convert.ToUInt64(query[1]))
51 | });
52 | Bot.steamClient.Send(gamesPlayed);
53 | return true;
54 | }
55 | }
56 | return false;
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TranslateTrigger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using SteamKit2;
7 | using SteamChatBot.Triggers.TriggerOptions;
8 | using System.Net;
9 | using System.IO;
10 |
11 | namespace SteamChatBot.Triggers
12 | {
13 | public class TranslateTrigger : BaseTrigger
14 | {
15 | class TranslateResult
16 | {
17 | public string text { get; set; }
18 | public Pos pos { get; set; }
19 | public string source { get; set; }
20 |
21 | public class Pos
22 | {
23 | public object code { get; set; }
24 | public object title { get; set; }
25 | }
26 | }
27 |
28 | public TranslateTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
29 | { }
30 |
31 | public override bool respondToChatMessage(SteamID roomID, SteamID chatterId, string message)
32 | {
33 | return Respond(roomID, chatterId, message, true);
34 | }
35 |
36 | public override bool respondToFriendMessage(SteamID userID, string message)
37 | {
38 | return Respond(userID, userID, message, false);
39 | }
40 |
41 | private bool Respond(SteamID toID, SteamID userID, string message, bool room)
42 | {
43 | string[] query = StripCommand(message, Options.ChatCommand.Command);
44 | if (query != null && query.Length == 1)
45 | {
46 | SendMessageAfterDelay(toID, "Usage: " + Options.ChatCommand.Command + " ", room);
47 | return true;
48 | }
49 | else if (query != null && query.Length == 4)
50 | {
51 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri("http://hablaa.com/hs/translation/" + query[1] + "/" + query[2] + "-" + query[3] + "/"));
52 | try {
53 | using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
54 | {
55 | if (response.StatusCode == HttpStatusCode.NotFound)
56 | {
57 | return SendNotFound(toID, query, room);
58 | }
59 | else if (response.StatusCode != HttpStatusCode.OK)
60 | {
61 | SendMessageAfterDelay(toID, "Status code from hablaa.com: " + response.StatusCode + "/" + response.StatusDescription, room);
62 | return true;
63 | }
64 | using (StreamReader sr = new StreamReader(response.GetResponseStream()))
65 | {
66 | string text = sr.ReadToEnd();
67 | TranslateResult[] result = text.ParseJSON();
68 | if (result == null)
69 | {
70 | return SendNotFound(toID, query, room);
71 | }
72 | string trans = result[0].text;
73 | if (trans == null || trans == "")
74 | {
75 | return SendNotFound(toID, query, room);
76 | }
77 | else
78 | {
79 | SendMessageAfterDelay(toID, trans, room);
80 | return true;
81 | }
82 | }
83 | }
84 | }
85 | catch(WebException we)
86 | {
87 | return SendNotFound(toID, query, room);
88 | }
89 | }
90 | return false;
91 | }
92 |
93 | private bool SendNotFound(SteamID toID, string[] query, bool room)
94 | {
95 | SendMessageAfterDelay(toID, "Either " + query[1] + " is not defined in that language or one of the languages you specified is incorrect. Please visit http://hablaa.com/hs/translation/" +
96 | query[1] + "/" + query[2] + "-" + query[3] + " for more information.", room);
97 | return true;
98 | }
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TriggerOptions/AntiSpamTriggerOptions.cs:
--------------------------------------------------------------------------------
1 | using SteamKit2;
2 | using System.Collections.Generic;
3 |
4 | namespace SteamChatBot.Triggers.TriggerOptions
5 | {
6 | public class AntiSpamTriggerOptions
7 | {
8 | public string Name { get; set; }
9 | public NoCommand NoCommand { get; set; }
10 | public List admins { get; set; }
11 | public Dictionary> groups { get; set; }
12 | public Score score { get; set; }
13 | public Timers timers { get; set; }
14 | public PTimer ptimer { get; set; }
15 | public string warnMessage { get; set; }
16 | public int msgPenalty { get; set; }
17 | //public Dictionary badWords { get; set; } // TODO: Add badwords
18 | }
19 |
20 | public class Score
21 | {
22 | public int warn { get; set; }
23 | public int warnMax { get; set; }
24 | public int kick { get; set; }
25 | public int ban { get; set; }
26 | public int tattle { get; set; }
27 | public int tattleMax { get; set; }
28 | }
29 |
30 | public class Timers
31 | {
32 | public int messages { get; set; }
33 | public int unban { get; set; }
34 | }
35 |
36 | public class PTimer
37 | {
38 | public int resolution { get; set; }
39 | public int amount { get; set; }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TriggerOptions/ChatCommand.cs:
--------------------------------------------------------------------------------
1 | namespace SteamChatBot.Triggers.TriggerOptions
2 | {
3 | public class ChatCommand
4 | {
5 | public string Name { get; set; }
6 | public string Command { get; set; }
7 | public TriggerNumbers TriggerNumbers { get; set; }
8 | public TriggerLists TriggerLists { get; set; }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TriggerOptions/ChatCommandApi.cs:
--------------------------------------------------------------------------------
1 | namespace SteamChatBot.Triggers.TriggerOptions
2 | {
3 | public class ChatCommandApi
4 | {
5 | public string Name { get; set; }
6 | public ChatCommand ChatCommand { get; set; }
7 | public string ApiKey { get; set; }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TriggerOptions/ChatReply.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace SteamChatBot.Triggers.TriggerOptions
4 | {
5 | public class ChatReply
6 | {
7 | public string Name { get; set; }
8 | public List Matches { get; set; }
9 | public List Responses { get; set; }
10 | public TriggerNumbers TriggerNumbers { get; set; }
11 | public TriggerLists TriggerLists { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TriggerOptions/DiscordOptions.cs:
--------------------------------------------------------------------------------
1 | using SteamKit2;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace SteamChatBot.Triggers.TriggerOptions
9 | {
10 | public class DiscordOptions
11 | {
12 | public string Name { get; set; }
13 | public string Token { get; set; }
14 | public SteamID SteamChat { get; set; }
15 | public ulong DiscordServerID { get; set; }
16 | public NoCommand NoCommand { get; set; }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TriggerOptions/MessageIntervalOptions.cs:
--------------------------------------------------------------------------------
1 | using SteamKit2;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace SteamChatBot.Triggers.TriggerOptions
9 | {
10 | public class MessageIntervalOptions
11 | {
12 | public string Name { get; set; }
13 | public int Interval { get; set; }
14 | public List Destinations { get; set; }
15 | public string Message { get; set; }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TriggerOptions/NoCommand.cs:
--------------------------------------------------------------------------------
1 | namespace SteamChatBot.Triggers.TriggerOptions
2 | {
3 | public class NoCommand
4 | {
5 | public string Name { get; set; }
6 | public TriggerNumbers TriggerNumbers { get; set; }
7 | public TriggerLists TriggerLists { get; set; }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TriggerOptions/NoteTriggerOptions.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using SteamKit2;
3 |
4 | namespace SteamChatBot.Triggers.TriggerOptions
5 | {
6 | public class NoteTriggerOptions
7 | {
8 | public string Name { get; set; }
9 | public string NoteCommand { get; set; }
10 | public string InfoCommand { get; set; }
11 | public string DeleteCommand { get; set; }
12 | public string NotesCommand { get; set; }
13 | public NoCommand NoCommand { get; set; }
14 | public Dictionary> Notes { get; set; }
15 | public int SaveTimer { get; set; }
16 | public string NoteFile { get; set; }
17 | }
18 |
19 | public class Note
20 | {
21 | public string ModifiedWhen { get; set; }
22 | public string ModifiedBy { get; set; }
23 | public string Definition { get; set; }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TriggerOptions/NotificationOptions.cs:
--------------------------------------------------------------------------------
1 | using SteamKit2;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace SteamChatBot.Triggers.TriggerOptions
9 | {
10 | public class NotificationOptions
11 | {
12 | public string Name { get; set; }
13 | public NoCommand NoCommand { get; set; }
14 | public string APICommand { get; set; }
15 | public string SeenCommand { get; set; }
16 | public string FilterCommand { get; set; }
17 | public string ClearCommand { get; set; }
18 | public string DBFile { get; set; }
19 | public int SaveTimer { get; set; }
20 | public Dictionary DB { get; set; }
21 | }
22 |
23 | public class DB
24 | {
25 | public ulong userID { get; set; }
26 | public string name { get; set; }
27 | public DateTime seen { get; set; }
28 | public PushBullet pb { get; set; }
29 | }
30 |
31 | public class PushBullet
32 | {
33 | public string apikey { get; set; }
34 | public List filter { get; set; }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TriggerOptions/OptionType.cs:
--------------------------------------------------------------------------------
1 | namespace SteamChatBot.Triggers.TriggerOptions
2 | {
3 | public enum OptionType
4 | {
5 | ChatCommand,
6 | ChatReply,
7 | NoCommand,
8 | ChatCommandAPI,
9 | JustLists,
10 | ListsAndNumbers,
11 | AntiSpamTrigger,
12 | DiscordTrigger,
13 | NoteTriggerOptions,
14 | NotificationOptions,
15 | MessageIntervalOptions
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TriggerOptions/TriggerLists.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using SteamKit2;
3 |
4 | namespace SteamChatBot.Triggers.TriggerOptions
5 | {
6 | public class TriggerLists
7 | {
8 | public string Name { get; set; }
9 | public List Ignore { get; set; }
10 | public List User { get; set; }
11 | public List Rooms { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TriggerOptions/TriggerNumbers.cs:
--------------------------------------------------------------------------------
1 | namespace SteamChatBot.Triggers.TriggerOptions
2 | {
3 | public class TriggerNumbers
4 | {
5 | public string Name { get; set; }
6 | public int? Delay { get; set; }
7 | public int? Timeout { get; set; }
8 | public float? Probability { get; set; }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TriggerOptions/TriggerOptionsBase.cs:
--------------------------------------------------------------------------------
1 | namespace SteamChatBot.Triggers.TriggerOptions
2 | {
3 | public class TriggerOptionsBase
4 | {
5 | public TriggerType Type { get; set; }
6 | public string Name { get; set; }
7 | public ChatCommand ChatCommand { get; set; }
8 | public ChatCommandApi ChatCommandApi { get; set; }
9 | public ChatReply ChatReply { get; set; }
10 | public NoCommand NoCommand { get; set; }
11 | public TriggerLists TriggerLists { get; set; }
12 | public TriggerNumbers TriggerNumbers { get; set; }
13 | public AntiSpamTriggerOptions AntiSpamTriggerOptions { get; set; }
14 | public DiscordOptions DiscordOptions { get; set; }
15 | public NoteTriggerOptions NoteTriggerOptions { get; set; }
16 | public NotificationOptions NotificationOptions { get; set; }
17 | public MessageIntervalOptions MessageIntervalOptions { get; set; }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TriggerOptions/Windows/AntiSpamTriggerOptionsWindow.xaml:
--------------------------------------------------------------------------------
1 |
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/Triggers/TriggerOptions/Windows/AntiSpamTriggerOptionsWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using SteamKit2;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Data;
10 | using System.Windows.Documents;
11 | using System.Windows.Input;
12 | using System.Windows.Media;
13 | using System.Windows.Media.Imaging;
14 | using System.Windows.Shapes;
15 |
16 | namespace SteamChatBot.Triggers.TriggerOptions.Windows
17 | {
18 | ///
19 | /// Interaction logic for AntiSpamTriggerOptionsWindow.xaml
20 | ///
21 | public partial class AntiSpamTriggerOptionsWindow : Window
22 | {
23 | public NoCommand NC { get; set; }
24 | public AntiSpamTriggerOptions ASTO { get; set; }
25 |
26 | NoCommandWindow ncw = new NoCommandWindow();
27 |
28 | public AntiSpamTriggerOptionsWindow()
29 | {
30 | InitializeComponent();
31 | }
32 |
33 | private void doneButton_Click(object sender, RoutedEventArgs e)
34 | {
35 | ncw.ShowDialog();
36 | if (ncw.DialogResult == true)
37 | {
38 | NC = ncw.NC;
39 | ASTO = new AntiSpamTriggerOptions
40 | {
41 | Name = NC.Name,
42 | admins = new List(),
43 | warnMessage = "Spamming is against the rules!",
44 | msgPenalty = 1,
45 | score = new Score
46 | {
47 | warn = 3,
48 | warnMax = 5,
49 | kick = 6,
50 | ban = 8,
51 | tattle = 4,
52 | tattleMax = 5
53 | },
54 | timers = new Timers
55 | {
56 | messages = 5000,
57 | unban = 1000 * 60 * 5
58 | },
59 | ptimer = new PTimer
60 | {
61 | resolution = 1000,
62 | amount = 1
63 | },
64 | groups = new Dictionary>(),
65 | NoCommand = NC
66 | };
67 |
68 | List admins = new List();
69 |
70 | if (adminsBox.Text.Split(',').Length > 0 && adminsBox.Text != "")
71 | {
72 | try {
73 | foreach (string admin in adminsBox.Text.Split(','))
74 | {
75 | admins.Add(new SteamID(Convert.ToUInt64(admin)));
76 | }
77 | }
78 | catch(Exception err)
79 | {
80 | MessageBox.Show(err.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
81 | }
82 | }
83 |
84 | if (warnMsgBox.Text != "") ASTO.warnMessage = warnMsgBox.Text;
85 | if (penaltyBox.Text != "") ASTO.msgPenalty = Convert.ToInt32(penaltyBox.Text);
86 | if (resolutionBox.Text != "") ASTO.ptimer.resolution = Convert.ToInt32(resolutionBox.Text);
87 | if (amountBox.Text != "") ASTO.ptimer.amount = Convert.ToInt32(amountBox.Text);
88 | if (unbanBox.Text != "") ASTO.timers.unban = Convert.ToInt32(unbanBox.Text);
89 |
90 | if (warn.Text != "") ASTO.score.warn = Convert.ToInt32(warn.Text);
91 | if (warnMax.Text != "") ASTO.score.warnMax = Convert.ToInt32(warnMax.Text);
92 | if (ban.Text != "") ASTO.score.ban = Convert.ToInt32(ban.Text);
93 | if (kick.Text != "") ASTO.score.kick = Convert.ToInt32(kick.Text);
94 | if (tattle.Text != "") ASTO.score.tattle = Convert.ToInt32(tattle.Text);
95 | if (tattleMax.Text != "") ASTO.score.tattleMax = Convert.ToInt32(tattleMax.Text);
96 |
97 | ASTO.admins = admins;
98 | DialogResult = true;
99 | Close();
100 | }
101 | }
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TriggerOptions/Windows/ChatCommandApiWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TriggerOptions/Windows/ChatCommandApiWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Shapes;
14 |
15 | using SteamKit2;
16 |
17 | namespace SteamChatBot.Triggers.TriggerOptions.Windows
18 | {
19 | ///
20 | /// Interaction logic for ChatCommandApiWindow.xaml
21 | ///
22 | public partial class ChatCommandApiWindow : Window
23 | {
24 | public ChatCommandApi CCA { get; set; }
25 | public ChatCommand CC { get; set; }
26 |
27 | ChatCommandWindow ccw = new ChatCommandWindow();
28 | public ChatCommandApiWindow()
29 | {
30 | InitializeComponent();
31 | }
32 |
33 | private void button_Click(object sender, RoutedEventArgs e)
34 | {
35 | if (apiBox.Text == "")
36 | {
37 | MessageBox.Show("You must include an API key", "Error", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
38 | }
39 | else
40 | {
41 | ccw.ShowDialog();
42 | if (ccw.DialogResult.HasValue && ccw.DialogResult == true)
43 | {
44 | CC = ccw.CC;
45 | CCA = new ChatCommandApi()
46 | {
47 | Name = CC.Name,
48 | ApiKey = "",
49 | ChatCommand = new ChatCommand()
50 | };
51 |
52 | if (apiBox.Text == "")
53 | {
54 | MessageBox.Show("You must include an API key.", "Error", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK);
55 | }
56 | else
57 | {
58 | CCA.ApiKey = apiBox.Text;
59 | }
60 |
61 | DialogResult = true;
62 | Close();
63 | }
64 | }
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TriggerOptions/Windows/ChatCommandWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TriggerOptions/Windows/ChatCommandWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Shapes;
14 |
15 | using SteamKit2;
16 |
17 | namespace SteamChatBot.Triggers.TriggerOptions.Windows
18 | {
19 | ///
20 | /// Interaction logic for ChatCommandWindow.xaml
21 | ///
22 | public partial class ChatCommandWindow : Window
23 | {
24 | public ChatCommand CC { get; set; }
25 |
26 | public ChatCommandWindow()
27 | {
28 | InitializeComponent();
29 | }
30 |
31 | private void button_Click(object sender, RoutedEventArgs e)
32 | {
33 | if (commandBox.Text == "" || nameBox.Text == "")
34 | {
35 | MessageBox.Show("You must include a name and a command.", "Error", MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK);
36 | }
37 | else
38 | {
39 | CC = new ChatCommand()
40 | {
41 | Name = "",
42 | Command = "",
43 | TriggerNumbers = new TriggerNumbers(),
44 | TriggerLists = new TriggerLists()
45 | };
46 |
47 | CC.Command = commandBox.Text;
48 | CC.Name = nameBox.Text;
49 | List ignores = new List();
50 | List rooms = new List();
51 | List users = new List();
52 | if (delayBox.Text == "") CC.TriggerNumbers.Delay = null;
53 | else CC.TriggerNumbers.Delay = Convert.ToInt32(delayBox.Text);
54 |
55 | if (probBox.Text == "") CC.TriggerNumbers.Probability = null;
56 | else CC.TriggerNumbers.Probability = (float)Convert.ToDouble(probBox.Text);
57 |
58 | if (timeoutBox.Text == "") CC.TriggerNumbers.Timeout = null;
59 | else CC.TriggerNumbers.Timeout = Convert.ToInt32(timeoutBox.Text);
60 |
61 | if (ignoresBox.Text.Split(',').Length > 0 && ignoresBox.Text != "")
62 | {
63 | foreach (string ignore in ignoresBox.Text.Split(','))
64 | {
65 | ignores.Add(new SteamID(Convert.ToUInt64(ignore)));
66 | }
67 | }
68 | if (roomsBox.Text.Split(',').Length > 0 && roomsBox.Text != "")
69 | {
70 | foreach (string room in roomsBox.Text.Split(','))
71 | {
72 | rooms.Add(new SteamID(Convert.ToUInt64(room)));
73 | }
74 | }
75 | if (usersBox.Text.Split(',').Length > 0 && usersBox.Text != "")
76 | {
77 | foreach (string user in usersBox.Text.Split(','))
78 | {
79 | users.Add(new SteamID(Convert.ToUInt64(user)));
80 | }
81 | }
82 |
83 | CC.TriggerLists.Ignore = ignores;
84 | CC.TriggerLists.Rooms = rooms;
85 | CC.TriggerLists.User = users;
86 | DialogResult = true;
87 | Close();
88 | }
89 | }
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TriggerOptions/Windows/ChatReplyWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TriggerOptions/Windows/ChatReplyWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Shapes;
14 |
15 | using SteamKit2;
16 |
17 | namespace SteamChatBot.Triggers.TriggerOptions.Windows
18 | {
19 | ///
20 | /// Interaction logic for ChatReplyWindow.xaml
21 | ///
22 | public partial class ChatReplyWindow : Window
23 | {
24 | public ChatReply CR { get; set; }
25 |
26 | public ChatReplyWindow()
27 | {
28 | InitializeComponent();
29 | }
30 |
31 | private void button_Click(object sender, RoutedEventArgs e)
32 | {
33 | if(matchesBox.Text == "" || responsesBox.Text == "" || nameBox.Text == "")
34 | {
35 | MessageBox.Show("You must include matches, responses, and a name.", "Error", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
36 | }
37 | else
38 | {
39 | CR = new ChatReply
40 | {
41 | Name = "",
42 | Matches = new List(),
43 | Responses = new List(),
44 | TriggerLists = new TriggerLists(),
45 | TriggerNumbers = new TriggerNumbers()
46 | };
47 |
48 | CR.Name = nameBox.Text;
49 | CR.Matches = matchesBox.Text.Split(',').ToList();
50 | CR.Responses = responsesBox.Text.Split(',').ToList();
51 |
52 | List ignores = new List();
53 | List rooms = new List();
54 | List users = new List();
55 | if (delayBox.Text == "") CR.TriggerNumbers.Delay = null;
56 | else CR.TriggerNumbers.Delay = Convert.ToInt32(delayBox.Text);
57 |
58 | if (probBox.Text == "") CR.TriggerNumbers.Probability = null;
59 | else CR.TriggerNumbers.Probability = (float)Convert.ToDouble(probBox.Text);
60 |
61 | if (timeoutBox.Text == "") CR.TriggerNumbers.Timeout = null;
62 | else CR.TriggerNumbers.Timeout = Convert.ToInt32(timeoutBox.Text);
63 |
64 | if (ignoresBox.Text.Split(',').Length > 0 && ignoresBox.Text != "")
65 | {
66 | foreach (string ignore in ignoresBox.Text.Split(','))
67 | {
68 | ignores.Add(new SteamID(Convert.ToUInt64(ignore)));
69 | }
70 | }
71 | if (roomsBox.Text.Split(',').Length > 0 && roomsBox.Text != "")
72 | {
73 | foreach (string room in roomsBox.Text.Split(','))
74 | {
75 | rooms.Add(new SteamID(Convert.ToUInt64(room)));
76 | }
77 | }
78 | if (usersBox.Text.Split(',').Length > 0 && usersBox.Text != "")
79 | {
80 | foreach (string user in usersBox.Text.Split(','))
81 | {
82 | users.Add(new SteamID(Convert.ToUInt64(user)));
83 | }
84 | }
85 |
86 | CR.TriggerLists.Ignore = ignores;
87 | CR.TriggerLists.Rooms = rooms;
88 | CR.TriggerLists.User = users;
89 | DialogResult = true;
90 | Close();
91 | }
92 | }
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TriggerOptions/Windows/DiscordTriggerOptionsWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TriggerOptions/Windows/DiscordTriggerOptionsWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Shapes;
14 |
15 | namespace SteamChatBot.Triggers.TriggerOptions.Windows
16 | {
17 | ///
18 | /// Interaction logic for DiscordTriggerOptionsWindow.xaml
19 | ///
20 | public partial class DiscordTriggerOptionsWindow : Window
21 | {
22 | public NoCommand NC { get; set; }
23 | public DiscordOptions DO { get; set; }
24 |
25 | NoCommandWindow ncw = new NoCommandWindow();
26 |
27 | public DiscordTriggerOptionsWindow()
28 | {
29 | InitializeComponent();
30 | }
31 |
32 | private void doneButton_Click(object sender, RoutedEventArgs e)
33 | {
34 | ncw.ShowDialog();
35 | if(ncw.DialogResult == true)
36 | {
37 | NC = ncw.NC;
38 | DO = new DiscordOptions
39 | {
40 | Name = NC.Name,
41 | Token = "",
42 | SteamChat = new SteamKit2.SteamID(),
43 | DiscordServerID = 0
44 | };
45 | }
46 |
47 | if(tokenBox.Text == "")
48 | {
49 | MessageBox.Show("Token is required!", "Error", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
50 | }
51 | else
52 | {
53 | DO.Token = tokenBox.Text;
54 | }
55 |
56 | if (steamchatBox.Text == "")
57 | {
58 | MessageBox.Show("Steam Chat ID is required!", "Error", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
59 | }
60 | else
61 | {
62 | DO.SteamChat = new SteamKit2.SteamID(Convert.ToUInt64(steamchatBox.Text));
63 | }
64 |
65 | if (serverIDBox.Text == "")
66 | {
67 | MessageBox.Show("Discord Server ID is required!", "Error", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
68 | }
69 | else
70 | {
71 | DO.DiscordServerID = Convert.ToUInt64(serverIDBox.Text);
72 | }
73 |
74 | DialogResult = true;
75 | Close();
76 | }
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TriggerOptions/Windows/MessageIntervalOptionsWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TriggerOptions/Windows/MessageIntervalOptionsWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using SteamKit2;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Data;
10 | using System.Windows.Documents;
11 | using System.Windows.Input;
12 | using System.Windows.Media;
13 | using System.Windows.Media.Imaging;
14 | using System.Windows.Shapes;
15 |
16 | namespace SteamChatBot.Triggers.TriggerOptions.Windows
17 | {
18 | ///
19 | /// Interaction logic for MessageIntervalOptionsWindow.xaml
20 | ///
21 | public partial class MessageIntervalOptionsWindow : Window
22 | {
23 | public MessageIntervalOptions MIO { get; set; }
24 |
25 | public MessageIntervalOptionsWindow()
26 | {
27 | InitializeComponent();
28 | }
29 |
30 | private void doneButton_Click(object sender, RoutedEventArgs e)
31 | {
32 | if (nameBox.Text == "" || destinationsBox.Text == "" || messageBox.Text == "")
33 | {
34 | MessageBox.Show("You must include a name, destinations, and a message.", "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation, MessageBoxResult.OK);
35 | }
36 | else {
37 | MIO = new MessageIntervalOptions
38 | {
39 | Name = nameBox.Text,
40 | Interval = 1000 * 60 * 5,
41 | Destinations = new List(),
42 | Message = messageBox.Text
43 | };
44 |
45 | List destinations = new List();
46 |
47 | if (intervalBox.Text != "") MIO.Interval = Convert.ToInt32(intervalBox.Text);
48 | if (destinationsBox.Text.Split(',').Length > 0)
49 | {
50 | foreach (string destination in destinationsBox.Text.Split(','))
51 | {
52 | destinations.Add(new SteamID(Convert.ToUInt64(destination)));
53 | }
54 | }
55 |
56 | MIO.Destinations = destinations;
57 | DialogResult = true;
58 | Close();
59 | }
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TriggerOptions/Windows/NoCommandWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TriggerOptions/Windows/NoCommandWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Shapes;
14 |
15 | using SteamKit2;
16 |
17 | namespace SteamChatBot.Triggers.TriggerOptions.Windows
18 | {
19 | ///
20 | /// Interaction logic for NoCommandWindow.xaml
21 | ///
22 | public partial class NoCommandWindow : Window
23 | {
24 | public NoCommand NC { get; set; }
25 |
26 | public NoCommandWindow()
27 | {
28 | InitializeComponent();
29 | }
30 |
31 | private void button_Click(object sender, RoutedEventArgs e)
32 | {
33 | if(nameBox.Text == "")
34 | {
35 | MessageBox.Show("You must include a name.", "Error", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
36 | }
37 | else
38 | {
39 | NC = new NoCommand
40 | {
41 | Name = "",
42 | TriggerNumbers = new TriggerNumbers(),
43 | TriggerLists = new TriggerLists()
44 | };
45 |
46 | NC.Name = nameBox.Text;
47 | List ignores = new List();
48 | List rooms = new List();
49 | List users = new List();
50 | if (delayBox.Text == "") NC.TriggerNumbers.Delay = null;
51 | else NC.TriggerNumbers.Delay = Convert.ToInt32(delayBox.Text);
52 |
53 | if (probBox.Text == "") NC.TriggerNumbers.Probability = null;
54 | else NC.TriggerNumbers.Probability = (float)Convert.ToDouble(probBox.Text);
55 |
56 | if (timeoutBox.Text == "") NC.TriggerNumbers.Timeout = null;
57 | else NC.TriggerNumbers.Timeout = Convert.ToInt32(timeoutBox.Text);
58 |
59 | if (ignoresBox.Text.Split(',').Length > 0 && ignoresBox.Text != "")
60 | {
61 | foreach (string ignore in ignoresBox.Text.Split(','))
62 | {
63 | ignores.Add(new SteamID(Convert.ToUInt64(ignore)));
64 | }
65 | }
66 | if (roomsBox.Text.Split(',').Length > 0 && roomsBox.Text != "")
67 | {
68 | foreach (string room in roomsBox.Text.Split(','))
69 | {
70 | rooms.Add(new SteamID(Convert.ToUInt64(room)));
71 | }
72 | }
73 | if (usersBox.Text.Split(',').Length > 0 && usersBox.Text != "")
74 | {
75 | foreach (string user in usersBox.Text.Split(','))
76 | {
77 | users.Add(new SteamID(Convert.ToUInt64(user)));
78 | }
79 | }
80 |
81 | NC.TriggerLists.Ignore = ignores;
82 | NC.TriggerLists.Rooms = rooms;
83 | NC.TriggerLists.User = users;
84 | DialogResult = true;
85 | Close();
86 | }
87 | }
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TriggerOptions/Windows/NoteTriggerOptionsWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TriggerOptions/Windows/NoteTriggerOptionsWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Win32;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Data;
10 | using System.Windows.Documents;
11 | using System.Windows.Input;
12 | using System.Windows.Media;
13 | using System.Windows.Media.Imaging;
14 | using System.Windows.Shapes;
15 |
16 | namespace SteamChatBot.Triggers.TriggerOptions.Windows
17 | {
18 | ///
19 | /// Interaction logic for NoteTriggerOptionsWindow.xaml
20 | ///
21 | public partial class NoteTriggerOptionsWindow : Window
22 | {
23 | public NoteTriggerOptions NTO { get; set; }
24 | public NoCommand NC { get; set; }
25 |
26 | NoCommandWindow ncw = new NoCommandWindow();
27 | public NoteTriggerOptionsWindow()
28 | {
29 | InitializeComponent();
30 | }
31 |
32 | private void doneButton_Click(object sender, RoutedEventArgs e)
33 | {
34 | ncw.ShowDialog();
35 | if (ncw.DialogResult.HasValue && ncw.DialogResult == true)
36 | {
37 | NC = ncw.NC;
38 | NTO = new NoteTriggerOptions
39 | {
40 | Name = NC.Name,
41 | NoteCommand = "!note",
42 | InfoCommand = "!note_info",
43 | DeleteCommand = "!note_delete",
44 | SaveTimer = 1000 * 60 * 5,
45 | NoteFile = AppDomain.CurrentDomain.BaseDirectory + "/notes.json",
46 | NotesCommand = "!notes"
47 | };
48 |
49 | if (noteCommandBox.Text != "") NTO.NoteCommand = noteCommandBox.Text;
50 | if (infoCommandBox.Text != "") NTO.InfoCommand = infoCommandBox.Text;
51 | if (deleteCommandBox.Text != "") NTO.DeleteCommand = deleteCommandBox.Text;
52 | if (saveTimerBox.Text != "") NTO.SaveTimer = Convert.ToInt32(saveTimerBox.Text);
53 | if (noteFileBox.Text != "") NTO.NoteFile = noteFileBox.Text;
54 | if (notesCommandBox.Text != "") NTO.NotesCommand = notesCommandBox.Text;
55 |
56 | DialogResult = true;
57 | Close();
58 | }
59 | }
60 |
61 | private void noteFileBox_GotFocus(object sender, RoutedEventArgs e)
62 | {
63 | string file = "";
64 | OpenFileDialog ofd = new OpenFileDialog();
65 |
66 | if(ofd.ShowDialog() == true)
67 | {
68 | file = ofd.FileName;
69 | noteFileBox.Text = ofd.FileName;
70 | }
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TriggerOptions/Windows/NotificationOptionsWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TriggerOptions/Windows/NotificationOptionsWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Win32;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Data;
10 | using System.Windows.Documents;
11 | using System.Windows.Input;
12 | using System.Windows.Media;
13 | using System.Windows.Media.Imaging;
14 | using System.Windows.Shapes;
15 |
16 | namespace SteamChatBot.Triggers.TriggerOptions.Windows
17 | {
18 | ///
19 | /// Interaction logic for NotificationOptionsWindow.xaml
20 | ///
21 | public partial class NotificationOptionsWindow : Window
22 | {
23 | public NotificationOptions NO { get; set; }
24 | public NoCommand NC { get; set; }
25 |
26 | NoCommandWindow ncw = new NoCommandWindow();
27 |
28 | public NotificationOptionsWindow()
29 | {
30 | InitializeComponent();
31 | }
32 |
33 | private void doneButton_Click(object sender, RoutedEventArgs e)
34 | {
35 | ncw.ShowDialog();
36 | if(ncw.DialogResult.HasValue && ncw.DialogResult == true)
37 | {
38 | NC = ncw.NC;
39 | NO = new NotificationOptions
40 | {
41 | Name = ncw.NC.Name,
42 | SaveTimer = 1000 * 60 * 5,
43 | APICommand = "!pbapi",
44 | SeenCommand = "!seen",
45 | FilterCommand = "!filter",
46 | ClearCommand = "!clear",
47 | DBFile = AppDomain.CurrentDomain.BaseDirectory + "/notification.json",
48 | };
49 |
50 | if (saveTimerBox.Text != "") NO.SaveTimer = Convert.ToInt32(saveTimerBox.Text);
51 | if (dbFileBox.Text != "") NO.DBFile = dbFileBox.Text;
52 | if (clearCommandBox.Text != "") NO.ClearCommand = clearCommandBox.Text;
53 | if (apiCommandBox.Text != "") NO.APICommand = apiCommandBox.Text;
54 | if (seenCommandBox.Text != "") NO.SeenCommand = seenCommandBox.Text;
55 | if (filterCommandBox.Text != "") NO.FilterCommand = filterCommandBox.Text;
56 | }
57 |
58 | DialogResult = true;
59 | Close();
60 | }
61 |
62 | private void dbFileBox_GotFocus(object sender, RoutedEventArgs e)
63 | {
64 | string file = "";
65 | OpenFileDialog ofd = new OpenFileDialog();
66 |
67 | if(ofd.ShowDialog() == true)
68 | {
69 | file = ofd.FileName;
70 | dbFileBox.Text = ofd.FileName;
71 | }
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TriggerOptions/Windows/TriggerListWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TriggerOptions/Windows/TriggerListWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Shapes;
14 |
15 | using SteamKit2;
16 |
17 | namespace SteamChatBot.Triggers.TriggerOptions.Windows
18 | {
19 | ///
20 | /// Interaction logic for TriggerListWindow.xaml
21 | ///
22 | public partial class TriggerListWindow : Window
23 | {
24 | public TriggerLists TL { get; set; }
25 |
26 | public TriggerListWindow(string triggername)
27 | {
28 | InitializeComponent();
29 | if(triggername == "acceptFriendRequestTrigger")
30 | {
31 | roomsLabel.IsEnabled = false;
32 | roomsBox.IsEnabled = false;
33 | }
34 | else if(triggername == "autojoinChatTrigger")
35 | {
36 | usersBox.IsEnabled = false;
37 | usersLabel.IsEnabled = false;
38 | ignoresBox.IsEnabled = false;
39 | ignoresLabel.IsEnabled = false;
40 | }
41 | }
42 |
43 | private void button_Click(object sender, RoutedEventArgs e)
44 | {
45 | if(nameBox.Text == "")
46 | {
47 | MessageBox.Show("You must include a name.", "Error", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
48 | }
49 | TL = new TriggerLists()
50 | {
51 | Name = "",
52 | User = new List(),
53 | Rooms = new List(),
54 | Ignore = new List(),
55 | };
56 |
57 | TL.Name = nameBox.Text;
58 | List ignores = new List();
59 | List rooms = new List();
60 | List users = new List();
61 |
62 | if (ignoresBox.Text.Split(',').Length > 0 && ignoresBox.Text != "")
63 | {
64 | foreach (string ignore in ignoresBox.Text.Split(','))
65 | {
66 | ignores.Add(new SteamID(Convert.ToUInt64(ignore)));
67 | }
68 | }
69 | if (roomsBox.Text.Split(',').Length > 0 && roomsBox.Text != "")
70 | {
71 | foreach (string room in roomsBox.Text.Split(','))
72 | {
73 | rooms.Add(new SteamID(Convert.ToUInt64(room)));
74 | }
75 | }
76 | if (usersBox.Text.Split(',').Length > 0 && usersBox.Text != "")
77 | {
78 | foreach (string user in usersBox.Text.Split(','))
79 | {
80 | users.Add(new SteamID(Convert.ToUInt64(user)));
81 | }
82 | }
83 |
84 | TL.Ignore = ignores;
85 | TL.Rooms = rooms;
86 | TL.User = users;
87 | DialogResult = true;
88 | Close();
89 | }
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/TriggerType.cs:
--------------------------------------------------------------------------------
1 | namespace SteamChatBot.Triggers
2 | {
3 | public enum TriggerType
4 | {
5 | AcceptChatInviteTrigger,
6 | AcceptFriendRequestTrigger,
7 | AntispamTrigger,
8 | AutojoinChatTrigger,
9 | BanCheckTrigger,
10 | BanTrigger,
11 | ChatReplyTrigger,
12 | DiscordTrigger,
13 | DoormatTrigger,
14 | IsUpTrigger,
15 | KickTrigger,
16 | LeaveChatTrigger,
17 | LinkNameTrigger,
18 | LockChatTrigger,
19 | ModerateChatTrigger,
20 | NoteTrigger,
21 | NotificationTrigger,
22 | PlayGameTrigger,
23 | UnbanTrigger,
24 | UnlockChatTrigger,
25 | UnmoderateChatTrigger,
26 | WeatherTrigger,
27 | YoutubeTrigger,
28 | ChangeNameTrigger,
29 | GoogleTrigger,
30 | MessageIntervalTrigger,
31 | ChooseTrigger,
32 | TranslateTrigger
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/UnbanTrigger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | using SteamKit2;
8 |
9 | using SteamChatBot.Triggers.TriggerOptions;
10 |
11 | namespace SteamChatBot.Triggers
12 | {
13 | class UnbanTrigger : BaseTrigger
14 | {
15 | public UnbanTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
16 | { }
17 |
18 | public override bool respondToChatMessage(SteamID roomID, SteamID chatterId, string message)
19 | {
20 | return Respond(roomID, chatterId, message);
21 | }
22 |
23 | private bool Respond(SteamID roomID, SteamID userID, string message)
24 | {
25 | string[] query = StripCommand(message, Options.ChatCommand.Command);
26 | if (query != null && query.Length == 1)
27 | {
28 | SendMessageAfterDelay(roomID, "Usage: " + Options.ChatCommand.Command + " ", true);
29 | return true;
30 | }
31 | else if (query != null && query[1] != null)
32 | {
33 | Bot.steamFriends.UnbanChatMember(roomID, new SteamID(Convert.ToUInt64(query[1])));
34 | return true;
35 | }
36 | return false;
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/UnlockChatTrigger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | using SteamKit2;
8 | using SteamKit2.Internal;
9 |
10 | using SteamChatBot.Triggers.TriggerOptions;
11 |
12 | namespace SteamChatBot.Triggers
13 | {
14 | class UnlockChatTrigger : BaseTrigger
15 | {
16 | public UnlockChatTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
17 | { }
18 |
19 | public override bool respondToChatMessage(SteamID roomID, SteamID chatterId, string message)
20 | {
21 | return Respond(roomID, message);
22 | }
23 |
24 | private bool Respond(SteamID roomID, string message)
25 | {
26 | string[] query = StripCommand(message, Options.ChatCommand.Command);
27 | if (query != null)
28 | {
29 | var msg = new ClientMsg();
30 | msg.Body.SteamIdChat = SteamHelper.ToChatID(roomID);
31 | msg.Body.SteamIdUserToActOn = SteamHelper.ToChatID(roomID);
32 | msg.Body.ChatAction = EChatAction.UnlockChat;
33 |
34 | Bot.steamClient.Send(msg);
35 | return true;
36 | }
37 | return false;
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/UnmoderateTrigger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | using SteamKit2;
8 | using SteamKit2.Internal;
9 |
10 | using SteamChatBot.Triggers.TriggerOptions;
11 |
12 | namespace SteamChatBot.Triggers
13 | {
14 | class UnmoderateChatTrigger : BaseTrigger
15 | {
16 | public UnmoderateChatTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
17 | { }
18 |
19 | public override bool respondToChatMessage(SteamID roomID, SteamID chatterId, string message)
20 | {
21 | return Respond(roomID, message);
22 | }
23 |
24 | private bool Respond(SteamID roomID, string message)
25 | {
26 | string[] query = StripCommand(message, Options.ChatCommand.Command);
27 |
28 | if (query != null)
29 | {
30 | var msg = new ClientMsg();
31 | msg.Body.SteamIdChat = SteamHelper.ToChatID(roomID);
32 | msg.Body.SteamIdUserToActOn = SteamHelper.ToChatID(roomID);
33 | msg.Body.ChatAction = EChatAction.SetUnmoderated;
34 |
35 | Bot.steamClient.Send(msg);
36 | return true;
37 | }
38 | return false;
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/WeatherTrigger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Net;
7 | using System.Web.Script.Serialization;
8 | using System.IO;
9 |
10 | using SteamKit2;
11 |
12 | using SteamChatBot.Triggers.TriggerOptions;
13 |
14 | namespace SteamChatBot.Triggers
15 | {
16 | class WeatherTrigger : BaseTrigger
17 | {
18 | public WeatherTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
19 | { }
20 |
21 | public override bool respondToChatMessage(SteamID roomID, SteamID chatterId, string message)
22 | {
23 | return Respond(roomID, message, true);
24 | }
25 |
26 | public override bool respondToFriendMessage(SteamID userID, string message)
27 | {
28 | return Respond(userID, message, false);
29 | }
30 |
31 | private bool Respond(SteamID toID, string message, bool room)
32 | {
33 | string[] query = StripCommand(message, Options.ChatCommandApi.ChatCommand.Command);
34 | if (query != null && query.Length == 1)
35 | {
36 | SendMessageAfterDelay(toID, "Usage: " + Options.ChatCommand.Command + " ", room);
37 | return true;
38 | }
39 | else if (query != null && query[1] != null)
40 | {
41 | if (Options.ChatCommandApi.ApiKey == null)
42 | {
43 | SendMessageAfterDelay(toID, "API Key from Wunderground is required.", room);
44 | return false;
45 | }
46 | else
47 | {
48 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(string.Format("http://api.wunderground.com/api/{0}/{1}/q/{2}.json", Options.ChatCommandApi.ApiKey, "conditions", query[1]));
49 | string body = "";
50 | Weather weather = null;
51 |
52 | using (var wundergroud = (HttpWebResponse)request.GetResponse())
53 | {
54 | using (var sr = new StreamReader(wundergroud.GetResponseStream()))
55 | {
56 | JavaScriptSerializer js = new JavaScriptSerializer();
57 | body = sr.ReadToEnd();
58 | weather = (Weather)js.Deserialize(body, typeof(Weather));
59 | SendMessageAfterDelay(toID, ParseResult(weather), room);
60 | return true;
61 | }
62 | }
63 |
64 | }
65 | }
66 | return false;
67 | }
68 |
69 | class Weather
70 | {
71 | public CurrentObservation current_observation { get; set; }
72 | }
73 |
74 | class CurrentObservation
75 | {
76 | public DisplayLocation display_location { get; set; }
77 | public string weather { get; set; }
78 | public string temperature_string { get; set; }
79 | public string feelslike_string { get; set; }
80 | public string wind_string { get; set; }
81 | public string relative_humidity { get; set; }
82 | public string precip_today_metric { get; set; }
83 | public string precip_today_string { get; set; }
84 | public string observation_time { get; set; }
85 | public string forecast_url { get; set; }
86 | }
87 |
88 | class DisplayLocation
89 | {
90 | public string full { get; set; }
91 | public string zip { get; set; }
92 |
93 | }
94 |
95 | private string ParseResult(Weather weather)
96 | {
97 | if(weather.current_observation != null)
98 | {
99 | CurrentObservation o = weather.current_observation;
100 | DisplayLocation d = o.display_location;
101 |
102 | string result = string.Format("Weather for {0}{1}: {2}, {3}", d.full, (d.zip != null ? " (" + d.zip + ")" : ""), o.weather, o.temperature_string);
103 | result += string.Format("; feels like {0}. {1} winds. {2} humidity", o.feelslike_string, o.wind_string, o.relative_humidity);
104 | if(o.precip_today_metric != null)
105 | {
106 | result += string.Format("; {0} precipitation today", o.precip_today_string);
107 | }
108 | return string.Format("{0}. {1}\n{2}", result, o.observation_time, o.forecast_url);
109 | }
110 | return null;
111 | }
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/SteamChatBot/Triggers/YoutubeTrigger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | using Google.Apis.Auth.OAuth2;
8 | using Google.Apis.Services;
9 | using Google.Apis.Upload;
10 | using Google.Apis.Util.Store;
11 | using Google.Apis.YouTube.v3;
12 | using Google.Apis.YouTube.v3.Data;
13 | using SteamChatBot.Triggers.TriggerOptions;
14 | using SteamKit2;
15 |
16 | namespace SteamChatBot.Triggers
17 | {
18 | class YoutubeTrigger : BaseTrigger
19 | {
20 | public YoutubeTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
21 | { }
22 |
23 | public override bool respondToChatMessage(SteamID roomID, SteamID chatterId, string message)
24 | {
25 | return Respond(roomID, chatterId, message, true);
26 | }
27 |
28 | public override bool respondToFriendMessage(SteamID userID, string message)
29 | {
30 | return Respond(userID, userID, message, false);
31 | }
32 |
33 | private bool Respond(SteamID toID, SteamID userID, string message, bool room)
34 | {
35 | string[] query = StripCommand(message, Options.ChatCommandApi.ChatCommand.Command);
36 | if (query != null && query.Length == 1)
37 | {
38 | SendMessageAfterDelay(toID, "Usage: " + Options.ChatCommandApi.ChatCommand.Command + " ", room);
39 | return true;
40 | }
41 | else if (query != null && query.Length >= 2)
42 | {
43 | try
44 | {
45 | Task.Run(() => Run(toID, query, room));
46 | return true;
47 | }
48 | catch (AggregateException e)
49 | {
50 | foreach (var ex in e.InnerExceptions)
51 | {
52 | Log.Instance.Error(e.StackTrace);
53 | SendMessageAfterDelay(toID, e.Message, room);
54 | }
55 | return true;
56 | }
57 | }
58 | return false;
59 | }
60 |
61 | private async Task Run(SteamID toID, string[] query, bool room)
62 | {
63 | YouTubeService ys = new YouTubeService(new BaseClientService.Initializer()
64 | {
65 | ApiKey = Options.ChatCommandApi.ApiKey,
66 | ApplicationName = "Steam Chat Bot"
67 | });
68 |
69 | SearchResource.ListRequest search = ys.Search.List("snippet");
70 | string q = "";
71 | for (int i = 1; i < query.Length; i++)
72 | {
73 | q += query[i] + " ";
74 | }
75 | q = q.Trim();
76 | search.Q = q;
77 | search.MaxResults = 1;
78 |
79 | SearchListResponse response = await search.ExecuteAsync();
80 |
81 | foreach (SearchResult result in response.Items)
82 | {
83 | if (result.Id.Kind == "youtube#video")
84 | {
85 | SendMessageAfterDelay(toID, "https://youtube.com/watch?v=" + result.Id.VideoId, room);
86 | }
87 | else if(result.Id.Kind == "youtube#channel")
88 | {
89 | SendMessageAfterDelay(toID, "https://youtube.com/channel/" + result.Id.ChannelId, room);
90 | }
91 | }
92 | }
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/SteamChatBot/UserInfo.cs:
--------------------------------------------------------------------------------
1 | namespace SteamChatBot
2 | {
3 | public class UserInfo
4 | {
5 | public string username { get; set; }
6 | public string password { get; set; }
7 | public string logFile { get; set; }
8 | public string displayName { get; set; }
9 | public string sentryFile { get; set; }
10 | public string cll { get; set; }
11 | public string fll { get; set; }
12 | public string sharedSecret { get; set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/SteamChatBot/packages.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 |
--------------------------------------------------------------------------------
/SteamChatBot/scb.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Steam-Chat-Bot/SteamChatBot/1c1c083569acb5a18052edb3939cb7a110167de8/SteamChatBot/scb.ico
--------------------------------------------------------------------------------
/TRIGGERS.md:
--------------------------------------------------------------------------------
1 | # How to create and add your own triggers
2 | This is a little guide on how to create your own triggers. Note: This does not go over the actuall trigger class itself, you need to write that on your own. Look in the SteamChatBot/Triggers folder for examples.
3 |
4 | These are the steps you need to take (not necessarily in this order)
5 |
6 | **1. Create the trigger class**
7 | This is your main file where all the action takes place. I will not go over this in detail. Look at other triggers in SteamChatBot/Triggers for help.
8 |
9 | **2. OPTIONAL: Create the options class**
10 | This is the options class that will go into SteamChatBot/Triggers/Options. It is where the options of your trigger are stored (an example would be a command that the user would enter). This is only optional because you may not need to create a new class for the options. A bunch of options classes already exist. If you are creating your own options file, you must add it to TriggerOptionsBase.cs in SteamChatBot/Triggers/TriggerOptions.
11 | If you need to create your own options, please follow this step and the next.
12 |
13 | **2a. OPTIONAL: Create the options window**
14 | To have your own options class you must create your options window. This is a XAML file that is stored in SteamChatBot/Triggers/TriggerOptions/Windows. Look in one of the .xaml.cs files for an example of how to do this.
15 |
16 | **2b. Add your trigger to BaseTrigger**
17 | To finalize everything on the trigger side you will need to add a reference to your trigger to multiple places within the BaseTrigger class. Here is a list of them:
18 |
19 | 1. [BaseTrigger.ReadTriggers()](https://github.com/Steam-Chat-Bot/SteamChatBot/blob/master/SteamChatBot/Triggers/BaseTrigger.cs#L232)
20 |
21 | 2. [BaseTrigger.SaveTrigger(BaseTrigger trigger)](https://github.com/Steam-Chat-Bot/SteamChatBot/blob/master/SteamChatBot/Triggers/BaseTrigger.cs#L188)
22 |
23 | 3. OPTIONAL ONLY IF MAKING OWN OPTIONS: [1](https://github.com/Steam-Chat-Bot/SteamChatBot/blob/master/SteamChatBot/Triggers/BaseTrigger.cs#L855) [2](https://github.com/Steam-Chat-Bot/SteamChatBot/blob/master/SteamChatBot/Triggers/BaseTrigger.cs#L947) [3](https://github.com/Steam-Chat-Bot/SteamChatBot/blob/master/SteamChatBot/Triggers/BaseTrigger.cs#L1007) [4](https://github.com/Steam-Chat-Bot/SteamChatBot/blob/master/SteamChatBot/Triggers/BaseTrigger.cs#L1069) [5](https://github.com/Steam-Chat-Bot/SteamChatBot/blob/master/SteamChatBot/Triggers/BaseTrigger.cs#L1122) [6](https://github.com/Steam-Chat-Bot/SteamChatBot/blob/master/SteamChatBot/Triggers/BaseTrigger.cs#L1173)
24 |
25 | **3. Add your trigger to MainWindow "Triggers" tab**
26 | You will need to add the name of your trigger and a short description (as a ListBoxItem) to the listbox triggersListBox. Name the ListBoxItem your trigger in camelCase.
27 |
28 | **4. Add your trigger to MainWindow.xaml.cs**
29 | You will need to add a reference to your trigger to multiple places within MainWindow.xaml.cs in all of the following places:
30 |
31 | 1. [When the "plus" (+) button is pushed](https://github.com/Steam-Chat-Bot/SteamChatBot/blob/master/SteamChatBot/MainWindow.xaml.cs#L242)
32 |
33 | 2. OPTIONAL ONLY IF MAKING OWN OPTIONS: [Create your own GetOptions method](https://github.com/Steam-Chat-Bot/SteamChatBot/blob/master/SteamChatBot/MainWindow.xaml.cs#L242)
34 |
35 | **5. Add your trigger to TriggerType.cs**
36 | You need to add the name of your trigger to [TriggerType.cs](https://github.com/Steam-Chat-Bot/SteamChatBot/blob/master/SteamChatBot/Triggers/TriggerType.cs). Please make sure it is in alphabetical order with the rest of the triggers.
37 |
38 | I know this isn't a comprehensive list, and adding a trigger is much more complicated. If you really want to see, look at past commits where I have added a trigger. Some of them I added new options [(such as AntiSpamTrigger)](https://github.com/Steam-Chat-Bot/SteamChatBot/commit/d778f9fa5b1a6c0a6ba69150feac957cb26fe2f4) or where I just used an existing options type [(like PlayGameTrigger.cs)](https://github.com/Steam-Chat-Bot/SteamChatBot/commit/f75c509502674c84251aea0259cf45a6a266138d) (ignore all the other stuff, I also worked on a few other files).
39 |
40 | Your best bet if you want a trigger to be added is to create an issue for it and I will see about adding it in.
41 |
--------------------------------------------------------------------------------