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

关于重复抽签的建议 #25

Open
MeetWq opened this issue Jul 14, 2022 · 3 comments
Open

关于重复抽签的建议 #25

MeetWq opened this issue Jul 14, 2022 · 3 comments
Labels
help wanted Extra attention is needed
Milestone

Comments

@MeetWq
Copy link
Contributor

MeetWq commented Jul 14, 2022

random.choice 之前可以设置 seed,如以当前日期和用户qq号作为 seed

date = datetime.now().strftime("%Y%m%d")
random.seed(f"{date}-{user_id}")

这样可以保证用户当天抽到的是一样的,还可以省去判断是否抽过签以及清理抽签图片的麻烦

@KafCoppelia
Copy link
Member

如此,如何对应抽签的图片和文案呢?

还需增加group_id

@KafCoppelia KafCoppelia added the enhancement New feature or request label Jul 14, 2022
@MeetWq
Copy link
Contributor Author

MeetWq commented Jul 14, 2022

可以在抽图片和文案时都用同样的 seed
但我感觉图片每天是否一样并不影响
group_id 其实也可以不加,这样用户无论在那个群抽到的都是一样的
还是你来决定怎样合适吧

@KafCoppelia
Copy link
Member

不是这个意思,是生成的seed如何与具体的图片+文案对应的问题,如果能对应,下次直接通过seed重复步骤生成即可,但是速度(当没缓存时)肯定比现在慢。
group_id是当找到对应方案后,我倾向于不同群分开管理。
这点倒是我v0.5.x想改进的方面。

@KafCoppelia KafCoppelia added this to the v0.5.0 milestone Jul 16, 2022
@KafCoppelia KafCoppelia added help wanted Extra attention is needed and removed enhancement New feature or request labels Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants