Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
f861a522fa | |||
09fe516871 | |||
9af555e757 | |||
234d7ea596 | |||
63643f812a |
@@ -64,6 +64,13 @@ final class index extends core
|
|||||||
$message->react('😬');
|
$message->react('😬');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($message->author->id === '380876873468608522' && rand(0, 100) < 6) {
|
||||||
|
// Сообщение от Даниила Богданова (godandem) и шанс 5%
|
||||||
|
|
||||||
|
// Отправка изображения: "надругался над даниилом богдановым"
|
||||||
|
$message->channel->sendMessage(_message::new()->addFile('images/daniil.png'));
|
||||||
|
}
|
||||||
|
|
||||||
foreach (explode(' ', $message->content) as $word) {
|
foreach (explode(' ', $message->content) as $word) {
|
||||||
// Перебор слов из текста сообщения
|
// Перебор слов из текста сообщения
|
||||||
|
|
||||||
@@ -71,24 +78,69 @@ final class index extends core
|
|||||||
$buffer = [];
|
$buffer = [];
|
||||||
|
|
||||||
// Конвертация проверяемых слов
|
// Конвертация проверяемых слов
|
||||||
$marina = self::ascii('марина', $buffer);
|
$arsen = self::ascii('арсен', $buffer);
|
||||||
$marishka = self::ascii('маришка', $buffer);
|
$arsenchik = self::ascii('арсенчик', $buffer);
|
||||||
$marinochka = self::ascii('мариночка', $buffer);
|
$senya = self::ascii('сеня', $buffer);
|
||||||
$marinushka = self::ascii('маринушка', $buffer);
|
|
||||||
$marya = self::ascii('маря', $buffer);
|
|
||||||
|
|
||||||
// Конвертация слова
|
// Конвертация слова
|
||||||
$_word = self::ascii(mb_strtolower($word), $buffer);
|
$_word = self::ascii(mb_strtolower($word), $buffer);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
levenshtein($_word, $marina, 2, 2, 1) < 3
|
($mirzaev = $message->guild->members->get('id', '534633964737134623')) instanceof member
|
||||||
|| levenshtein($_word, $marishka, 2, 1, 2) < 4
|
&& ($mirzaev->status === 'offline' || $mirzaev->status === null)
|
||||||
|| levenshtein($_word, $marinochka, 2, 1, 2) < 4
|
&& rand(0, 100) < 16
|
||||||
|| levenshtein($_word, $marinushka, 2, 1, 2) < 4
|
and levenshtein($_word, $arsen, 2, 2, 1) < 3
|
||||||
|| (levenshtein($_word, $marya, 3, 3, 1) < 3 && $word !== 'мария')
|
|| levenshtein($_word, $arsenchik, 2, 1, 2) < 4
|
||||||
|
|| (levenshtein($_word, $senya, 2, 2, 1) < 2 && $word !== 'меня' && $word !== 'тебя')
|
||||||
) {
|
) {
|
||||||
$message->reply(_message::new()->setContent('ЗДАРОВА'));
|
// Найдено обращение к Арсену, он не в сети и шанс 15%
|
||||||
|
|
||||||
|
// Отправка сообщения
|
||||||
|
$message->reply(_message::new()->setContent(match (rand(0, 5)) {
|
||||||
|
0 => 'батя спит',
|
||||||
|
1 => 'арсен проломил себе голову и находится в реанимации',
|
||||||
|
2 => '"МАРИНА ПЕРЕДАЙ ИМ ЧТО Я В БЕГАХ В ТАДЖИКИСТАНЕ"',
|
||||||
|
3 => 'ему раздавили яйца и он лежит в соседней комнате без сознания',
|
||||||
|
4 => 'папа меня бьёт за то, что я не удаляю такие сообщения :sob:',
|
||||||
|
5 => '<:smart:1105401468019822643>',
|
||||||
|
default => '<:smart:1105401468019822643>'
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
// Не найдено обращение к Арсену
|
||||||
|
|
||||||
|
// Инициализация буфера символов для конвертации: UTF-8 -> ASCII+
|
||||||
|
$buffer = [];
|
||||||
|
|
||||||
|
// Конвертация проверяемых слов
|
||||||
|
$marina = self::ascii('марина', $buffer);
|
||||||
|
$marishka = self::ascii('маришка', $buffer);
|
||||||
|
$marinochka = self::ascii('мариночка', $buffer);
|
||||||
|
$marinushka = self::ascii('маринушка', $buffer);
|
||||||
|
$marya = self::ascii('маря', $buffer);
|
||||||
|
|
||||||
|
// Конвертация слова
|
||||||
|
$_word = self::ascii(mb_strtolower($word), $buffer);
|
||||||
|
|
||||||
|
if (
|
||||||
|
rand(0, 100) < 31
|
||||||
|
and levenshtein($_word, $marina, 2, 2, 1) < 3
|
||||||
|
|| levenshtein($_word, $marishka, 2, 1, 2) < 4
|
||||||
|
|| levenshtein($_word, $marinochka, 2, 1, 2) < 4
|
||||||
|
|| levenshtein($_word, $marinushka, 2, 1, 2) < 4
|
||||||
|
|| (levenshtein($_word, $marya, 3, 3, 1) < 3 && $word !== 'мария')
|
||||||
|
) {
|
||||||
|
// Найдено обращение к Марине и шанс 30%
|
||||||
|
|
||||||
|
// Отправка сообщения
|
||||||
|
$message->reply(_message::new()->setContent('ЗДАРОВА'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Деинициализация неактуальных переменных
|
||||||
|
unset($buffer, $marina, $marishka, $marinochka, $marya, $_word);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Деинициализация неактуальных переменных
|
||||||
|
unset($buffer, $arsen, $arsenchik, $senya, $_word);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -238,10 +290,16 @@ final class index extends core
|
|||||||
$discord->application->commands->save(new command($discord, [
|
$discord->application->commands->save(new command($discord, [
|
||||||
'name' => 'dreamers',
|
'name' => 'dreamers',
|
||||||
'description' => 'BEBRA DREAMERS',
|
'description' => 'BEBRA DREAMERS',
|
||||||
'options' => [(new option($discord))
|
'options' => [
|
||||||
->setName('invite')
|
(new option($discord))
|
||||||
->setDescription('Send an invitation link to "BEBRA DREAMERS"')
|
->setName('invite')
|
||||||
->setType(option::SUB_COMMAND)]
|
->setDescription('Link to "BEBRA DREAMERS"')
|
||||||
|
->setType(option::SUB_COMMAND),
|
||||||
|
(new option($discord))
|
||||||
|
->setName('rules')
|
||||||
|
->setDescription('Rules of "BEBRA DREAMERS"')
|
||||||
|
->setType(option::SUB_COMMAND)
|
||||||
|
]
|
||||||
]));
|
]));
|
||||||
|
|
||||||
$discord->listenCommand(['dreamers', 'invite'], function (interaction $interaction) {
|
$discord->listenCommand(['dreamers', 'invite'], function (interaction $interaction) {
|
||||||
@@ -251,6 +309,15 @@ final class index extends core
|
|||||||
// Отправка ссылки с приглашением присоединиться на сервер BEBRA DREAMERS
|
// Отправка ссылки с приглашением присоединиться на сервер BEBRA DREAMERS
|
||||||
if ($interaction->data->options->has('invite')) $interaction->respondWithMessage(_message::new()->setContent('https://discord.bebra.team'));
|
if ($interaction->data->options->has('invite')) $interaction->respondWithMessage(_message::new()->setContent('https://discord.bebra.team'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$discord->listenCommand(['dreamers', 'rules'], function (interaction $interaction) {
|
||||||
|
// Игнорирование чат-роботов
|
||||||
|
if ($interaction->user->bot) return;
|
||||||
|
|
||||||
|
// Отправка ссылки с приглашением присоединиться на сервер BEBRA DREAMERS
|
||||||
|
if ($interaction->data->options->has('rules')) $interaction->respondWithMessage(_message::new()->setContent('https://rules.bebra.team'));
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->discord->run();
|
$this->discord->run();
|
||||||
|
BIN
mirzaev/marina/system/public/images/daniil.png
Normal file
BIN
mirzaev/marina/system/public/images/daniil.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 390 KiB |
Reference in New Issue
Block a user