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

使用‘==’运算符比较消息链是否相同的问题 #33

Closed
EnkanSakura opened this issue Oct 22, 2021 · 2 comments
Closed

使用‘==’运算符比较消息链是否相同的问题 #33

EnkanSakura opened this issue Oct 22, 2021 · 2 comments
Milestone

Comments

@EnkanSakura
Copy link

直接使用‘==’对MessageChain对象进行比较时,会同时比较MessageChain的Source组件,导致mirai码相同的消息链的比较结果为False
需要一个只对消息内容进行比较的方法

@Wybxc
Copy link
Collaborator

Wybxc commented Oct 22, 2021

这一问题属于MessageChain的设计失误,我会考虑在0.3.0版本中重构MessageChain的一些设计,来避免这个问题。

当前版本中,可以先用exclude方法去除Source元素后,再进行比较,例如:

msg1.exclude(Source) == msg2.exclude(Source)

@Wybxc Wybxc added this to the 0.3.0 milestone Dec 3, 2021
@Wybxc Wybxc closed this as completed Jan 13, 2022
@Wybxc
Copy link
Collaborator

Wybxc commented Jan 13, 2022

0.3.0 更新中解决了这个问题(应该吧)

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