Jelajahi Sumber

reporting on DMs

root 3 tahun lalu
induk
melakukan
0e62cc43dc
2 mengubah file dengan 7 tambahan dan 6 penghapusan
  1. 4 4
      bot/commands/general.py
  2. 3 2
      bot/events/general.py

+ 4 - 4
bot/commands/general.py

@@ -61,20 +61,20 @@ class General(commands.Cog):
 
 		if not message:
 			if channel:
-				await ctx.send(f"What would you like me to say in {channel}?")
+				await ctx.send(f"What would you like me to say in `{channel}`?")
 			elif user:
-				await ctx.send(f"What would you like me to say to {user}?")
+				await ctx.send(f"What would you like me to say to `{user}`?")
 			else:
 				await ctx.send("What would you like me to say?")
 		elif channel:
 			if await get_interact(self.bot.pg, channel.id):
 				await channel.send(message)
-				await report(self.bot, f"{ctx.author}  has sent {message} to {channel.name}", ctx.guild)
+				await report(self.bot, f"`{ctx.author}`  has sent {message} to `{channel.name}`", ctx.guild)
 			else:
 				await ctx.send(f"Interactive mode for {channel} is deactivated.")
 		elif user:
 			await user.send(message)
-			await report(f"{ctx.author}  has sent {message} to {user.name}")
+			await report(self.bot, f"`{ctx.author}`  has sent {message} to `{user.name}`")
 		else:
 			await ctx.send(message)
 			await report(self.bot, f"`{ctx.author}` has sent `{message}` locally.", ctx.guild)

+ 3 - 2
bot/events/general.py

@@ -54,6 +54,8 @@ class General(commands.Cog):
 					await insert_channel(self.bot.pg, message.channel.id, message.guild.id)
 				except asyncpg.exceptions.ForeignKeyViolationError:
 					await update_guild(self.bot.pg, message.guild)
+		elif self.bot.user != message.author:	# Not a guild message and not from bot.
+			await report(self.bot, f"`{message.author}`: {message.content}")
 		
 		# Do not respond to one self.
 		if self.bot.user == message.author:
@@ -61,8 +63,7 @@ class General(commands.Cog):
 
 		# Respond when mentioned
 		if self.bot.user.mentioned_in(message):
-			print(f"Message channel ID: {message.channel.id}")
-			if await get_interact(self.bot.pg, message.channel.id):
+			if isinstance(message.channel, discord.channel.DMChannel) or await get_interact(self.bot.pg, message.channel.id):
 				messages = [
 					f"Hello {message.author.mention}. <3",
 					f"How are you today {message.author.mention}?",