Skip to content

Commit

Permalink
fix check automod status
Browse files Browse the repository at this point in the history
fixes #549
  • Loading branch information
d-fischer committed Feb 18, 2024
1 parent 8240b3a commit ce9729c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
5 changes: 2 additions & 3 deletions packages/api/src/endpoints/moderation/HelixModerationApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
createAutoModProcessBody,
createAutoModSettingsBody,
createBanUserBody,
createCheckAutoModStatusBody,
createModerationUserListQuery,
createModeratorModifyQuery,
createUpdateShieldModeStatusBody,
Expand Down Expand Up @@ -214,9 +215,7 @@ export class HelixModerationApi extends BaseApi {
userId: extractUserId(channel),
scopes: ['moderation:read'],
query: createBroadcasterQuery(channel),
jsonBody: {
data,
},
jsonBody: createCheckAutoModStatusBody(data),
});

return result.data.map(statusData => new HelixAutoModStatus(statusData));
Expand Down
17 changes: 16 additions & 1 deletion packages/api/src/interfaces/endpoints/moderation.external.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { extractUserId, type UserIdResolvable } from '@twurple/common';
import { type HelixAutoModSettings } from '../../endpoints/moderation/HelixAutoModSettings';
import { type HelixBanFilter, type HelixBanUserRequest, type HelixModeratorFilter } from './moderation.input';
import {
type HelixBanFilter,
type HelixBanUserRequest,
type HelixCheckAutoModStatusData,
type HelixModeratorFilter,
} from './moderation.input';

/** @private */
export interface HelixAutoModSettingsData {
Expand Down Expand Up @@ -133,3 +138,13 @@ export function createUpdateShieldModeStatusBody(activate: boolean) {
is_active: activate,
};
}

/** @internal */
export function createCheckAutoModStatusBody(data: HelixCheckAutoModStatusData[]) {
return {
data: data.map(entry => ({
msg_id: entry.messageId,
msg_text: entry.messageText,
})),
};
}

0 comments on commit ce9729c

Please sign in to comment.