Prevent logging bots
All checks were successful
Deploy dev on push / on-push-deploy_sh-edraft (push) Successful in 4m20s
All checks were successful
Deploy dev on push / on-push-deploy_sh-edraft (push) Successful in 4m20s
This commit is contained in:
parent
44b2d75864
commit
6121299f20
@ -389,6 +389,19 @@ class DataIntegrityService:
|
|||||||
for member in guild.members:
|
for member in guild.members:
|
||||||
await self._client_utils.check_default_role(member)
|
await self._client_utils.check_default_role(member)
|
||||||
|
|
||||||
|
def _check_for_bots(self):
|
||||||
|
for guild in self._bot.guilds:
|
||||||
|
server = self._servers.get_server_by_discord_id(guild.id)
|
||||||
|
|
||||||
|
for member in guild.members.where(lambda x: x.bot):
|
||||||
|
user = self._users.find_user_by_discord_id_and_server_id(member.id, server.id)
|
||||||
|
if user is None:
|
||||||
|
continue
|
||||||
|
|
||||||
|
self._user_joins_vc.delete_user_joined_voice_channel_by_user_id(user.id)
|
||||||
|
self._users.delete_user(user)
|
||||||
|
self._db_context.save_changes()
|
||||||
|
|
||||||
async def check_data_integrity(self, is_for_shutdown=False):
|
async def check_data_integrity(self, is_for_shutdown=False):
|
||||||
if is_for_shutdown != self._is_for_shutdown:
|
if is_for_shutdown != self._is_for_shutdown:
|
||||||
self._is_for_shutdown = is_for_shutdown
|
self._is_for_shutdown = is_for_shutdown
|
||||||
@ -402,3 +415,4 @@ class DataIntegrityService:
|
|||||||
self._check_user_joins_vc()
|
self._check_user_joins_vc()
|
||||||
self._check_user_joined_gs()
|
self._check_user_joined_gs()
|
||||||
await self._check_for_user_achievements()
|
await self._check_for_user_achievements()
|
||||||
|
self._check_for_bots()
|
||||||
|
@ -104,6 +104,8 @@ class BaseOnMemberJoinEvent(OnMemberJoinABC):
|
|||||||
@EventChecks.check_is_ready()
|
@EventChecks.check_is_ready()
|
||||||
async def on_member_join(self, member: discord.Member):
|
async def on_member_join(self, member: discord.Member):
|
||||||
self._logger.debug(__name__, f"Module {type(self)} started")
|
self._logger.debug(__name__, f"Module {type(self)} started")
|
||||||
|
if member.bot:
|
||||||
|
return
|
||||||
await self._client_utils.check_default_role(member)
|
await self._client_utils.check_default_role(member)
|
||||||
self._check_for_known_user(member)
|
self._check_for_known_user(member)
|
||||||
await self._add_if_not_exists_user_async(member)
|
await self._add_if_not_exists_user_async(member)
|
||||||
|
@ -97,6 +97,8 @@ class BaseOnVoiceStateUpdateEvent(OnVoiceStateUpdateABC):
|
|||||||
)
|
)
|
||||||
settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{member.guild.id}")
|
settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{member.guild.id}")
|
||||||
server = self._servers.get_server_by_discord_id(member.guild.id)
|
server = self._servers.get_server_by_discord_id(member.guild.id)
|
||||||
|
if member.bot:
|
||||||
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if before.channel == after.channel:
|
if before.channel == after.channel:
|
||||||
|
Loading…
Reference in New Issue
Block a user