Merge pull request #16 from Kanium/trafficfix

Changed the way leave and join messages display names and removed the…
This commit is contained in:
Hattenburg 2020-05-04 16:29:52 +02:00 committed by GitHub
commit c1e2c59b44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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!')