def prefix(bot, ctx): try: guildId = ctx.guild.id return data.get_prefix(guildId) or default_prefix except: return default_prefix
async def read_mapping(guildId: str): prefix = data.get_prefix(guildId) if not prefix: raise HTTPException(status_code=404, detail="Prefix not found") return {"guildId": guildId, "prefix": prefix}
async def add_mapping(mapping: PrefixMapping, guildId: str): data.add_prefix_mapping(guildId, mapping.prefix) prefix = data.get_prefix(guildId) if not prefix: raise HTTPException(status_code=404, detail="Prefix not found") return {"guildId": guildId, "prefix": prefix}
def prefix(_, ctx): try: return data.get_prefix(ctx.guild.id) or default_prefix except: return default_prefix