Skip to content

Commit b79e471

Browse files
committed
refactor: Use the 'allowPMs' flag instead of 'roomOnly'
1 parent 7a782e6 commit b79e471

23 files changed

Lines changed: 42 additions & 27 deletions

src/ps/commands/alts.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export const command: PSCommand = {
88
name: 'alts',
99
help: "Lists a user's alts. Requires trusted perms to view beyond your own.",
1010
syntax: 'CMD [user?]',
11+
flags: { allowPMs: true },
1112
aliases: ['getalts'],
1213
categories: ['utility'],
1314
async run({ message, arg, $T, checkPermissions }) {

src/ps/commands/auth.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ export const command: PSCommand[] = IS_ENABLED.DB
3737
name: 'promote',
3838
help: 'Promotes a user.',
3939
syntax: 'CMD [rank], [users...]',
40-
flags: {
41-
roomOnly: true,
42-
},
4340
categories: ['utility'],
4441
extendedAliases: {
4542
...Object.fromEntries(
@@ -120,9 +117,6 @@ export const command: PSCommand[] = IS_ENABLED.DB
120117
name: 'deauth',
121118
help: 'Demotes a user.',
122119
syntax: 'CMD [users...]',
123-
flags: {
124-
roomOnly: true,
125-
},
126120
categories: ['utility'],
127121
async run({ message, arg, checkPermissions, $T }) {
128122
const userList = arg.split(',');

src/ps/commands/commands.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { PSCommands } from '@/cache';
2+
import { prefix } from '@/config/ps';
23
import { permissions } from '@/ps/handlers/commands/permissions';
34
import { getSpoofMessage } from '@/ps/handlers/commands/spoof';
45

56
import type { PSCommand } from '@/types/chat';
6-
import { prefix } from '@/config/ps';
77

88
function titleCase(input: string): string {
99
return input.charAt(0).toUpperCase() + input.slice(1);
@@ -13,6 +13,7 @@ export const command: PSCommand = {
1313
name: 'commands',
1414
help: 'Displays a list of commands that can be used by the user.',
1515
syntax: 'CMD [room?]',
16+
flags: { allowPMs: true },
1617
categories: ['utility'],
1718
async run({ message, arg }) {
1819
const targetRoom = arg ? message.parent.getRoom(arg) : message.type === 'chat' ? message.target : null;

src/ps/commands/dt.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export const command: PSCommand[] = [
1515
name: 'dt',
1616
help: 'Shows the data for a Pokémon.',
1717
syntax: 'CMD [mon/move]',
18+
flags: { allowPMs: true },
1819
categories: ['utility'],
1920
// TODO: Keep this GO-only
2021
async run({ broadcastHTML, arg, $T }) {

src/ps/commands/echo.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export const command: PSCommand = {
77
name: 'echo',
88
help: 'Echoes the given text',
99
syntax: 'CMD (text)',
10+
flags: { allowPMs: true },
1011
aliases: ['do'],
1112
perms: 'voice',
1213
categories: ['casual'],

src/ps/commands/eval.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export const command: PSCommand = {
77
name: 'eval',
88
help: 'Evaluates code',
99
syntax: 'CMD [code]',
10+
flags: { allowPMs: true },
1011
perms: 'admin',
1112
aliases: ['exec', 'run'],
1213
categories: ['utility'],

src/ps/commands/games/meta.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
import { PSGames } from '@/cache';
12
import { Games } from '@/ps/games';
23
import { renderMenu } from '@/ps/games/menus';
34

45
import type { PSCommand } from '@/types/chat';
56
import type { HTMLopts } from 'ps-client/classes/common';
67
import type { ReactElement } from 'react';
7-
import { PSGames } from '@/cache';
88

99
export const command: PSCommand = {
1010
name: 'games',

src/ps/commands/git.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export const command: PSCommand = {
55
name: 'git',
66
help: 'Links the GitHub repository.',
77
syntax: 'CMD',
8+
flags: { allowPMs: true },
89
categories: ['utility'],
910
async run({ broadcast }) {
1011
broadcast('https://github.com/PartMan7/PartBot' as NoTranslate);

src/ps/commands/help.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ export const command: PSCommand = {
142142
name: 'help',
143143
help: 'Shows the help for a command.',
144144
syntax: 'CMD [command]',
145+
flags: { allowPMs: true },
145146
categories: ['utility'],
146147
async run({ message, broadcastHTML, args, checkPermissions, $T }) {
147148
const Bot = message.parent;
@@ -192,7 +193,7 @@ export const command: PSCommand = {
192193
{Object.entries(command.flags).map(([flag, value]) => {
193194
if (!value) return null;
194195
if (flag === 'pmOnly') return 'Can only be used in PMs.';
195-
if (flag === 'roomOnly') return 'Can only be used in a chatroom.';
196+
if (flag === 'allowPMs') return 'Can be used in PMs.';
196197
})}
197198
</p>
198199
) : null}

src/ps/commands/hotpatch.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export const command: PSCommand = {
77
name: 'hotpatch',
88
help: 'Hotpatches stuff.',
99
syntax: 'CMD [hotpatch type]',
10+
flags: { allowPMs: true },
1011
perms: 'admin',
1112
categories: ['utility'],
1213
async run({ message, arg }) {

0 commit comments

Comments
 (0)