@@ -23,9 +23,7 @@ def __init__(self, bot):
2323
2424 @commands .Cog .listener ()
2525 async def on_command_error (self , ctx , error ):
26- print (
27- "Ignoring exception in command {}:" .format (ctx .command ), file = sys .stderr
28- )
26+ print ("Ignoring exception in command {}:" .format (ctx .command ), file = sys .stderr )
2927 traceback .print_exception (
3028 type (error ), error , error .__traceback__ , file = sys .stderr
3129 )
@@ -50,7 +48,7 @@ async def on_ready(self):
5048 # Sends message to mods, when bot is online
5149 print ("Now Online" )
5250 await self .utils .sendModsMessage (
53- "Bot is now online.\n Version:\t DiscordBot DataBot v2.0.1 "
51+ "Bot is now online.\n Version:\t DiscordBot DataBot v2.1.0 "
5452 )
5553
5654 # When a member joins a guild
@@ -61,8 +59,7 @@ async def on_member_join(self, member):
6159
6260 Creates a welcome message in the log channel
6361 """
64- channel = self .bot .get_channel (
65- int (self .jh .getFromConfig ("logchannel" )))
62+ channel = self .bot .get_channel (int (self .jh .getFromConfig ("logchannel" )))
6663 guild = self .bot .get_guild (int (self .jh .getFromConfig ("guild" )))
6764 await channel .send (f"Hey **{ member .mention } **, welcome to { guild } " )
6865
@@ -81,8 +78,7 @@ async def on_member_remove(self, member):
8178
8279 Sends a goodbye message in the log channel
8380 """
84- channel = self .bot .get_channel (
85- int (self .jh .getFromConfig ("logchannel" )))
81+ channel = self .bot .get_channel (int (self .jh .getFromConfig ("logchannel" )))
8682 guild = self .bot .get_guild (int (self .jh .getFromConfig ("guild" )))
8783 await channel .send (
8884 f"**{ member .name } ** has left { guild } . Press F to pay respect."
@@ -95,7 +91,7 @@ async def on_member_remove(self, member):
9591 [hash, code] = self.utils.hashData(voice, text, textCount, member.id)
9692 #Send user data
9793 embed = discord.Embed(title=f"{member.nick} ({member.name})", color=12008408)
98- embed.set_thumbnail(url=member.avatar_url )
94+ embed.set_thumbnail(url=member.avatar )
9995 embed.add_field(name="VoiceXP", value=f"{voice}", inline=True)
10096 embed.add_field(name="TextXP", value=f"{text}", inline=True)
10197 embed.add_field(name="TextMessages", value=f"{textCount}", inline=True)
@@ -210,8 +206,7 @@ async def on_raw_reaction_add(self, payload):
210206 not (message .author .bot or payload .member .bot )
211207 and self .jh .getFromConfig ("log" ) == "True"
212208 ):
213- self .jh .addReactionXP (
214- payload .user_id , self .xpf .randomRange (1 , 5 ))
209+ self .jh .addReactionXP (payload .user_id , self .xpf .randomRange (1 , 5 ))
215210 self .jh .saveData ()
216211
217212 # When a user changes his voice state
@@ -247,10 +242,7 @@ async def on_voice_state_update(self, member, before, after):
247242 and before .channel .name [- 1 ].isdigit ()
248243 ):
249244 # Member left first channel
250- if (
251- before .channel .name [- 1 ] == "1"
252- and not before .channel .name [- 2 ].isdigit ()
253- ):
245+ if before .channel .name [- 1 ] == "1" and not before .channel .name [- 2 ].isdigit ():
254246 # Delete last channel, which has no user in it
255247
256248 channelWithoutNumber = before .channel .name [:- 1 ]
@@ -302,8 +294,7 @@ async def on_voice_state_update(self, member, before, after):
302294 # in it
303295 if afterNumber and len (
304296 find (
305- lambda c : c .name == (
306- channelWithoutNumber + "1" ), allChannel
297+ lambda c : c .name == (channelWithoutNumber + "1" ), allChannel
307298 ).members
308299 ):
309300 # Get channels with after.channel.name without numbers in it and end
@@ -363,9 +354,10 @@ async def on_message(self, message):
363354 a = "" + message .content
364355
365356 # Stops user from writting in levelchannel none command messages
366- if str (message .channel .id ) == str (
367- self .jh .getFromConfig ("levelchannel" )
368- ) and a [0 ] != self .jh .getFromConfig ("command_prefix" ):
357+ print (a )
358+ if str (message .channel .id ) == str (self .jh .getFromConfig ("levelchannel" )) and a [
359+ 0
360+ ] != self .jh .getFromConfig ("command_prefix" ):
369361 await message .delete ()
370362 return
371363
@@ -400,11 +392,13 @@ async def on_message(self, message):
400392 except Exception :
401393 channelName = "DM"
402394 string = (
403- "\n ###### \n # User "
395+ "\n ``` User "
404396 + str (message .author .name )
405397 + "tried to invoke a command in "
406398 + str (channelName )
407- + ".\n # Command: {a}\n ######"
399+ + ".\n Command: "
400+ + a
401+ + "```\n "
408402 )
409403 await self .utils .log (string , 2 )
410404
@@ -437,5 +431,5 @@ def _getLeaderboardChange(self, message):
437431 return i
438432
439433
440- def setup (bot ):
441- bot .add_cog (Commandlistener (bot ))
434+ async def setup (bot ):
435+ await bot .add_cog (Commandlistener (bot ))
0 commit comments