Skip to content

Commit 71a48f3

Browse files
committed
fix unpacking of what is actually a string
1 parent 7c4770a commit 71a48f3

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

modules/moderation.py

+14-13
Original file line numberDiff line numberDiff line change
@@ -243,25 +243,26 @@ async def post_mystbin_content(self, contents: list[tuple[str, str]]) -> str:
243243
async def find_badbins(self, message: discord.Message) -> None:
244244
matches = self.BADBIN_RE.findall(message.content)
245245

246-
if matches:
247-
contents: list[tuple[str, str]] = []
246+
if not matches:
247+
return
248+
249+
contents: list[tuple[str, str]] = []
248250

249-
for match in matches:
250-
site, slug, ext = match
251+
for match in matches:
252+
site, slug, ext = match
251253

252-
if site is None or slug is None:
253-
continue
254+
if site is None or slug is None:
255+
continue
254256

255-
contents.append((await self.pull_badbin_content(site, slug), f"migrated.{ext or 'txt'}"))
257+
contents.append((await self.pull_badbin_content(site, slug), f"migrated.{ext or 'txt'}"))
256258

257-
if contents:
258-
key, notice = await self.post_mystbin_content(contents)
259-
msg = f"I've detected a badbin and have uploaded your pastes here: https://mystb.in/{key}"
259+
if not contents:
260+
return
260261

261-
if notice:
262-
msg += "\nnotice: " + notice
262+
key = await self.post_mystbin_content(contents)
263+
msg = f"I've detected a badbin and have uploaded your pastes here: https://mystb.in/{key}"
263264

264-
await message.reply(msg, mention_author=False)
265+
await message.reply(msg, mention_author=False)
265266

266267
@commands.Cog.listener()
267268
async def on_papi_dpy_modlog(self, payload: ModLogPayload, /) -> None:

0 commit comments

Comments
 (0)