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 pathAliasModule.php
More file actions
Latest commit
34 lines (28 loc) · 1.08 KB
/
Copy pathAliasModule.php
File metadata and controls
34 lines (28 loc) · 1.08 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
31
32
33
34
<?php
namespacekjBotModule\kj415j45\CoreModule;
usekjBot\Framework\Module;
usekjBot\Framework\Message;
usekjBot\Framework\Event\MessageEvent;
class AliasModule extends Module{
publicfunctionprocess(array$args, MessageEvent$event): Message{
Access::Control($event)->hasLevelOrDie(AccessLevel::Supporter);
return$event->sendBack(
Session::Start($event->getId())
->prompt('请输入要设置的别名:', __CLASS__, 'setAliasName')
);
}
publicfunctionsetAliasName($event){
(newAlias($event->getId()))->setAlias($event->getMsg(), NULL);
return$event->sendBack(
Session::Start($event->getId())
->prompt('请输入要映射的命令:', __CLASS__, 'setAlias')
);
}
publicfunctionsetAlias($event){
$alias = newAlias($event->getId());
$aliasName = array_search(NULL, $alias->getAlias());
$alias->setAlias($aliasName, $event->getMsg());
Session::Stop($event->getId());
return$event->sendBack('设置成功');
}
}