This repository has been archived on 2024-07-28. You can view files and clone it, but cannot push or open issues or pull requests.
moderator-bot/handlers/groups/service.py

58 lines
1.9 KiB
Python
Raw Normal View History

2022-11-06 03:48:10 -05:00
from load import dp, types
from database import Member
2022-08-16 06:28:08 -04:00
# TODO: fix it
# import utils
# import config
# vt = utils.VirusTotalAPI(config.vt_api,True)
# @dp.message_handler(content_types=["document"],chat_type=[types.ChatType.SUPERGROUP])
# async def file_handler(message:types.Message):
# file = await bot.get_file(message.document.file_id)
#
# await bot.send_message(
# message.chat.id,
# await vt.scan_file(file.file_path),
# parse_mode="Markdown"
# )
@dp.message_handler(content_types=["new_chat_members"])
async def welcome_message(message:types.Message):
# User
user = message.from_user
2022-11-06 03:48:10 -05:00
exists = Member.exists(Member.user_id,user.id)
2022-08-16 06:28:08 -04:00
if (exists):
await message.answer("Спасибо что вы с нами.")
if not (exists):
2022-11-06 03:48:10 -05:00
Member.create(
user_id = user.id,
first_name = user.first_name,
username = user.username,
)
2022-08-16 06:28:08 -04:00
# TODO: translate it
await message.answer((
f"Привет,{user.first_name}\n"
"Просим ознакомится с [правилами](https://telegra.ph/Pravila-CHata-Open-Source-05-29)\n"
"Советы на 'хороший тон':\n"
"\t\t1.Формулируй свою мысль в 1-2 предложения\n"
"\t\t1.Не задавай [мета](nometa.xyz) вопросы\n"),
parse_mode="Markdown")
await message.delete()
# @dp.message_handler()
# async def filter_link_shorts(message:types.Message):
# link_shorters = open("txt/link_shorters.txt","r").read().split()
#
# for y in link_shorters:
# for user_message in message.text.lower().split():
# if (y in user_message):await message.delete()
@dp.message_handler(content_types=types.ContentType.VOICE)
async def voice_message(message:types.Message):
2022-11-06 03:48:10 -05:00
pass