Skip to content

Commit

Permalink
Fix rooms option in triggers, fix [unassigned] name (hopefully)
Browse files Browse the repository at this point in the history
  • Loading branch information
kjsmita6 committed Sep 25, 2016
1 parent 7971f1d commit 9b6254b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
9 changes: 7 additions & 2 deletions SteamChatBot/Bot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ private static void SubForCB()
manager.Subscribe<SteamUser.LoggedOnCallback>(OnLoggedOn);
manager.Subscribe<SteamUser.LoggedOffCallback>(OnLoggedOff);
manager.Subscribe<SteamUser.UpdateMachineAuthCallback>(OnUpdateMachineAuth);
manager.Subscribe<SteamUser.LoginKeyCallback>(OnLoginKeyCallback);

manager.Subscribe<SteamFriends.ChatMsgCallback>(OnChatMsg);
manager.Subscribe<SteamFriends.FriendMsgCallback>(OnFriendMsg);
Expand All @@ -254,6 +255,12 @@ private static void SubForCB()
Log.Instance.Silly("Callback managers subscribed");
}

private static void OnLoginKeyCallback(SteamUser.LoginKeyCallback callback)
{
steamFriends.SetPersonaState(EPersonaState.Online);
steamFriends.SetPersonaName(displayName);
}

private static void OnFriendMsg(SteamFriends.FriendMsgCallback callback)
{
if (callback.EntryType == EChatEntryType.ChatMsg)
Expand Down Expand Up @@ -333,8 +340,6 @@ private static void OnLoggedOn(SteamUser.LoggedOnCallback callback)
if (callback.Result == EResult.OK)
{
Log.Instance.Info("Logged in!");
steamFriends.SetPersonaState(EPersonaState.Online);
steamFriends.SetPersonaName(displayName);
foreach (BaseTrigger trigger in triggers)
{
trigger.OnLoggedOn();
Expand Down
4 changes: 2 additions & 2 deletions SteamChatBot/Triggers/BaseTrigger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -940,12 +940,12 @@ protected bool CheckRoom(SteamID toID)
for (int i = 0; i < rooms.Count; i++)
{
SteamID room = rooms[i];
if (toID == room)
if (toID == SteamHelper.ToChatID(room))
{
return true;
}
}
return true;
return false;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private void doneButton_Click(object sender, RoutedEventArgs e)
if (noteCommandBox.Text != "") NTO.NoteCommand = noteCommandBox.Text;
if (infoCommandBox.Text != "") NTO.InfoCommand = infoCommandBox.Text;
if (deleteCommandBox.Text != "") NTO.DeleteCommand = deleteCommandBox.Text;
if (saveTimerBox.Text != "") NTO.SaveTimer = Convert.ToInt32(saveTimerBox.Text);
if (saveTimerBox.Text != "" || Convert.ToInt32(saveTimerBox.Text) == 0) NTO.SaveTimer = Convert.ToInt32(saveTimerBox.Text);
if (noteFileBox.Text != "") NTO.NoteFile = noteFileBox.Text;
if (notesCommandBox.Text != "") NTO.NotesCommand = notesCommandBox.Text;

Expand Down

0 comments on commit 9b6254b

Please sign in to comment.