@@ -43,17 +43,17 @@ public override bool onLoggedOn()
4343 Options . NotificationOptions . DB = JsonConvert . DeserializeObject < Dictionary < ulong , DB > > ( File . ReadAllText ( Options . NotificationOptions . DBFile ) ) ;
4444 Log . Instance . Silly ( "{0}/{1}: Read db from {2}" , Bot . username , Name , Options . NotificationOptions . DBFile ) ;
4545 }
46- catch ( FileNotFoundException fnfe )
46+ catch ( FileNotFoundException fnfe )
4747 {
4848 File . Create ( Options . NotificationOptions . DBFile ) ;
4949 }
50- catch ( Exception e )
50+ catch ( Exception e )
5151 {
5252 Log . Instance . Error ( e . StackTrace ) ;
5353 return false ;
5454 }
5555
56- if ( Options . NotificationOptions . DB == null )
56+ if ( Options . NotificationOptions . DB == null )
5757 {
5858 Options . NotificationOptions . DB = new Dictionary < ulong , DB > ( ) ;
5959 }
@@ -74,7 +74,6 @@ public override bool respondToChatMessage(SteamID roomID, SteamID chatterId, str
7474
7575 private bool Respond ( SteamID toID , SteamID userID , string message , bool room )
7676 {
77- bool messageSent = false ;
7877 CheckIfDBExists ( userID ) ;
7978 Dictionary < ulong , DB > db = Options . NotificationOptions . DB ;
8079
@@ -83,27 +82,37 @@ private bool Respond(SteamID toID, SteamID userID, string message, bool room)
8382 db [ userID ] . name = Bot . steamFriends . GetFriendPersonaName ( userID ) ;
8483
8584 string [ ] query = StripCommand ( message , Options . NotificationOptions . SeenCommand ) ;
85+ if ( query != null && query . Length == 1 )
86+ {
87+ SendMessageAfterDelay ( toID , "Usage: " + Options . NotificationOptions . SeenCommand + " <steamid64>" , room ) ;
88+ return true ;
89+ }
8690 if ( query != null && query . Length == 2 )
8791 {
8892 if ( ! db . ContainsKey ( Convert . ToUInt64 ( query [ 1 ] ) ) || db [ Convert . ToUInt64 ( query [ 1 ] ) ] == null )
8993 {
9094 SendMessageAfterDelay ( toID , "The user " + query [ 1 ] + " was not found." , room ) ;
91- messageSent = true ;
95+ return true ;
9296 }
9397 else
9498 {
9599 SendMessageAfterDelay ( toID , string . Format ( "I last saw {0} on {1} at {2}" , db [ Convert . ToUInt64 ( query [ 1 ] ) ] . name , db [ Convert . ToUInt64 ( query [ 1 ] ) ] . seen . ToShortDateString ( ) , db [ Convert . ToUInt64 ( query [ 1 ] ) ] . seen . ToShortTimeString ( ) ) , room ) ;
96- messageSent = true ;
100+ return true ;
97101 }
98102 }
99103
100104 query = StripCommand ( message , Options . NotificationOptions . APICommand ) ;
101- if ( query != null && userID != toID )
105+ if ( query != null && userID != toID )
102106 {
103107 SendMessageAfterDelay ( toID , "This command will only work in private to protect privacy." , room ) ;
104- messageSent = true ;
108+ return true ;
105109 }
106- else if ( query != null && query . Length == 2 && userID == toID )
110+ else if ( query != null && userID == toID && query . Length == 1 )
111+ {
112+ SendMessageAfterDelay ( toID , "Usage: " + Options . NotificationOptions . APICommand + " <apikey>" , room ) ;
113+ return true ;
114+ }
115+ else if ( query != null && query . Length == 2 && userID == toID )
107116 {
108117 CheckIfDBExists ( userID ) ;
109118 string api = query [ 1 ] ;
@@ -116,27 +125,27 @@ private bool Respond(SteamID toID, SteamID userID, string message, bool room)
116125 } ;
117126
118127 PushResponse response = client . PushNote ( note ) ;
119- if ( response == null )
128+ if ( response == null )
120129 {
121130 SendMessageAfterDelay ( toID , "Your push failed. Most likely your API key is incorrect." , room ) ;
122- messageSent = true ;
131+ return true ;
123132 }
124133 else
125134 {
126135 SendMessageAfterDelay ( toID , "Your push was a success." , room ) ;
127- messageSent = true ;
136+ return true ;
128137 }
129138 }
130139
131140 query = StripCommand ( message , Options . NotificationOptions . FilterCommand ) ;
132- if ( query != null && query . Length == 1 )
141+ if ( query != null && query . Length == 1 )
133142 {
134- SendMessageAfterDelay ( toID , "Available sub commands: add, list, clear, delete" , room ) ;
135- messageSent = true ;
143+ SendMessageAfterDelay ( toID , "Usage: " + Options . NotificationOptions . FilterCommand + "<subcommand> [query] \n Available sub commands: add, list, clear, delete", room ) ;
144+ return true ;
136145 }
137- else if ( query != null && query . Length >= 2 )
146+ else if ( query != null && query . Length >= 2 )
138147 {
139- if ( query [ 1 ] == "add" && query . Length >= 3 )
148+ if ( query [ 1 ] == "add" && query . Length >= 3 )
140149 {
141150
142151 List < string > words = new List < string > ( ) ;
@@ -149,42 +158,42 @@ private bool Respond(SteamID toID, SteamID userID, string message, bool room)
149158
150159 db [ userID ] . pb . filter = words ;
151160 SendMessageAfterDelay ( toID , "Your filter has been successfully modified." , room ) ;
152- messageSent = true ;
161+ return true ;
153162 }
154- else if ( query [ 1 ] == "list" && query . Length == 2 )
163+ else if ( query [ 1 ] == "list" && query . Length == 2 )
155164 {
156165 if ( db [ userID ] . pb . filter . Count > 0 )
157166 {
158167 string words = string . Join ( ", " , db [ userID ] . pb . filter ) ;
159168 SendMessageAfterDelay ( userID , "Your filter: " + words , false ) ;
160- messageSent = true ;
169+ return true ;
161170 }
162171 else
163172 {
164173 SendMessageAfterDelay ( userID , "Your filter is empty. Use \" !filter add <words>\" to add to your filter" , false ) ;
165- messageSent = true ;
174+ return true ;
166175 }
167176 }
168- else if ( query [ 1 ] == "clear" && query . Length == 2 )
177+ else if ( query [ 1 ] == "clear" && query . Length == 2 )
169178 {
170179 db [ userID ] . pb . filter . Clear ( ) ;
171180 SendMessageAfterDelay ( toID , "Your filter has been cleared" , room ) ;
172- messageSent = true ;
181+ return true ;
173182 }
174- else if ( query [ 1 ] == "delete" && query . Length == 3 )
183+ else if ( query [ 1 ] == "delete" && query . Length == 3 )
175184 {
176185 db [ userID ] . pb . filter . Remove ( query [ 2 ] ) ;
177186 SendMessageAfterDelay ( toID , "The filter \" " + query [ 2 ] + "\" has been removed" , room ) ;
178- messageSent = true ;
187+ return true ;
179188 }
180189 }
181190
182191 query = StripCommand ( message , Options . NotificationOptions . ClearCommand ) ;
183- if ( query != null )
192+ if ( query != null )
184193 {
185194 db [ userID ] = null ;
186195 SendMessageAfterDelay ( toID , "Your database file has been cleared." , room ) ;
187- messageSent = true ;
196+ return true ;
188197 }
189198
190199
@@ -211,8 +220,7 @@ private bool Respond(SteamID toID, SteamID userID, string message, bool room)
211220 }
212221 }
213222 }
214-
215- return messageSent ;
223+ return false ;
216224 }
217225
218226 private void CheckIfDBExists ( SteamID userID )
0 commit comments