how to get the chatbot more able to answer in batch code, bat file

@echo off
Mode con cols=90 lines=50
color 0B

:: As in the subject. I would like chatbot to randomize the answers it gives. So that he can give from more than one answer. Mainly I mean TYPE SOMETHING, PLEASE! and Sorry, I don't understand your last input.

for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (set "DEL=%%a")
setlocal EnableExtensions DisableDelayedExpansion
set "BotName=Amanda"
set "Name=Ikki"
set "Lines="
set "Columns="
for /F "tokens=1,2 delims=: " %%I in ('%SystemRoot%\System32\mode.com') do if "%%I" == "Lines" (set "Lines=%%J") else if "%%I" == "Columns" set "Columns=%%J"
<nul set /p=""
%SystemRoot%\System32\mode.com CON COLS=100 LINES=35
color 0b
echo/
echo/
title A.I. Chat Bot Amanda 0.2
:aichatbot

ECHO >nul && call :PainText 0C %BotName%  
echo : Hello I'am A.I. Chatbot but my users call me Amanda. What do you want to talk about? ;) 

:Begin
ECHO >nul && call :PainText 9 "%Name%"
set "TALK="
set /P "TALK=: "
echo.
ECHO >nul && call :PainText 0C "%BotName%"
if not defined TALK echo : TYPE SOMETHING, PLEASE!& goto Begin
setlocal EnableDelayedExpansion
set "TALK=!TALK:?=!"

:: how to get the possibility of different answers in the code below, not only - TYPE SOMETHING, PLEASE!. I would like the chatbot to have the possibility of more answers.

if not defined TALK endlocal & echo : TYPE SOMETHING, PLEASE!& goto Begin
set "TALK=!TALK:"= !"
set "TALK=!TALK:<= !"
set "TALK=!TALK:>= !"
set "TALK=!TALK:|= !"
set "TALK=!TALK:&= !"
set "TALK=!TALK:)= !"
endlocal & set "TALK=%TALK%"
if /I "%TALK%" == "exit" goto EndBatch

set "Output=:"


:: Hi
echo %TALK% | %SystemRoot%\System32\findstr.exe /I /R "\<hi\>" >nul && call :Hi
echo %TALK% | %SystemRoot%\System32\findstr.exe /I /R "\<hello\>" >nul && call :Hello
echo %TALK% | %SystemRoot%\System32\findstr.exe /I /L /X /C:"whats Up " >nul && call :WhatsUp
echo %TALK% | %SystemRoot%\System32\findstr.exe /I /L /X /C:"hey Heyman " >nul && call :HeyHeyman
echo %TALK% | %SystemRoot%\System32\findstr.exe /I /L /X /C:"hi and Greeting " >nul && call :HiandGreeting
echo %TALK% | %SystemRoot%\System32\findstr.exe /I /L /X /C:"hows it going " >nul && call :Howsitgoing
echo %TALK% | %SystemRoot%\System32\findstr.exe /I /L /X /C:"Whats going on " >nul && call :Whatsgoingon
echo %TALK% | %SystemRoot%\System32\findstr.exe /I /L /X /C:"Hows everything " >nul && call :Howseverything


echo %TALK% | %SystemRoot%\System32\findstr.exe /I /R "\<test\>" >nul && set Output=%Output% A.I. Rulez! Ex Machina is the best movie ;)"
echo %TALK% | %SystemRoot%\System32\findstr.exe /I /R "\<test2\>" >nul && set "Output=%Output% Love Matrix ;)

:: how to get the possibility of different answers in the code below, not only - Sorry, I don't understand your last input. I would like the chatbot to have the possibility of more answers.

if "%Output%" == ":" set "Output=%Output% Sorry, I don't understand your last input."
echo %Output%
goto Begin

:: Hi

:Hi
:Hello
:WhatsUp
:HeyHeyman
:HiandGreeting
:Howsitgoing
:Whatsgoingon
:Howseverything
:Howarethings

:: I would like to have a similar effect in the code above regarding the bot response - Sorry, I don't understand your last input and TYPE SOMETHING, PLEASE!. I would like the chatbot to have the possibility of more answers.

set /A Number=%RANDOM% %% 11
if %Number% == 0 set "Output=%Output% Hello, %name%!" & goto :EOF
if %Number% == 1 set "Output=%Output% What's up?" & goto :EOF
if %Number% == 2 set "Output=%Output% How is your day going?" & goto :EOF
if %Number% == 3 set "Output=%Output% Konichiwa %name%!" & goto :EOF
if %Number% == 4 set "Output=%Output% Yo!" & goto :EOF
if %Number% == 5 set "Output=%Output% Whazzup %name%!" & goto :EOF
if %Number% == 6 set "Output=%Output% Ohayo ;)" & goto :EOF
if %Number% == 7 set "Output=%Output% Hi I love you %name%!" & goto :EOF
if %Number% == 8 set "Output=%Output% Hi, what's up?" & goto :EOF
if %Number% == 9 set "Output=%Output% How's it going?" & goto :EOF
set "Output=%Output% Hey %Name%! Good to see you!" & goto :EOF

:PainText
<nul set /p "=%DEL%" > "%~2"
findstr /v /a:%1 "+" "%~2" nul
del "%~2" > nul
goto :eof

:EndBatch
color
if defined Lines if defined Columns %SystemRoot%\System32\mode.com CON COLS=%Columns% LINES=%Lines%
endlocal

:: how to get the possibility of different answers in my script. So that the chatbot randomly selects the answers it will give.

:menu_[E]  EXIT
echo Bye...
Exit


Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation