mirror of
https://github.com/SantaSpeen/RoyaltyIT-tg-bot.git
synced 2026-05-19 16:10:34 +00:00
Add mute message
This commit is contained in:
+10
-7
@@ -22,13 +22,13 @@ mute_perm = types.ChatPermissions(
|
|||||||
can_send_media_messages=False,
|
can_send_media_messages=False,
|
||||||
can_send_polls=False,
|
can_send_polls=False,
|
||||||
can_send_other_messages=False
|
can_send_other_messages=False
|
||||||
)
|
)
|
||||||
unmute_perm = types.ChatPermissions(
|
unmute_perm = types.ChatPermissions(
|
||||||
can_send_messages=True,
|
can_send_messages=True,
|
||||||
can_send_media_messages=True,
|
can_send_media_messages=True,
|
||||||
can_send_polls=True,
|
can_send_polls=True,
|
||||||
can_send_other_messages=True
|
can_send_other_messages=True
|
||||||
)
|
)
|
||||||
formating = """
|
formating = """
|
||||||
```
|
```
|
||||||
new_member_message % {
|
new_member_message % {
|
||||||
@@ -119,15 +119,18 @@ async def mute(msg: types.Message):
|
|||||||
for word in splt:
|
for word in splt:
|
||||||
word: str
|
word: str
|
||||||
if word.endswith("d"):
|
if word.endswith("d"):
|
||||||
c += int(word[:len(word)-1]) * 24 * 60 * 60
|
c += int(word[:len(word) - 1]) * 24 * 60 * 60
|
||||||
elif word.endswith("h"):
|
elif word.endswith("h"):
|
||||||
c += int(word[:len(word)-1]) * 60 * 60
|
c += int(word[:len(word) - 1]) * 60 * 60
|
||||||
elif word.endswith("m"):
|
elif word.endswith("m"):
|
||||||
c += int(word[:len(word)-1]) * 60
|
c += int(word[:len(word) - 1]) * 60
|
||||||
elif word.endswith("s"):
|
elif word.endswith("s"):
|
||||||
c += int(word[:len(word)-1])
|
c += int(word[:len(word) - 1])
|
||||||
tools.set_mute(user_id, c)
|
tools.set_mute(user_id, c)
|
||||||
await tools.set_user_permissions(user_id, msg.chat.id, mute_perm)
|
await tools.set_user_permissions(user_id, msg.chat.id, mute_perm)
|
||||||
|
await msg.reply(
|
||||||
|
f"""<a href="tg://user?id={user_id}">Пользователь</a> будет молчать до <code>{c}</code>""" +
|
||||||
|
"секунды по UnixTime.", parse_mode=ParseMode.HTML)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
await msg.reply(f"Exception: <code>{e}</code>", parse_mode=ParseMode.HTML)
|
await msg.reply(f"Exception: <code>{e}</code>", parse_mode=ParseMode.HTML)
|
||||||
else:
|
else:
|
||||||
@@ -182,7 +185,7 @@ async def set_hello_message(msg: types.Message):
|
|||||||
hello = err = None
|
hello = err = None
|
||||||
|
|
||||||
if mode in ("default", "standart"):
|
if mode in ("default", "standart"):
|
||||||
hello = config.standart_start_message
|
hello = config.standard_start_message
|
||||||
elif mode == "new":
|
elif mode == "new":
|
||||||
if len(splt) > 2:
|
if len(splt) > 2:
|
||||||
hello = " ".join(splt[2:])
|
hello = " ".join(splt[2:])
|
||||||
|
|||||||
Reference in New Issue
Block a user