Skip to content

Commit

Permalink
add transcript BoolParam
Browse files Browse the repository at this point in the history
  • Loading branch information
wizzdom committed Jan 15, 2025
1 parent ea6d1c6 commit 0c41098
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/extensions/xkcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ async def get_max_comics():


@xkcd.include
@arc.slash_command("xkcd", "So tell me Frank!")
@arc.slash_command("xkcd", "Wisdom from xkcd!")
async def xkcd_command(
ctx: arc.GatewayContext,
num: arc.Option[
int | None, arc.IntParams("Optionally specify an xkcd number.")
] = None,
transcript: arc.Option[bool, arc.BoolParams("Show the transcript?")] = False,
aiohttp_client: aiohttp.ClientSession = arc.inject(),
) -> None:
"""Send an xkcd!"""
Expand Down Expand Up @@ -54,9 +55,14 @@ async def xkcd_command(
return
data = await response.json()

if transcript:
description = data["transcript"]
else:
description = ""

embed = hikari.Embed(
title=data["title"],
description=data["transcript"],
description=description,
url=page_url,
)
embed = embed.set_image(data["img"])
Expand Down

0 comments on commit 0c41098

Please sign in to comment.