Skip to content

Commit

Permalink
[Captcha] fix file location
Browse files Browse the repository at this point in the history
  • Loading branch information
japandotorg committed Oct 25, 2023
1 parent 5fb8131 commit 6a07c67
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions captcha/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,9 @@ async def on_member_join(self, member: discord.Member) -> None:

captcha: CaptchaObj = CaptchaObj(self, width=300, height=100)
captcha.generate(message)
captcha.write(message, f"{str(self.data_path)}/captchas/{member.id}.png")
captcha.write(message, f"{str(self.data_path)}/{member.id}.png")

captcha_file: discord.File = discord.File(
f"{str(self.data_path)}/captchas/{member.id}.png"
)
captcha_file: discord.File = discord.File(f"{str(self.data_path)}/{member.id}.png")

message_before_captcha: str = await self.config.guild(
member.guild
Expand Down Expand Up @@ -251,7 +249,7 @@ def check(message: discord.Message) -> bool:

self._user_tries[member.id].append(temp_success_message)

os.remove(f"{str(self.data_path)}/captchas/{member.id}.png")
os.remove(f"{str(self.data_path)}/{member.id}.png")

role_id: int = await self.config.guild(member.guild).role_after_captcha()
role: Optional[discord.Role] = discord.utils.get(member.guild.roles, id=role_id)
Expand Down Expand Up @@ -326,6 +324,6 @@ async def on_message(self, message: discord.Message) -> None:
except KeyError:
pass

os.remove(f"{str(self.data_path)}/captchas/{member.id}.png")
os.remove(f"{str(self.data_path)}/{member.id}.png")
del self._user_tries[member.id]
# fmt: on

0 comments on commit 6a07c67

Please sign in to comment.