Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shiba->doge; return either shiba or akita #17

Merged
merged 1 commit into from
Aug 9, 2023
Merged
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
15 changes: 10 additions & 5 deletions commands/shiba/random_shiba.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
import discord
from ..modules.async_utils import _async_get_json
from random import choice

POSSIBLE_BREEDS = (
"https://dog.ceo/api/breed/shiba/images/random",
"https://dog.ceo/api/breed/akita/images/random",
)


def register_commands(tree, this_guild: discord.Object):
@tree.command(
name="shiba",
description="Shiba",
name="doge",
description="Random Shiba or Akita image",
guild=this_guild,
)
async def random_shiba(
interaction: discord.Interaction,
):
shiba_json = await _async_get_json(
"https://dog.ceo/api/breed/shiba/images/random"
)
link = choice(POSSIBLE_BREEDS)
shiba_json = await _async_get_json(link)
if shiba_json is None or shiba_json["status"] != "success": # ):
return await interaction.response.send_message(
"Sorry, we couldn't find any dogs ):"
Expand Down