Commit d704339
src/config.py
@@ -156,14 +156,21 @@ class TID:
ADMIN_GROUP = os.getenv("TID_ADMIN_GROUP", "me")
CHANNEL_YTDLP_BACKUP = os.getenv("TID_CHANNEL_YTDLP_BACKUP", "me")
GROUP67373 = os.getenv("TID_GROUP67373", "")
- SKIP_BOTS = os.getenv("TID_SKIP_BOTS", "")
- SKIP_CHANNELS = os.getenv("TID_SKIP_CHANNELS", "")
- SKIP_GROUPS = os.getenv("TID_SKIP_GROUPS", "")
- SKIP_USERS = os.getenv("TID_SKIP_USERS", "")
+ # ONLY: Only process messages from these chats
ONLY_BOTS = os.getenv("TID_ONLY_BOTS", "")
ONLY_CHANNELS = os.getenv("TID_ONLY_CHANNELS", "")
ONLY_GROUPS = os.getenv("TID_ONLY_GROUPS", "")
ONLY_USERS = os.getenv("TID_ONLY_USERS", "")
+ # SKIP: Ignore messages from these chats
+ SKIP_BOTS = os.getenv("TID_SKIP_BOTS", "")
+ SKIP_CHANNELS = os.getenv("TID_SKIP_CHANNELS", "")
+ SKIP_GROUPS = os.getenv("TID_SKIP_GROUPS", "")
+ SKIP_USERS = os.getenv("TID_SKIP_USERS", "")
+ # MUTE: Mark all messages from these chats as read
+ MUTE_BOTS = os.getenv("TID_MUTE_BOTS", "")
+ MUTE_CHANNELS = os.getenv("TID_MUTE_CHANNELS", "")
+ MUTE_GROUPS = os.getenv("TID_MUTE_GROUPS", "")
+ MUTE_USERS = os.getenv("TID_MUTE_USERS", "")
class DB:
src/main.py
@@ -48,6 +48,8 @@ async def main():
async def groups(client: Client, message: Message):
if not ENABLE.GROUPS:
return
+ if TID.MUTE_GROUPS and message.chat.id in [int(x.strip()) for x in TID.MUTE_GROUPS.split(",")]:
+ await message.read()
if TID.SKIP_GROUPS and message.chat.id in [int(x.strip()) for x in TID.SKIP_GROUPS.split(",")]:
return
if TID.ONLY_GROUPS and message.chat.id not in [int(x.strip()) for x in TID.ONLY_GROUPS.split(",")]:
@@ -64,6 +66,8 @@ async def main():
async def channels(client: Client, message: Message):
if not ENABLE.CHANNELS:
return
+ if TID.MUTE_CHANNELS and message.chat.id in [int(x.strip()) for x in TID.MUTE_CHANNELS.split(",")]:
+ await message.read()
if TID.SKIP_CHANNELS and message.chat.id in [int(x.strip()) for x in TID.SKIP_CHANNELS.split(",")]:
return
if TID.ONLY_CHANNELS and message.chat.id not in [int(x.strip()) for x in TID.ONLY_CHANNELS.split(",")]:
@@ -76,6 +80,8 @@ async def main():
async def bots(client: Client, message: Message):
if not ENABLE.BOTS:
return
+ if TID.MUTE_BOTS and message.chat.id in [int(x.strip()) for x in TID.MUTE_BOTS.split(",")]:
+ await message.read()
if TID.SKIP_BOTS and message.chat.id in [int(x.strip()) for x in TID.SKIP_BOTS.split(",")]:
return
if TID.ONLY_BOTS and message.chat.id not in [int(x.strip()) for x in TID.ONLY_BOTS.split(",")]:
@@ -92,6 +98,8 @@ async def main():
async def private(client: Client, message: Message):
if not ENABLE.USERS or message.chat.type.name != "PRIVATE":
return
+ if TID.MUTE_USERS and message.chat.id in [int(x.strip()) for x in TID.MUTE_USERS.split(",")]:
+ await message.read()
if TID.SKIP_USERS and message.chat.id in [int(x.strip()) for x in TID.SKIP_USERS.split(",")]:
return
if TID.ONLY_USERS and message.chat.id not in [int(x.strip()) for x in TID.ONLY_USERS.split(",")]: