소스 검색

Adding message links to some log messages that were missing them

tags/2.0.0
Rocketsoup 2 달 전
부모
커밋
e32099a3d0
4개의 변경된 파일9개의 추가작업 그리고 8개의 파일을 삭제
  1. 5
    2
      rocketbot/cogs/crosspostcog.py
  2. 0
    2
      rocketbot/cogs/logcog.py
  3. 2
    2
      rocketbot/cogs/patterncog.py
  4. 2
    2
      rocketbot/cogs/urlspamcog.py

+ 5
- 2
rocketbot/cogs/crosspostcog.py 파일 보기

@@ -190,8 +190,11 @@ class CrossPostCog(BaseCog, name='Crosspost Detection'):
190 190
 			await message.set_reactions([])
191 191
 			await message.set_text(text)
192 192
 		else:
193
-			await message.set_text(f'User {context.member.mention} posted ' +
194
-				f'the same message in {channel_count} channels.')
193
+			body: str = f'User {context.member.mention} posted ' + \
194
+				f'the same message in {channel_count} channels.'
195
+			for msg in context.spam_messages:
196
+				body += f'\n- {msg.jump_url}'
197
+			await message.set_text(body)
195 198
 			await message.set_reactions(BotMessageReaction.standard_set(
196 199
 				did_delete = deleted_count >= spam_count,
197 200
 				message_count = spam_count,

+ 0
- 2
rocketbot/cogs/logcog.py 파일 보기

@@ -740,8 +740,6 @@ class LoggingCog(BaseCog, name='Logging'):
740 740
 		markdown_b = ''
741 741
 		a_open = False
742 742
 		b_open = False
743
-		# FIXME: Handle URLs better. They get mangled.
744
-		# URL regex: http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+
745 743
 		for i, s in enumerate(difflib.ndiff(a, b)):
746 744
 			operation = s[0]
747 745
 			content = s[2:]

+ 2
- 2
rocketbot/cogs/patterncog.py 파일 보기

@@ -153,8 +153,8 @@ class PatternCog(BaseCog, name='Pattern Matching'):
153 153
 			bm = BotMessage(
154 154
 				message.guild,
155 155
 				f'User {message.author.name} tripped custom pattern ' + \
156
-					f'`{statement.name}`.\n\nAutomatic actions taken:\n• ' + \
157
-					('\n• '.join(action_descriptions)),
156
+					f'`{statement.name}` at {message.jump_url}.\n\n' + \
157
+					'Automatic actions taken:\n• ' + ('\n• '.join(action_descriptions)),
158 158
 				type=message_type,
159 159
 				context=context)
160 160
 			self.record_warning(message.author)

+ 2
- 2
rocketbot/cogs/urlspamcog.py 파일 보기

@@ -129,7 +129,7 @@ class URLSpamCog(BaseCog, name='URL Spam'):
129 129
 			bm = BotMessage(
130 130
 					message.guild,
131 131
 					f'User {message.author.mention} posted a URL ' + \
132
-					f'{join_age_str} after joining.',
132
+					f'{join_age_str} after joining: {message.jump_url}',
133 133
 					type = BotMessage.TYPE_MOD_WARNING if needs_attention else BotMessage.TYPE_INFO,
134 134
 					context = context)
135 135
 			bm.quote = discordutils.remove_markdown(message.clean_content)
@@ -152,7 +152,7 @@ class URLSpamCog(BaseCog, name='URL Spam'):
152 152
 
153 153
 		if not self.contains_deceptive_links(message.content):
154 154
 			return
155
-		mod_text = f'User {message.author.name} ({message.author.id}) posted a deceptive link.'
155
+		mod_text = f'User {message.author.name} ({message.author.id}) posted a deceptive link. {message.jump_url}'
156 156
 		quoted = '> ' + escape_markdown(message.content).replace('\n', '\n> ')
157 157
 		mod_text += f'\n\n{quoted}'
158 158
 		self.log(message.guild, f'{message.author.name} posted deceptive link - action: {action}')

Loading…
취소
저장