Skip to content

Commit 257266a

Browse files
authored
Merge pull request #8 from Steam-Chat-Bot/gh-pages
Merge gh-pages back into master
2 parents 42525ad + 80fb575 commit 257266a

59 files changed

Lines changed: 1472 additions & 1195 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

SteamChatBot/AboutBox.Designer.cs

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SteamChatBot/App.config

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,38 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<configuration>
3-
<startup>
4-
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
5-
</startup>
6-
<runtime>
7-
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
8-
<dependentAssembly>
9-
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
10-
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
11-
</dependentAssembly>
12-
<dependentAssembly>
13-
<assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
14-
<bindingRedirect oldVersion="0.0.0.0-4.2.29.0" newVersion="4.2.29.0" />
15-
</dependentAssembly>
16-
</assemblyBinding>
17-
</runtime>
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
5+
</startup>
6+
<runtime>
7+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
8+
<dependentAssembly>
9+
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
10+
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
11+
</dependentAssembly>
12+
<dependentAssembly>
13+
<assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
14+
<bindingRedirect oldVersion="0.0.0.0-4.2.29.0" newVersion="4.2.29.0" />
15+
</dependentAssembly>
16+
<dependentAssembly>
17+
<assemblyIdentity name="System" publicKeyToken="b77a5c561934e089" culture="neutral" />
18+
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
19+
</dependentAssembly>
20+
<dependentAssembly>
21+
<assemblyIdentity name="System.Data" publicKeyToken="b77a5c561934e089" culture="neutral" />
22+
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
23+
</dependentAssembly>
24+
<dependentAssembly>
25+
<assemblyIdentity name="System.Web" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
26+
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
27+
</dependentAssembly>
28+
<dependentAssembly>
29+
<assemblyIdentity name="System.Xml" publicKeyToken="b77a5c561934e089" culture="neutral" />
30+
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
31+
</dependentAssembly>
32+
<dependentAssembly>
33+
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
34+
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
35+
</dependentAssembly>
36+
</assemblyBinding>
37+
</runtime>
1838
</configuration>

SteamChatBot/Bot.cs

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ public class Bot
2929
public static SteamUser steamUser = steamClient.GetHandler<SteamUser>();
3030
public static SteamFriends steamFriends = steamClient.GetHandler<SteamFriends>();
3131
public static SteamGameCoordinator steamGC = steamClient.GetHandler<SteamGameCoordinator>();
32-
3332
public static SteamGuardAccount steamGuardAccount = new SteamGuardAccount();
3433

3534
#endregion
@@ -93,8 +92,16 @@ public static void WriteData()
9392
Directory.CreateDirectory(username + "/");
9493
}
9594
File.WriteAllText(username + "/login.json", json);
96-
File.AppendAllText("chatbots.txt", username + "\n");
97-
File.SetAttributes("chatbots.txt", File.GetAttributes("chatbots.txt") | FileAttributes.Hidden);
95+
96+
if(!File.Exists("chatbots.txt"))
97+
{
98+
File.Create("chatbots.txt");
99+
}
100+
101+
if (!File.ReadAllText("chatbots.txt").Contains(username + "\n"))
102+
{
103+
File.AppendAllText("chatbots.txt", username + "\n");
104+
}
98105
}
99106

100107
#endregion
@@ -181,6 +188,11 @@ public static void Start(string _username, string _password, string cll, string
181188

182189
isRunning = true;
183190

191+
foreach(BaseTrigger trigger in triggers)
192+
{
193+
trigger.OnLoad();
194+
}
195+
184196
Log.Instance.Silly("Updating SteamKit2 servers...");
185197
SteamDirectory.Initialize().Wait();
186198

@@ -244,7 +256,7 @@ private static void SubForCB()
244256
manager.Subscribe<SteamUser.LoggedOnCallback>(OnLoggedOn);
245257
manager.Subscribe<SteamUser.LoggedOffCallback>(OnLoggedOff);
246258
manager.Subscribe<SteamUser.UpdateMachineAuthCallback>(OnUpdateMachineAuth);
247-
manager.Subscribe<SteamUser.AccountInfoCallback>(OnAccountInfo);
259+
manager.Subscribe<SteamUser.LoginKeyCallback>(OnLoginKeyCallback);
248260

249261
manager.Subscribe<SteamFriends.ChatMsgCallback>(OnChatMsg);
250262
manager.Subscribe<SteamFriends.FriendMsgCallback>(OnFriendMsg);
@@ -255,7 +267,7 @@ private static void SubForCB()
255267
Log.Instance.Silly("Callback managers subscribed");
256268
}
257269

258-
private static void OnAccountInfo(SteamUser.AccountInfoCallback callback)
270+
private static void OnLoginKeyCallback(SteamUser.LoginKeyCallback callback)
259271
{
260272
steamFriends.SetPersonaState(EPersonaState.Online);
261273
steamFriends.SetPersonaName(displayName);
@@ -340,16 +352,18 @@ private static void OnLoggedOn(SteamUser.LoggedOnCallback callback)
340352
if (callback.Result == EResult.OK)
341353
{
342354
Log.Instance.Info("Logged in!");
355+
steamFriends.SetPersonaState(EPersonaState.Online);
356+
steamFriends.SetPersonaName(displayName);
343357
foreach (BaseTrigger trigger in triggers)
344358
{
345359
trigger.OnLoggedOn();
346360
}
347361
}
348-
else if (callback.Result == EResult.AccountLogonDenied || callback.Result == EResult.AccountLoginDeniedNeedTwoFactor)
362+
else if (callback.Result == EResult.AccountLogonDenied || callback.Result == EResult.AccountLoginDeniedNeedTwoFactor || callback.Result == EResult.InvalidLoginAuthCode)
349363
{
350364
if (callback.Result == EResult.AccountLoginDeniedNeedTwoFactor)
351365
{
352-
if (sharedSecret == "")
366+
if (sharedSecret == "" || sharedSecret == null)
353367
{
354368
string _tfc = Interaction.InputBox("Two factor code (sent via sms): ");
355369
twoFactorAuth = _tfc;
@@ -362,7 +376,7 @@ private static void OnLoggedOn(SteamUser.LoggedOnCallback callback)
362376
}
363377

364378
}
365-
else if (callback.Result == EResult.AccountLogonDenied)
379+
else if (callback.Result == EResult.AccountLogonDenied || callback.Result == EResult.InvalidLoginAuthCode)
366380
{
367381
string _sgc = Interaction.InputBox("Steam guard code (sent to your email at " + callback.EmailDomain + "): ");
368382
authCode = _sgc;

SteamChatBot/Log.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ protected void _OutputLine(LogLevel level, string line, params object[] formatPa
125125
{
126126
if (disposed)
127127
return;
128-
string formattedString = String.Format(
128+
string formattedString = string.Format(
129129
"[{0}{1}] {2}: {3}",
130130
GetLogBotName(),
131131
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),

SteamChatBot/MainWindow.xaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,23 +60,29 @@
6060
<ListBoxItem x:Name="autojoinChatTrigger" Content="AutojoinChatTrigger - Autojoins chat room(s)"/>
6161
<ListBoxItem x:Name="banTrigger" Content="BanTrigger - Bans a user from chat"/>
6262
<ListBoxItem x:Name="banCheckTrigger" Content="BanCheckTrigger - Checks SteamCommunity for bans"/>
63+
<ListBoxItem x:Name="changeNameTrigger" Content="ChangeNameTrigger - Changes the bots name"/>
6364
<ListBoxItem x:Name="chatReplyTrigger" Content="ChatReplyTrigger - Responds to a match in chat"/>
6465
<ListBoxItem x:Name="discordTrigger" Content="DiscordTrigger - Discord Relay for Steam Chat"/>
6566
<ListBoxItem x:Name="doormatTrigger" Content="DoormatTrigger - Greets a user as they enter chat"/>
67+
<ListBoxItem x:Name="googleTrigger" Content="GoogleTrigger - Searches google and returns the top result"/>
6668
<ListBoxItem x:Name="isUpTrigger" Content="IsUpTrigger - Determines if a website is online"/>
6769
<ListBoxItem x:Name="kickTrigger" Content="KickTrigger - Kicks a SteamID from chat"/>
6870
<ListBoxItem x:Name="leaveChatTrigger" Content="LeaveChatTrigger - Commands the bot to leave chat"/>
6971
<ListBoxItem x:Name="linkNameTrigger" Content="LinkNameTrigger - Gets the title of the website from a link"/>
7072
<ListBoxItem x:Name="lockChatTrigger" Content="LockChatTrigger - Locks the chat room"/>
73+
<ListBoxItem x:Name="messageIntervalTrigger" Content="MessageIntervalTrigger - Sends a message to a chat room every time the interval passes"/>
7174
<ListBoxItem x:Name="moderateChatTrigger" Content="ModerateChatTrigger - Moderates a chat room"/>
75+
<ListBoxItem x:Name="noteTrigger" Content="NoteTrigger - Saves notes than can be accessed by anyone in the chat"/>
76+
<ListBoxItem x:Name="notificationTrigger" Content="NotificationTrigger - Sends users notifications"/>
7277
<ListBoxItem x:Name="playGameTrigger" Content="PlayGameTrigger - Plays a game (AppID)"/>
7378
<ListBoxItem x:Name="unbanTrigger" Content="UnbanTrigger - Unbans a user from chat"/>
7479
<ListBoxItem x:Name="unmoderateChatTrigger" Content="UnmoderateChatTrigger - Unmoderates the chat"/>
7580
<ListBoxItem x:Name="weatherTrigger" Content="WeatherTrigger - Gets the weather for a certain location"/>
81+
<ListBoxItem x:Name="youtubeTrigger" Content="YoutubeTrigger - Query youtube for the top video result"/>
7682
</ListBox>
7783
<Button x:Name="minusTriggerButton" Content="-" Grid.Column="1" HorizontalAlignment="Left" Margin="208,428,0,0" VerticalAlignment="Top" Width="44" FontSize="14.667" Click="minusTriggerButton_Click" Height="27"/>
7884
<ListBox x:Name="addedTriggersListBox" Grid.Column="2" HorizontalAlignment="Left" Height="418" Margin="75,10,0,0" VerticalAlignment="Top" Width="275"/>
79-
<Button x:Name="plusTriggerButton" Content="+" Grid.Column="1" HorizontalAlignment="Left" Margin="159,428,0,0" Width="44" FontSize="14.667" Click="plusTriggerButton_Click" RenderTransformOrigin="0.5,0.5"/>
85+
<Button x:Name="plusTriggerButton" Content="+" Grid.Column="1" HorizontalAlignment="Left" Margin="159,428,0,0" Height="27" Width="44" FontSize="14.667" Click="plusTriggerButton_Click" RenderTransformOrigin="0.5,0.5"/>
8086
</Grid>
8187
</TabItem>
8288
</TabControl>

0 commit comments

Comments
 (0)