You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ur right, we can consider create some factory method to help create a MiraiBot instance and make MiraiBot's ctor private.
maybe i will take into it after finish #89.
Uh oh!
There was an error while loading. Please reload this page.
https://github.com/SinoAHpx/Mirai.Net/blob/35814dc6d3ef69d952f96568c5ba4c2a0860b4b6/Mirai.Net/Sessions/MiraiBot.cs#L46
在Http下,该项目使用了大量的MiraiBot单例进行HTTP请求,对于多个MiraiBot对象没办法单独使用,只能使用最新的一个Bot实例。
大部分在 Mirai.Net.Sessions.Http.Managers 、Mirai.Net.Utils.Internal.MiraiHttpUtils 下
拿MiraiHttpUtils中的一个举例
https://github.com/SinoAHpx/Mirai.Net/blob/35814dc6d3ef69d952f96568c5ba4c2a0860b4b6/Mirai.Net/Utils/Internal/MiraiHttpUtils.cs#L52-L64
该段引用了静态单例实例,MiraiBot.Instance.HttpSessionKey,从而导致无法对不同的MiraiBot对象进行操作。
所以我觉得应该改为以下格式,应该传入MiraiBot实例,改为可以单独使用的静态方法,然后添加this关键字弄成扩展方法,这样Mirai对象可以直接点出该方法进行使用
这只是一个建议,我是无所谓的,只是觉得不合理。静态拓展方法不应该使用单例Bot,应该使用参数进行传参,否则就没必要封装一个静态拓展方法。
The text was updated successfully, but these errors were encountered: