Unable to add your handler #3500
-
|
When using OnBotSteamHandlersInit after receiving the required handler, the handler is null. This issue was tested on two different plugins; this problem appeared in newer versions. Can you tell me how to correctly add my own custom handler? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
Let me clarify that I noticed the problem with version 6.2.3.1 |
Beta Was this translation helpful? Give feedback.
-
|
You say the problem appeared in a new version, so which version was the last one where it worked properly? Because I don't remember any changes that could affect the functionality you claim that stopped working. The definition of the function in the interface is: /// <summary>
/// ASF will call this method right after bot initialization in order to allow you hooking custom SK2 client handlers into the SteamClient.
/// </summary>
/// <param name="bot">Bot object related to this callback.</param>
/// <returns>Collection of custom client handlers that are supposed to be hooked into the SteamClient by ASF. If you do not require any, just return null or empty collection.</returns>
Task<IReadOnlyCollection<ClientMsgHandler>?> OnBotSteamHandlersInit(Bot bot)So you just return an instance of your handler. var myHandler = new MyHandler(); // MyHandler class inherits from ClientMsgHandler
return Task.FromResult<IReadOnlyCollection<ClientMsgHandler>?>([ myHandler ]); |
Beta Was this translation helpful? Give feedback.
You say the problem appeared in a new version, so which version was the last one where it worked properly? Because I don't remember any changes that could affect the functionality you claim that stopped working.
The definition of the function in the interface is: