Skip to content

Commit

Permalink
translation
Browse files Browse the repository at this point in the history
  • Loading branch information
fanhousanbu committed Mar 17, 2024
1 parent c6fcc42 commit ec94732
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
6 changes: 3 additions & 3 deletions config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ max_backups=3

#消息模板
[message]
join_hint="欢迎 [%s](%s) 加入 %s\n️本群已开启新成员验证功能,未通过验证的用户无法发言 \n超时未完成验证会被移除本群! \n⏱本条消息 %d 秒后自动删除\n👇点击下方按钮自助解除禁言"
captcha_image="欢迎您加入[%s]\n本群已开启新成员验证功能。\n👆为了证明您不是机器人,请发送以上图片验证码内容\n🤖机器人将自动验证您发送的验证码内容是否正确\n本条验证消息有效期[%d]"
verification_complete="恭喜您成功通过[🤖人机验证],系统已为您解除禁言限制。\n如若还是无法发言,请重启telegram客户端\n请同时注意群内发言规范,以防永久禁止"
join_hint="Welcom [%s](%s) to join %s\\!\n️ This group has enabled new member verification\\.\n User who failed to complete verification in time will be removed from this group\\!\n ⏱ This message will be deleted after %d seconds automatically\\.\n 👇 Click the button below to self\\-unmute\\."
captcha_image="Welcome to join[%s]!\nThis group has enabled new member verification.\n👆Please send the captcha above\n🤖I'll check if it is correct\nThis message is vaild in [%d]seconds"
verification_complete="Welcome to join us!\nYou can restart telegram if you still can't speak.\nPlease also pay attention to the norms of communication to avoid permanent bans."
block_hint="\\#封禁预警\n[%s](%s) 请注意,您的消息中含有部分违禁词 \n⚠️您已被系统判断为高风险用户,已被封禁\n系统已向超管发送预警信息,若由超管判定为误杀,会及时将您解除封禁。\n您的违禁词包含:%s"

#广告阻止
Expand Down
22 changes: 12 additions & 10 deletions telegram/handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ func StartCaptcha(c tb.Context) error {
File: tb.FromDisk(imgUrl),
Caption: captchaMessage,
}
refreshCaptchaImageBtn := captchaMessageMenu.Data("🔁刷新验证码", "refreshCaptchaImageBtn", captchaId)
refreshCaptchaImageBtn := captchaMessageMenu.Data("🔁Refresh", "refreshCaptchaImageBtn", captchaId)
Bot.Handle(&refreshCaptchaImageBtn, refreshCaptcha())
captchaMessageMenu.Inline(
captchaMessageMenu.Row(refreshCaptchaImageBtn),
)
botMsg, err := Bot.Send(c.Chat(), sendMessage, captchaMessageMenu)
if err != nil {
log.Sugar.Error("[StartCaptcha] send image captcha err:", err)
return c.Send("服务器异常~,请稍后再试")
return c.Send("Service is busy,please try later")
}
err = service.SetCaptchaCodeMessageIdByCaptchaId(captchaId, botMsg.ID)
if err != nil {
Expand Down Expand Up @@ -165,20 +165,20 @@ func VerificationProcess(c tb.Context) error {
captchaId, ok := captchaIdObj.(string)
if !ok {
log.Sugar.Error("Value is not a string")
return c.Send("服务器异常~,请稍后再试")
return c.Send("Service is busy,please try later")
}
captchaRecord, err := service.GetRecordByCaptchaId(captchaId)
if err != nil {
log.Sugar.Error("[VerificationProcess] GetRecordByCaptchaId err:", err)
return c.Send("服务器异常~,请稍后再试")
return c.Send("Service is busy,please try later")
}
if captchaRecord.ID <= 0 || captchaRecord.TelegramUserId != c.Sender().ID || captchaRecord.CaptchaStatus != model.CaptchaStatusPending {
return c.Send("您在该群没有待验证记录,或已超时,请重新加入后验证")
}
// 验证
replyCode := c.Message().Text
if !captcha.VerifyCaptcha(captchaRecord.CaptchaCode, replyCode) {
return c.Send("验证码错误,请重新输入!")
return c.Send("Incorrect captcha")
}
// 解禁用户
err = Bot.Restrict(&tb.Chat{ID: captchaRecord.TelegramChatId}, &tb.ChatMember{
Expand All @@ -187,7 +187,7 @@ func VerificationProcess(c tb.Context) error {
})
if err != nil {
log.Sugar.Error("[OnTextMessage] unban err:", err)
return c.Send("服务器异常~,请稍后重试~")
return c.Send("Service is busy,please try later")
}
err = service.SuccessRecordByCaptchaId(captchaId)
if err != nil {
Expand All @@ -205,6 +205,8 @@ func VerificationProcess(c tb.Context) error {
func UserJoinGroup(c tb.Context) error {
var err error

m := c.ChatMember().NewChatMember.Role
_ = m
if c.ChatMember().NewChatMember.Role != tb.Member {
return nil
}
Expand Down Expand Up @@ -232,10 +234,10 @@ func UserJoinGroup(c tb.Context) error {
chat.Title,
config.SystemC.JoinHintAfterDelTime)
captchaId := uuid.NewV4().String()
doCaptchaBtn := joinMessageMenu.URL("👉🏻点我开始人机验证🤖", fmt.Sprintf("https://t.me/%s?start=%s", Bot.Me.Username, captchaId))
doCaptchaBtn := joinMessageMenu.URL("👉🏻To Verify🤖", fmt.Sprintf("https://t.me/%s?start=%s", Bot.Me.Username, captchaId))
var (
manageBanBtn = joinMessageMenu.Data("👮‍管理员禁止🈲", "manageBanBtn", captchaId)
managePassBtn = joinMessageMenu.Data("👮‍管理员通过✅", "managePassBtn", captchaId)
manageBanBtn = joinMessageMenu.Data("👮Ban🈲", "manageBanBtn", captchaId)
managePassBtn = joinMessageMenu.Data("👮Pass✅", "managePassBtn", captchaId)
)
// 按钮点击事件
Bot.Handle(&manageBanBtn, ManageBan(), isManageMiddleware)
Expand Down Expand Up @@ -366,7 +368,7 @@ func refreshCaptcha() func(c tb.Context) error {
})
}
return c.Respond(&tb.CallbackResponse{
Text: "验证码已刷新~",
Text: "Refreshed",
})
}
}
Expand Down

0 comments on commit ec94732

Please sign in to comment.