从 Next.js VSCode 调试页面,我得到以下信息launch.json。
{
"configurations": [
{
"name": "Next.js: debug server-side",
"type": "node-terminal",
"request": "launch",
"command": "npm run dev"
},
{
"name": "Next.js: debug client-side",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000"
},
{
"name": "Next.js: debug full stack",
"type": "node-terminal",
"request": "launch",
"command": "npm run dev",
"serverReadyAction": {
"pattern": "- Local:.+(https?://.+)",
"uriFormat": "%s",
"action": "debugWithChrome"
}
}
]
}
Run Code Online (Sandbox Code Playgroud)
运行完整堆栈选项后,Next.js 会像任何旧的npm run dev. 问题是调试不是很有用。在我的调试终端中,我选择了它,以便在捕获的异常上有断点。在 Python 应用程序中(这是我的调试经验所在),只要出现异常,VSCode 就会在确切的行号处暂停,并给出有用的、可理解的错误。
对于 Next.js,断点给我带来了一个复杂的、普遍的错误,导致一些随机的 Next.js 源代码。这对我来说几乎没有任何意义。
例如,我收到一个承诺被拒绝的错误。这可能来自我使用 Axios 处理的请求 …
我怎样才能让discord.py发送一条消息,稍等一下,然后再发送另一条消息?
现在,这是我的命令:
@b.command()
async def message(ctx)
await ctx.send("First message")
await ctx.send("Second message after 5 seconds")
Run Code Online (Sandbox Code Playgroud) 对于不和谐机器人和 python 以及构建反垃圾邮件机器人来说非常陌生,这是我的代码:
import discord
from discord.ext import commands
import time
b = commands.Bot(command_prefix='not a bot')
b.remove_command("help")
@b.event
async def on_ready():
print('Bot is Ready')
authors = {}
authors1 = []
@b.event
async def on_message(ctx):
global authors
global authors1
author_id = ctx.author.id
for author2 in authors1:
if author_id == author2:
authors[author_id] += 1
else:
authors[author_id] = 1
authors1.append(author_id)
stop = False
timer = 5
while stop == False:
if timer > 0:
time.sleep(0.985)
timer -= 1
if authors[author_id] > 5:
await …Run Code Online (Sandbox Code Playgroud)