Skip to content

Commit b2e6a56

Browse files
committed
add shout out
1 parent 6c23b52 commit b2e6a56

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import type { NextApiRequest, NextApiResponse } from 'next';
2+
import { createHandler } from '@/utils/createHandler';
3+
const so = (req: NextApiRequest, res: NextApiResponse) => {
4+
return createHandler({
5+
req,
6+
res,
7+
name: 'so',
8+
description: 'Send a shout-out to someone in chat! `!so @username`',
9+
handler: ({ author, args }) => {
10+
if (
11+
!author ||
12+
!author.roles.includes('SUBSCRIBER') ||
13+
!author.roles.includes('BROADCASTER')
14+
) {
15+
return;
16+
}
17+
18+
const soTarget = args.find((part) => part.startsWith('@'));
19+
if (!soTarget) {
20+
return;
21+
}
22+
23+
const twitchLink = `https://twitch.tv/${soTarget.replace('@', '')}`;
24+
25+
return {
26+
message: `▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ Please check out ${soTarget} at ${twitchLink} jlengsStreamBlitz jlengsHolyBucket jlengsBOOP ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬`
27+
};
28+
}
29+
});
30+
};
31+
export default so;

frontend/overlay/utils/createHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ interface EffectDefinition {
2626
args: string[];
2727
author: Author;
2828
extra: { channel: string };
29-
}) => Effect;
29+
}) => Effect | undefined;
3030
}
3131

3232
export const createHandler = ({ req, res, name, description, handler }: EffectDefinition) => {

0 commit comments

Comments
 (0)