Skip to content

Commit 1f345ed

Browse files
committed
feat: Support getting own perms
1 parent b08a2eb commit 1f345ed

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

src/i18n/english.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ export default {
9595
ALTS: 'Alts: {{alts}}',
9696
BOOP: 'BOOP',
9797
UPTIME: 'The Bot has been running for {{time}}.',
98+
RANK: 'Your rank is {{rank}}.',
9899
PONG: 'Pong!',
99100
ROOM_NOT_GIVEN: 'Did not receive a room within a minute',
100101

src/ps/commands/myperms.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { rankOrder } from '@/ps/handlers/chat/permissions';
2+
3+
import type { PSCommand } from '@/types/chat';
4+
5+
export const command: PSCommand = {
6+
name: 'myperms',
7+
help: 'Displays your highest permissions',
8+
syntax: 'CMD',
9+
aliases: ['me'],
10+
async run({ message, broadcast, checkPermissions, $T }) {
11+
const highestRank = rankOrder.findLast(rank => checkPermissions(rank));
12+
if (!highestRank) throw new Error(`You are the lowest of the low. This shouldn't have happened for you, ${message.author.name}`);
13+
broadcast($T('COMMANDS.RANK', { rank: highestRank }));
14+
},
15+
};

0 commit comments

Comments
 (0)