Skip to content

Commit 50c4fb8

Browse files
committed
feat: Check if UGO is active for Scavs hunt nonces
1 parent 2538667 commit 50c4fb8

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/ps/handlers/raw/scavengers.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { HUNT_ANNOUNCEMENTS_CHANNEL, HUNT_BY_ROLE } from '@/discord/constants/se
55
import { getChannel } from '@/discord/loaders/channels';
66
import { IS_ENABLED } from '@/enabled';
77
import { createNonce } from '@/ps/commands/nonce';
8+
import { isUGOActive } from '@/ps/ugo';
89
import { toId } from '@/tools';
910
import { Button } from '@/utils/components/ps';
1011

@@ -69,13 +70,15 @@ export function checkHunts(room: string, data: string) {
6970

7071
export function onEndHunt(this: Client, room: string, data: string) {
7172
if (!SCAVS_ROOMS.includes(room)) return;
72-
const isMainRoom = room === 'scavengers';
73+
const isMainRoom = room === 'groupchat-scavengers-test';
7374

7475
const huntEnd = data.match(HUNT_END_PATTERN) as { groups: { type: HuntType } } | null;
7576

7677
if (huntEnd) {
7778
// Hunt ended
7879
if (!isMainRoom) return;
80+
if (!isUGOActive()) return;
81+
7982
let nonceCommand: ';addhunt' | ';addfishunt' | ';addminifishhunt' | null = null;
8083

8184
switch (huntEnd.groups.type) {
@@ -98,15 +101,15 @@ export function onEndHunt(this: Client, room: string, data: string) {
98101
},
99102
// TODO: Perms should have an inbuilt way to check a specific room
100103
message => {
101-
const scavs = message.parent.getRoom('Scavengers');
104+
const scavs = message.parent.getRoom(room);
102105
if (!scavs) return false;
103106
const roomUser = scavs.users.find(user => toId(user) === message.author.id);
104107
if (!roomUser) return false;
105108
return isStaff(roomUser);
106109
}
107110
);
108111

109-
this.getRoom('Scavengers').sendHTML(
112+
this.getRoom(room).sendHTML(
110113
<div>
111114
<Button value={`/botmsg ${this.status.username},${prefix}nonce ${nonceKey}`}>Add {huntEnd.groups.type} hunt to UGO</Button>
112115
</div>,

0 commit comments

Comments
 (0)