🐟 Commands
Code behind main two commands, and list of all commands.
l!rulebook, /rulebook
class Rulebook(commands.Cog):
def __init__(self, bot):
self.bot = bot
# Main Rulebook Command
@commands.hybrid_command(
name="rulebook", description="Load an Interactive LastFish! Rulebook and Guide!"
)
async def rulebook(self, ctx):
"""An interactive rulebook and guide!"""
# Creates DropDown menu + Options
class Dropdown(discord.ui.Select):
def __init__(self):
options = [
discord.SelectOption(#Option1)
]
super().__init__(
placeholder="Please Select a Page",
min_values=1,
max_values=1,
options=options,
)
# Gets user Selected option and returns it as an Embed
async def callback(self, interaction: discord.Interaction):
selected_option = self.values[0]
information = rulebook_pages[selected_option]["information"]
for option in self.options:
if option.label == selected_option:
embed = discord.Embed(
title=option.label,
description=option.description,
color=6750182,
)
embed.add_field(name="", value=information)
embed.set_image(
url=rulebook_pages.get(option.label, {}).get("image", None)
)
await interaction.response.send_message(embed=embed, ephemeral=True)
#Discord Dropdown Shenanigans
class DropdownView(discord.ui.View):
def __init__(self):
super().__init__()
# Adds the dropdown to our view object.
self.add_item(
Dropdown(),
)
logger.info("Command Invoked")
# Creates and Sends Beginning Embed from /rulebook command
welcome_embed = discord.Embed(
title="Welcome to the Rulebook",
description=(f"{players}2-6 Players \n {clock}Gametime: 10-60 minutes"),
color=discord.Color.teal(),
)
# Welcome Embed Formatting Redacted
view = DropdownView()
message = await ctx.send(embed=welcome_embed, view=view, ephemeral=True)
await asyncio.sleep(180)
await message.delete()
logger.info("Welcome Embed Deleted")
l!card <name>, /card lookup:
@commands.hybrid_command(name="card", description="View a Card!")
async def card(self, ctx, *, lookup):
print(f"Card name: {lookup}")
# Load CSV
with open("cards.csv", "r") as file:
reader = csv.DictReader(file)
# Search CSV and Generate Embed
for row in reader:
if row["Name"].lower() == lookup.lower():
embed = discord.Embed(title=row["Name"])
embed.set_image(url=row["Art"])
embed.add_field(
name="Description", value=row["Description"], inline=False
)
embed.set_footer(text=row["FlavorText"])
embed.add_field(name="Type", value=row["CardType"], inline=True)
embed.add_field(name="Artist", value=row["Artist"], inline=False)
embed.set_thumbnail(url=row["Icon"])
color = int(row["Border"][1:], 16)
embed.colour = discord.Colour(color)
await ctx.send(embed=embed)
break
# If card not found -> Send Error embed.
else:
#Error Embeds
@card.autocomplete("lookup")
async def cardname_autocomplete(
self,
ctx,
cardname: str,
) -> list[app_commands.Choice[str]]:
return [
app_commands.Choice(name=name, value=name)
for name in self.card_names
if cardname.lower() in name.lower()
]
List of all commands
/Rulebook or !rulebook
/Card or !card <Card Name>
/PlayerSelect
/Suggest
/Credits or !credits
/About or !about
!lore or !readings
l!reminder <on/off> (Rico/SageMax Only)
l!randcard
Last updated