示例#1
0
文件: main.py 项目: Vulom/PilavBot
 def prefix(bot, ctx):
     try:
         guildId = ctx.guild.id
         return data.get_prefix(guildId) or default_prefix
     except:
         return default_prefix
示例#2
0
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}
示例#3
0
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}
示例#4
0
def prefix(_, ctx):
    try:
        return data.get_prefix(ctx.guild.id) or default_prefix
    except:
        return default_prefix