Changed the way leave and join messages display names and removed the unban check

This commit is contained in:
Hattenburg 2020-05-04 13:23:05 +02:00
parent 79824663df
commit ea2cf80fc3

View File

@ -84,20 +84,20 @@ class TrafficCog(commands.Cog):
return
self.__checkClock()
if self.channel in member.guild.channels and self.toggleLogs:
await self.channel.send('>>> {0} has joined the server'.format(member.mention))
await self.channel.send('{0} has joined the server'.format(member.name))
self.totalJoinedCount += 1
self.dailyJoinedCount += 1
self.totalLogs += 1
except (discord.NotFound, discord.Forbidden):
print(
f'Error Occured! sending a dm to {member.display_name} didnt work !')
f'Error Occured!')
@commands.Cog.listener()
async def on_member_remove(self, member: discord.Member) -> None:
try:
self.__checkClock()
if self.channel in member.guild.channels and self.toggleLogs:
await self.channel.send('>>> {0} has left the server'.format(member.mention))
await self.channel.send('{0} has left the server'.format(member.name))
self.totalLeftCount += 1
self.dailyLeftCount += 1
self.totalLogs += 1
@ -110,21 +110,10 @@ class TrafficCog(commands.Cog):
try:
self.__checkClock()
if self.channel in member.guild.channels and self.toggleLogs:
await self.channel.send('>>> {0} has been banned from the server'.format(member.mention))
await self.channel.send('{0} has been banned from the server'.format(member.name))
self.totalLeftCount += 1
self.dailyLeftCount += 1
self.totalLogs += 1
except (discord.NotFound, discord.Forbidden):
print(
f'Error Occured!')
@commands.Cog.listener()
async def on_member_ban(self, guild: discord.Guild, member: discord.Member) -> None:
try:
self.__checkClock()
if self.channel in member.guild.channels and self.toggleLogs:
await self.channel.send('>>> {0} has been unbanned from the server'.format(member.mention))
self.totalLogs += 1
except (discord.NotFound, discord.Forbidden):
print(
f'Error Occured!')