Skip to content
This repository was archived by the owner on Aug 16, 2024. It is now read-only.

Commit 33f8b3a

Browse files
committed
MiraiBot类 新增 On 方法;
1 parent 5d97047 commit 33f8b3a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

include/mirai_bot.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,17 @@ namespace Cyan
501501

502502
}
503503

504+
template<typename T>
505+
void On(const EventProcessor<T>& ep)
506+
{
507+
processors_.insert({ GetEventName<T>(),
508+
[=](WeakEvent we)
509+
{
510+
ep(*(std::dynamic_pointer_cast<T>(we)));
511+
}
512+
});
513+
}
514+
504515
template<typename T>
505516
void OnEventReceived(const EventProcessor<T>& ep)
506517
{

0 commit comments

Comments
 (0)