Comments (27)
模版功能已在 v2.1.8 正式版中添加支持,正在编译发布
from artalkgo.
模版分为两种类型,notify_tpl
和 mail_tpl
from artalkgo.
默认模板:
@{{reply_nick}}:
{{reply_content}}
{{link_to_reply}}
可用参数和邮件模板是一样的,可参考 https://artalk.js.org/guide/backend/email.html#%E9%82%AE%E4%BB%B6%E6%A8%A1%E6%9D%BF
from artalkgo.
Telegram 的 API 有毒,如果不转义的话,单独一个
_
或[
、]
、(
符号也会导致报错,总之非常容易报错 🥲
维持现状吧,全部转义是最安全的,这样不管是 markdown 还是 html 渲染都不会出错。
from artalkgo.
为了解决重复通知问题,我修改了配置文件:924a080
ArtalkGo/artalk-go.example.yml
Lines 134 to 149 in 924a080
from artalkgo.
通知模版等待做进一步工作,模版引擎需要从强耦合的邮件发送功能中独立拆分出来
from artalkgo.
重复通知问题似乎没有解决,使用 artalk/artalk-go:2.1.8-alpha.2
版本,设置通知如下
email:
- mail_subject_to_admin: '[{{site_name}}] 您的文章 "{{page_title}}" 有新回复'
admin_notify:
+ email:
+ enabled: false
+ mail_subject: '[{{site_name}}] 您的文章 "{{page_title}}" 有新回复'
telegram:
enabled: true
api_token: "111111111"
receivers:
- 1111111
依然会给管理员发送邮件通知,而且邮件标题也变成了无标题。
from artalkgo.
新版配置可参考此处:https://github.com/ArtalkJS/ArtalkGo/blob/master/artalk-go.example.yml#L134-L162
from artalkgo.
新版配置可参考此处:https://github.com/ArtalkJS/ArtalkGo/blob/master/artalk-go.example.yml#L134-L162
admin_notify.notify_tpl
这里的模板是不是专门给管理员发送通知邮件的模板?与前面给普通用户发送通知的邮件模版 email.mail_tpl
是不同的吧?
from artalkgo.
admin_notify.notify_tpl 仅是多元通知的模版,管理员邮件发送模版遵循 email.mail_tpl
from artalkgo.
也就是说 admin_notify.notify_tpl 是除了邮件通知之外的通知模板,是这个意思吧?
from artalkgo.
之后可以做一个,通过配置 admin_notify.email.mail_tpl
指定管理员邮件使用和普通用户不同的邮件模版。
from artalkgo.
是的,admin_notify.notify_tpl
是除了邮件通知之外的通知模板
from artalkgo.
之后可以做一个,通过配置
admin_notify.email.mail_tpl
指定管理员邮件使用和普通用户不同的邮件模版。
嗯,确实。管理员的邮件通知模板是可以和给普通用户的邮件通知的模板不同的,不过我个人需求不是很强烈,😂
from artalkgo.
是的,
admin_notify.notify_tpl
是除了邮件通知之外的通知模板
这个模板有像邮件模板那样的参考示例文件吗?
from artalkgo.
{{link_to_reply}}
现在支持已读标记了,但是链接变得比较长,就比较丑,以后我把 atk_notify_key
参数值改短一些
from artalkgo.
如果是 Telegram 的话,设置成文字的超链接应该就不影响了
from artalkgo.
对了,这个模板也是 html 文件吗?
from artalkgo.
TG 好像有自己的语法,并且不能带 < 尖括号,之前测试报了个错,然后我开了 HTML 转义
模板文件类型任意文件都可以,只要是纯文本格式就 OK
from artalkgo.
TG 的语法限制很多的,所以最好是直接把评论的内容用代码的形式包裹后输出,要不然如果评论内容里有什么不支持的语法,很容易报错。
from artalkgo.
notify_tpl 的 {{reply_content}}
我做过处理,表情图片标签 <img src
会被转为:[表情名]
然后 Artalk 前端存入数据库的数据,用户输入 Markdown 语法会直接存入数据库,不会被编译。
notify_tpl 中的 {{reply_content}}
是没编译的 Markdown 原始内容,但 mail_tpl 的是后端编译后的。
用户输入的 HTML 标签在 notify_tpl 中会被转义,使用 html.EscapeString 转义
from artalkgo.
那估计问题不大
from artalkgo.
{{link_to_reply}}
现在支持已读标记了,但是链接变得比较长,就比较丑,以后我把atk_notify_key
参数值改短一些
我自己在 TG 模板里自己用提供的参数拼接里一下,这样就去掉了 notify_key 那一串
{{site_url}}{{comment.page.key}}?atk_comment={{comment.id}}
from artalkgo.
https://core.telegram.org/bots/api#formatting-options
可以试试用:
[回复]({{link_to_reply}})
from artalkgo.
不太行,好像你对通知的内容都做了转义?无论是 markdown 还是 html 语法都无法渲染出来
from artalkgo.
转义的好处是不会因为不支持的语法而出现发送错误,问题就是无法渲染格式 😂
from artalkgo.
Telegram 的 API 有毒,如果不转义的话,单独一个 _
或 [
、]
、(
符号也会导致报错,总之非常容易报错 🥲
go-telegram-bot-api/telegram-bot-api#174
from artalkgo.
Related Issues (20)
- Artalk支持 远程Redis来缓存嘛 HOT 3
- 验证码数据根据 IP 来存储问题 HOT 1
- upgit 图片上传 HOT 2
- 性能优化 HOT 3
- Redis 缓存相关导致报错 HOT 11
- API 新增建议 HOT 11
- [Bug Report] 开启评论审核后无法发送回复通知 HOT 17
- 能否增加企业微信通知或者提供一个自定义的WebHook HOT 4
- 如何使用带有密码认证的Redis缓存 HOT 1
- 随机查询 HOT 8
- Windows系统下时区异常 HOT 4
- 非管理员用户侧边栏提示错误:Referer 不被允许 HOT 5
- 优化关于docker的配置文件映射问题 HOT 2
- 配置可信域名后前端依旧提升跨域不能访问 HOT 2
- api 返回最新评论,增加返回用户头像地址。。 HOT 3
- 管理员地址是什么,文档没介绍后端管理地址,没找到 HOT 2
- 导入评论时必须指定目标站点 URL的问题 HOT 2
- 使用控制中心自带的导入其他系统的评论功能成功后不能在评论表单下面显示,只能在控制中心看 HOT 1
- 飞书通知设置无效 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from artalkgo.