Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ Changes since 2026.06.15

## Fun

### Giphy
- Fixes giphy command not correctly returning the image

## Internal

## Moderation
Expand Down
18 changes: 2 additions & 16 deletions modules/fun/giphy.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,9 @@ class Giphy(cogs.BaseCog):
SEARCH_LIMIT (int): The max amount of gifs to search for
"""

GIPHY_URL: str = "http://api.giphy.com/v1/gifs/search?q={}&api_key={}&limit={}"
GIPHY_URL: str = "https://api.giphy.com/v1/gifs/search?q={}&api_key={}&limit={}"
SEARCH_LIMIT: int = 10

@staticmethod
def parse_url(url: str) -> str:
"""Parses the raw API url into a useable gif link

Args:
url (str): The raw URL from Giphy

Returns:
str: The direct link to the gif, if it exists
"""
index = url.find("?cid=")
return url[:index]

@auxiliary.with_typing
@commands.guild_only()
@commands.command(
Expand Down Expand Up @@ -90,8 +77,7 @@ async def giphy(self: Self, ctx: commands.Context, *, query: str) -> None:

embeds = []
for item in data:
url = item.get("images", {}).get("original", {}).get("url")
url = self.parse_url(url)
url = item.get("embed_url", {})
embeds.append(url)

await ui.PaginateView().send(ctx.channel, ctx.author, embeds)
Loading