Skip to content

Commit

Permalink
fix unpacking of what is actually a string
Browse files Browse the repository at this point in the history
  • Loading branch information
AbstractUmbra committed Jul 31, 2024
1 parent 7c4770a commit 71a48f3
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions modules/moderation.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,25 +243,26 @@ async def post_mystbin_content(self, contents: list[tuple[str, str]]) -> str:
async def find_badbins(self, message: discord.Message) -> None:
matches = self.BADBIN_RE.findall(message.content)

if matches:
contents: list[tuple[str, str]] = []
if not matches:
return

contents: list[tuple[str, str]] = []

for match in matches:
site, slug, ext = match
for match in matches:
site, slug, ext = match

if site is None or slug is None:
continue
if site is None or slug is None:
continue

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

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

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

await message.reply(msg, mention_author=False)
await message.reply(msg, mention_author=False)

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

0 comments on commit 71a48f3

Please sign in to comment.