From the code that you have posted on here, it seems that you are trying to use the variable member_id
without having declared it. If member_id is not a global variable, it will have to be declared and assigned a value before it can be used or converted to a string. An example would be so:
@commands.command()
async def level(self, ctx, member: discord.Member = None):
member = ctx.author if not member else member
#Assuming member has the id
member_id = member.id #declaring member_id here
member_id = str(member_id)
guild_id = str(ctx.guild.id)
user = await self.bot.pg_con.fetch("SELECT * FROM users WHERE user_id = $1 AND guild_id = $2", member_id, guild_id)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…