Prevent logging bots
This commit is contained in:
parent
84fedfaa0b
commit
b8356917b3
@ -389,6 +389,19 @@ class DataIntegrityService:
|
||||
for member in guild.members:
|
||||
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):
|
||||
if is_for_shutdown != self._is_for_shutdown:
|
||||
self._is_for_shutdown = is_for_shutdown
|
||||
@ -402,3 +415,4 @@ class DataIntegrityService:
|
||||
self._check_user_joins_vc()
|
||||
self._check_user_joined_gs()
|
||||
await self._check_for_user_achievements()
|
||||
self._check_for_bots()
|
||||
|
@ -104,6 +104,8 @@ class BaseOnMemberJoinEvent(OnMemberJoinABC):
|
||||
@EventChecks.check_is_ready()
|
||||
async def on_member_join(self, member: discord.Member):
|
||||
self._logger.debug(__name__, f"Module {type(self)} started")
|
||||
if member.bot:
|
||||
return
|
||||
await self._client_utils.check_default_role(member)
|
||||
self._check_for_known_user(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}")
|
||||
server = self._servers.get_server_by_discord_id(member.guild.id)
|
||||
if member.bot:
|
||||
return
|
||||
|
||||
try:
|
||||
if before.channel == after.channel:
|
||||
|
Loading…
Reference in New Issue
Block a user