mirror of https://github.com/Nofated095/Q2TG.git
feat: 显示当前启用的 flag 名称
This commit is contained in:
parent
31d9f503f1
commit
d98d5e72c9
|
@ -0,0 +1,14 @@
|
|||
import flags from '../constants/flags';
|
||||
|
||||
export default {
|
||||
displayFlag(flag: number) {
|
||||
const enabled = [];
|
||||
for (const name in flags) {
|
||||
const value = flags[name] as any as number;
|
||||
if (flag & value) {
|
||||
enabled.push(name);
|
||||
}
|
||||
}
|
||||
return ['0b' + flag.toString(2), ...enabled].join('\n');
|
||||
},
|
||||
};
|
|
@ -12,6 +12,7 @@ import { Friend, Group } from 'icqq';
|
|||
import { format } from 'date-and-time';
|
||||
import ZincSearch from 'zincsearch-node';
|
||||
import flags from '../constants/flags';
|
||||
import inChatCommandsHelper from '../helpers/inChatCommandsHelper';
|
||||
|
||||
export default class InChatCommandsService {
|
||||
private readonly log: Logger;
|
||||
|
@ -149,7 +150,7 @@ export default class InChatCommandsService {
|
|||
|
||||
public async editFlags(params: string[], pair: Pair) {
|
||||
if (!params.length) {
|
||||
return '0b' + pair.flags.toString(2);
|
||||
return inChatCommandsHelper.displayFlag(pair.flags);
|
||||
}
|
||||
if (params.length !== 2) return '参数格式错误';
|
||||
|
||||
|
@ -175,6 +176,6 @@ export default class InChatCommandsService {
|
|||
break;
|
||||
}
|
||||
|
||||
return '0b' + pair.flags.toString(2);
|
||||
return inChatCommandsHelper.displayFlag(pair.flags);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue