
11.08.2023, 22:10
|
|
Флудер
Регистрация: 21.03.2013
Сообщений: 2,861
С нами:
6917588
Репутация:
183
|
|
JavaScript :
Код:
const
generateText
=
async
(
)
=>
{
const
response
=
await
fetch
(
'https://fish-text.ru/get'
)
;
const
data
=
await
response
.
json
(
)
;
return
data
?.
status
!==
'success'
?
'я флужу, и че?'
:
data
.
text
;
}
;
// clearInterval(bot) - to stop bot
const
bot
=
setInterval
(
async
(
)
=>
{
const
input
=
document
.
querySelector
(
'.fr-element.fr-view'
)
?.
firstChild
;
const
parsedButtons
=
document
.
querySelectorAll
(
'.button--primary.button.button--icon.button--icon--reply'
)
;
const
button
=
Array
.
from
(
parsedButtons
)
.
find
(
(
button
)
=>
button
.
querySelector
(
'span'
)
?.
textContent
?.
includes
(
'Отправить'
)
)
;
if
(
input
&&
button
?.
checkVisibility
(
)
)
{
input
.
textContent
=
await
generateText
(
)
;
button
.
click
(
)
;
console
.
log
(
'ok'
)
;
}
else
{
console
.
log
(
'Failed. Retrying...'
)
}
}
,
305
)
;
|
|
|