Skip to content

Commit

Permalink
Update quest.py
Browse files Browse the repository at this point in the history
  • Loading branch information
cringe-neko-girl authored Jan 30, 2025
1 parent 3d2faf3 commit 79e2cea
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions Cogs/quest.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ async def quest(self, ctx, args: str = None):
traceback.print_exc()
await ctx.send(f"{error_message}")

@commands.command(name="q_roles")
async def q_roles(self, ctx, *role_mentions: discord.Role):
@commands.command(name="quest_roles")
async def quest_roles(self, ctx, *role_mentions: discord.Role):
"""Command for admins to set or list roles that a target can get randomly."""


Expand Down Expand Up @@ -339,7 +339,7 @@ async def inventory(self, ctx):
)
logger.error(f"Error in inventory command: {e}")

@commands.command(name="stars", aliases=["bal", "points", "balance"])
@commands.command(name="balance", aliases=["bal", "points", "stars","stp"])
async def balance(
self, ctx, method=None, amount: int = None, member: discord.Member = None
):
Expand Down Expand Up @@ -1291,8 +1291,7 @@ async def create_un_tool_id(self, guild_id, user_id, tool):


def generate_short_uuid():

return "".join(random.choices(string.digits, k=6) + 1000)
return str(int("".join(random.choices(string.digits, k=6))) + 1000)

db = self.mongoConnect[self.DB_NAME]
server_collection = db["Servers"]
Expand Down Expand Up @@ -2884,6 +2883,27 @@ async def check_material_indicator(self, material):
or 0
)
return user_quantity >= required_quantity

async def format_materials(self, item):
material_name = item.get("material", "")
required_quantity = item.get("quantity", 0)
user_quantity = await self.get_user_inventory_count(material_name) or 0

if user_quantity == 0:
indicator_emoji = "<:red:1261639413943762944> "
elif user_quantity < required_quantity:
indicator_emoji = "<:yellow:1261639412253724774> "
else:
indicator_emoji = "<:green:1261639410181476443> "

return f"{indicator_emoji} : {self.materials_dict.get(material_name, '')} - {user_quantity}/{required_quantity}"

async def get_user_inventory_count(self, material_name):

material_count = await self.quest_data.get_user_inventory_count(
self.guild_id, self.user_id, material_name
)
return material_count

async def material_callback(self, interaction: discord.Interaction):
try:
Expand Down

0 comments on commit 79e2cea

Please sign in to comment.