feat: Add User-Agent header to Teto image request for improved compatibility

This commit is contained in:
Slipstream 2025-05-19 19:15:47 -06:00
parent 24f0823fb3
commit b6cc472eee
Signed by: slipstream
GPG Key ID: 13E498CE010AC6FD

View File

@ -14,7 +14,8 @@ class TetoImageCog(commands.Cog):
async with ctx.typing():
try:
async with aiohttp.ClientSession() as session:
async with session.get(self.teto_url, allow_redirects=False) as response:
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'}
async with session.get(self.teto_url, headers=headers, allow_redirects=False) as response:
if response.status == 302:
image_url = response.headers.get('Location')
if image_url: