__version__ = (0, 0, 1)
# *
# * $$\ $$\ $$\ $$\ $$\
# * $$ | \__| $$ | $$ | $$ |
# * $$$$$$$\ $$$$$$$\ $$\ $$$$$$\ $$$$$$\$$$$\ $$$$$$\ $$$$$$$ |$$\ $$\ $$ | $$$$$$\ $$$$$$$\
# * $$ _____|$$ __$$\ $$ |\_$$ _| $$ _$$ _$$\ $$ __$$\ $$ __$$ |$$ | $$ |$$ |$$ __$$\ $$ _____|
# * \$$$$$$\ $$ | $$ |$$ | $$ | $$ / $$ / $$ |$$ / $$ |$$ / $$ |$$ | $$ |$$ |$$$$$$$$ |\$$$$$$\
# * \____$$\ $$ | $$ |$$ | $$ |$$\ $$ | $$ | $$ |$$ | $$ |$$ | $$ |$$ | $$ |$$ |$$ ____| \____$$\
# * $$$$$$$ |$$ | $$ |$$ | \$$$$ |$$ | $$ | $$ |\$$$$$$ |\$$$$$$$ |\$$$$$$ |$$ |\$$$$$$$\ $$$$$$$ |
# * \_______/ \__| \__|\__| \____/ \__| \__| \__| \______/ \_______| \______/ \__| \_______|\_______/
# *
# *
# * © Copyright 2023
# *
# * https://t.me/shitmodules
# *
# 🔒 Code is licensed under CC-BY-NC-ND 4.0 unless otherwise specified.
# 🌐 https://creativecommons.org/licenses/by-nc-nd/4.0/
# You CANNOT edit this file without direct permission from the author.
# You can redistribute this file without any changes.
# scope: hikka_only
# scope: hikka_min 1.6.2
# meta pic: https://raw.githubusercontent.com/kamolgks/assets/main/RandomChats.jpg
# meta banner: https://raw.githubusercontent.com/kamolgks/assets/main/RandomChats.jpg
# meta developer: @shitmodules
from telethon import events, functions
from telethon.tl.types import Message
from asyncio.exceptions import TimeoutError
from telethon.errors.rpcerrorlist import YouBlockedUserError
from .. import loader, utils
@loader.tds
class RandomChatsMod(loader.Module):
"""The module throws off a random chat"""
strings = {
"name": "RandomChats",
"processing": "🙂Uploading a chat...",
"un-iris": (
"⛔️"
"Unlock this bot: @iris_moon_bot",
),
"time-err": (
"⛔️The waiting time has expired. "
"Either the bot is loaded, or it's dead. Try again a little later"
),
}
strings_ru = {
"processing": "🙂Загрузка чата...",
"un-iris": (
"⛔️"
"Разблокируй этого бота: @iris_moon_bot",
),
"time-err": (
"⛔️Истекло время ожидания. "
"Либо бот нагружен, либо он умер. Попробуйте немного позже."
),
}
strings_uz = {
"processing": "🙂Chat yuklanmoqda...",
"un-iris": (
"⛔️"
"Ushbu botni qora ro'yxatdan chiqaring: @iris_moon_bot",
),
"time-err": (
"⛔️Kutish vaqti tugadi. "
"Yoki bot Yuklangan yoki u vafot etgan. Birozdan keyin sinab ko'ring."
),
}
strings_kk = {
"processing": "🙂Чатты жүктеу...",
"un-iris": (
"⛔️"
"Бұл боттың құлпын ашыңыз: @iris_moon_bot",
),
"time-err": (
"⛔️Күту уақыты аяқталды."
"Не бот жүктелген, не ол қайтыс болды. Сәл кейінірек көріңіз."
),
}
strings_tr = {
"processing": "🙂Sohbet yükleniyor...",
"un-iris": (
"⛔️ "
"Bu botun engellemesini kaldırın: @iris_moon_bot"
),
"time-err": (
"⛔️zaman aşımı süresi doldu."
"Ya bot yüklendi ya da öldü. Lütfen daha sonra tekrar deneyiniz."
),
}
@loader.command(
ru_doc="> Кидает рандомную ссылку на чат",
uz_doc="> Tasodifiy chat havolasini tashlaydi",
kk_doc="> Кездейсоқ чат сілтемесін лақтырады",
tr_doc="> Sohbete rastgele bir bağlantı atar",
)
async def rchatcmd(self, message: Message):
"""> Throws a random link to the chat"""
msg = await utils.answer(message, self.strings("processing"))
chat = "@iris_moon_bot"
async with message.client.conversation(chat) as conv:
try:
response = conv.wait_event(events.NewMessage(
incoming=True, from_users=chat))
await message.client.send_message(chat, "🔀 Случайная беседа")
response = await response
except YouBlockedUserError:
await message.edit(self.strings("un-iris"))
return
except TimeoutError:
await utils.answer(message, self.strings("time-err"))
return
if response.text:
await msg.edit(f"🙂{response.text}")
await message.client(
functions.messages.DeleteHistoryRequest(
peer="@iris_moon_bot", max_id=0, just_clear=False, revoke=True,
),
)