@@ -186,16 +186,36 @@ function scrollToBottom() {
186186
187187// Simple Bot Reply Logic
188188function getBotReply ( userMessage ) {
189- const normalizedMessage = userMessage . toLowerCase ( ) ;
189+ const normalizedMessage = userMessage . toLowerCase ( ) . trim ( ) ;
190+
191+ const greetings = [
192+ 'hello' , 'hi' , 'hey' , 'howdy' , 'greetings' , 'yo' , 'whatsup' , 'sup' ,
193+ 'how are you' , 'how are you doing' , 'good morning' , 'good afternoon' , 'good evening'
194+ ] ;
195+
196+ // Check for greeting
197+ if ( greetings . some ( greeting => normalizedMessage . includes ( greeting ) ) ) {
198+ return 'Hello! 👋 How can I assist you with your project today?' ;
199+ }
200+
201+ // Check for help or assistance requests
202+ if (
203+ [ 'help' , 'assist' , 'support' , 'guide' , 'instruction' , 'trouble' , 'issue' , 'problem' ] . some (
204+ keyword => normalizedMessage . includes ( keyword )
205+ )
206+ ) {
207+ return 'Of course! Please tell me more about what you need help with—whether it\'s JavaScript, HTML, SCSS, or something else in this project.' ;
208+ }
209+
210+ // Check for thanks
190211 if (
191- [ 'hello ' , 'hi' , 'hey' , 'howdy ' , 'greetings' , 'yo' , 'whatsup' , 'sup' , 'how are you' , 'how are you doing' ] . some ( ( greeting ) =>
192- normalizedMessage . includes ( greeting )
212+ [ 'thanks ' , 'thank you' , 'thx ' , 'appreciate' ] . some (
213+ word => normalizedMessage . includes ( word )
193214 )
194215 ) {
195- return 'Hi there! How can I help you today?' ;
196- } else if ( normalizedMessage . includes ( 'help' ) ) {
197- return 'Sure! Let me know what you need assistance with.' ;
198- } else {
199- return "I'm sorry, I don't understand that. Could you rephrase?" ;
216+ return 'You’re welcome! If you have any more questions, just let me know.' ;
200217 }
218+
219+ // Fallback for unrecognized input
220+ return 'I’m not sure I understand that yet. Could you rephrase or specify if your question is about the code, a bug, or something else?' ;
201221}
0 commit comments