我有 Joi 模式,想添加一个自定义验证器来验证默认 Joi 验证器无法实现的数据。
目前,我使用的是 Joi 16.1.7 版本
const method = (value, helpers) => {
// for example if the username value is (something) then it will throw an error with flowing message but it throws an error inside (value) object without error message. It should throw error inside the (error) object with a proper error message
if (value === "something") {
return new Error("something is not allowed as username");
}
// Return the value unchanged
return value;
}; …Run Code Online (Sandbox Code Playgroud) 我在电报机器人创建方面还很陌生。我正在使用python-telegram-bot模块来构建电报机器人。我陷入了实现一个内联按钮的困境,该按钮在单击时会更改其文本。您能分享一些来源或方式吗?提前致谢。
简而言之,我的意思如下。例如,带有文本“1”的内联按钮,当我单击时我希望它更改为“2”。
def one(update, context):
"""Show new choice of buttons"""
query = update.callback_query
bot = context.bot
keyboard = [
[InlineKeyboardButton("3", callback_data=str(THREE)),
InlineKeyboardButton("4", callback_data=str(FOUR))]
]
keyboard[0][int(query)-1] = InlineKeyboardButton("X", callback_data=str(THREE))
reply_markup = InlineKeyboardMarkup(keyboard)
bot.edit_message_text(
chat_id=query.message.chat_id,
message_id=query.message.message_id,
text="First CallbackQueryHandler, Choose a route",
reply_markup=reply_markup
)
return FIRST
Run Code Online (Sandbox Code Playgroud) 我正在将 .mp4 文件转码为 hls 格式,并进入以下命令行。命令:ffmpeg -y -vsync 0 -hwaccel cuda -hwaccel_output_format cuda -i input.mp4 -vf scale_npp=1280:720 -c:a copy -c:v h264_nvenc -b:v 8M -g 3 -hls_time 2 -hls_list_size 0 -f hls output.m3u8。我找不到-g标志的定义。这是什么意思?
我默认使用 IsAuthenticated 权限,假设我不想更改默认权限。是否可以向特定URL授予AllowAny权限?
urlpatterns = [
path('admin/', admin.site.urls),
path('api/', include('user.urls')),
path('api/section/', include('section.urls')),
path('docs/', include_docs_urls(title='Great Soft Uz')) # I want this url to be public
]
Run Code Online (Sandbox Code Playgroud)
提前致谢
如何向 Gin golang 返回的响应添加默认标头?我想添加Cache-Control: public, max-age=604800, immutable到我返回的每个回复中。
我正在开发一个推送通知,向客户端发送许多消息。消息被发布到主题中,订阅者从同一主题中读取消息。如果在从主题偏移量读取消息后立即出现错误,即使我无法发送消息,我的订阅者也需要读取下一条消息并发送它。我所说的错误是指服务器停机或出现严重问题。
如何阅读带有确认信息的消息?
go ×2
apache-kafka ×1
django ×1
express ×1
ffmpeg ×1
go-gin ×1
javascript ×1
joi ×1
node.js ×1
python ×1
telegram-bot ×1
validation ×1