[UPD] Added a mad mode

Добавил режим без рандома - вcё что попало, всё под преобразование
This commit is contained in:
homayk228
2025-10-08 21:11:41 +07:00
parent a2c94ec024
commit ec4170842a

View File

@@ -23,6 +23,7 @@ class NekoSpeakModule(loader.Module):
self.public_enabled = False self.public_enabled = False
# Загружаем из БД или создаём новый список # Загружаем из БД или создаём новый список
self.banned_chats = set() self.banned_chats = set()
self.bad_minded = False
async def client_ready(self): async def client_ready(self):
saved = self.db.get("NekoSpeak", "banned_chats", []) saved = self.db.get("NekoSpeak", "banned_chats", [])
@@ -49,9 +50,9 @@ class NekoSpeakModule(loader.Module):
words = text.split() words = text.split()
new_words = [] new_words = []
for word in words: for word in words:
if word.lower().startswith("н") and len(word) > 2 and random.random() < 0.05: if word.lower().startswith("н") and len(word) > 2 and (random.random() < 0.05 or self.bad_minded):
word = "ня" + word[2:] word = "ня" + word[2:]
if random.random() < 0.05: if random.random() < 0.05 or self.bad_minded:
word = word.replace("р", "р-" * random.randint(2,4)+"р") word = word.replace("р", "р-" * random.randint(2,4)+"р")
word = word.replace("r", "r" * random.randint(2,4)+"r") word = word.replace("r", "r" * random.randint(2,4)+"r")
new_words.append(word) new_words.append(word)
@@ -80,12 +81,12 @@ class NekoSpeakModule(loader.Module):
specialchar = [",",".","<",">","/","''",'""',":",";","{","}","[","]","|","!","@","#","$","%","^","&","?","*","(",")","-","_","+","=","`","~",""] specialchar = [",",".","<",">","/","''",'""',":",";","{","}","[","]","|","!","@","#","$","%","^","&","?","*","(",")","-","_","+","=","`","~",""]
for key, value in replacements.items(): for key, value in replacements.items():
if(random.random()<0.05): if(random.random()<0.05 or self.bad_minded):
text = text.replace(key, value) text = text.replace(key, value)
if random.random() < 0.05: if random.random() < 0.05 or self.bad_minded:
text += " мяу~" text += " мяу~"
elif random.random() < 0.05: elif random.random() < 0.05 or self.bad_minded:
if(text[-1:] in specialchar): if(text[-1:] in specialchar):
text=text[:-1]+"-ня"+text[-1:] text=text[:-1]+"-ня"+text[-1:]
else: else:
@@ -123,6 +124,12 @@ class NekoSpeakModule(loader.Module):
status = "включено" if self.public_enabled else "выключено" status = "включено" if self.public_enabled else "выключено"
await utils.answer(message, f"Ня! Преобразование в публичных чатах теперь {status}.") await utils.answer(message, f"Ня! Преобразование в публичных чатах теперь {status}.")
@loader.command(ru_doc="Отключает рандом, преобразовывает всё без шансов спастись")
async def nekospeakdumb(self, message: Message):
self.bad_minded = not self.bad_minded
status = "включён" if self.bad_minded else "отключён"
await utils.answer(message, f"Ня! Рандом {status}.")
@loader.command(ru_doc="Заблокировать чат для работы модуля") @loader.command(ru_doc="Заблокировать чат для работы модуля")
async def nekospeakex(self, message: Message): async def nekospeakex(self, message: Message):
args = utils.get_args_raw(message) args = utils.get_args_raw(message)