Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSessionPlugin.php
More file actions
Latest commit
30 lines (27 loc) · 1.05 KB
/
Copy pathSessionPlugin.php
File metadata and controls
30 lines (27 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
namespacekjBotModule\kj415j45\CoreModule;
usekjBot\Framework\Plugin;
usekjBot\Framework\Event\MessageEvent;
usekjBot\Framework\DataStorage;
usekjBot\Framework\Message;
usekjBot\Framework\QuitException;
usekjBot\Framework\SilenceModule;
class SessionPlugin extends Plugin{
public$handleDepth = 1;
publicfunctionmessage(MessageEvent$event): ?Message{
$session = json_decode(DataStorage::GetData("CoreModule.Session/{$event->getId()}"));
if($session !== NULL){
SilenceModule::$silence = true;
try{
$obj = (new \ReflectionClass($session->class))->newInstance();
$method = new \ReflectionMethod($session->class, $session->method);
return$msg = $method->invoke($obj, $event);
}catch(\ReflectionException$e){
d("Reflect error: {$e->getMessage()}");
q('反射你的会话文件失败,请联系master');
}catch(QuitException$e){
throw$e;
}
}elsereturnNULL;
}
}