def _geval(self, ctx, expression, type_=None):
"""Evaluate an expression."""
try:
if type_ == "await":
output = await eval(expression)
elif type_ == "exec":
output = exec(expression)
else:
output = eval(expression)
output = str(output)
except Exception as error:
output = f"x.x An error has occurred: {error}"
paginator = commands.Paginator(prefix="```py", max_size=500)
for index in range(0, len(output), 490):
paginator.add_line(output[index:index+490])
for page in paginator.pages:
await ctx.send(page)
评论列表
文章目录