Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于kv写入次数的问题 #5

Open
Lincest opened this issue Oct 25, 2023 · 1 comment
Open

关于kv写入次数的问题 #5

Lincest opened this issue Oct 25, 2023 · 1 comment

Comments

@Lincest
Copy link

Lincest commented Oct 25, 2023

现在cf的免费kv写入次数貌似是1000次,而bot对于每个消息均会将msg id写入到数据库,导致bot一天最多只能免费转发1000次消息,能否改进一下这个机制?

目前的想法: kv 存储 uid 而不是 msg id?

@LloydAsp
Copy link
Owner

首先,由于telegram bot api本身没有设计获取message信息的api,所以必须在回调的时候储存某个消息的原始发送者,用户在回复forward的信息的时候,机器人才知道要转发给谁,因此这一步从逻辑上不可避免。或许可以压缩连续相同message的发送者为一个,仅当发送者的id改变的时候进行记录,但这个思路也不是很好设计。

一种可行的思路是用cloudflare d1数据库存储来储存这个映射关系,因为目前d1数据库没有读写次数限制

参考:
bots - How to get message info by ID [Telegram API] - Stack Overflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants