Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new automod endpoints in the moderation API
Part of #314
- Loading branch information
1 parent
6433a8d
commit a97a101
Showing
4 changed files
with
245 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
packages/api/src/api/helix/moderation/HelixAutoModSettings.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import { DataObject, rawDataSymbol, rtfm } from '@twurple/common'; | ||
|
||
/** @private */ | ||
export interface HelixAutoModSettingsData { | ||
broadcaster_id: string; | ||
moderator_id: string; | ||
overall_level: number | null; | ||
disability: number; | ||
aggression: number; | ||
sexuality_sex_or_gender: number; | ||
misogyny: number; | ||
bullying: number; | ||
swearing: number; | ||
race_ethnicity_or_religion: number; | ||
sex_based_terms: number; | ||
} | ||
|
||
/** | ||
* The AutoMod settings of a channel. | ||
*/ | ||
@rtfm<HelixAutoModSettings>('api', 'HelixAutoModSettings', 'broadcasterId') | ||
export class HelixAutoModSettings extends DataObject<HelixAutoModSettingsData> { | ||
/** | ||
* The ID of the broadcaster for which the AutoMod settings are retrieved. | ||
*/ | ||
get broadcasterId(): string { | ||
return this[rawDataSymbol].broadcaster_id; | ||
} | ||
|
||
/** | ||
* The ID of a user that has permission to moderate the broadcaster's chat room. | ||
*/ | ||
get moderatorId(): string { | ||
return this[rawDataSymbol].moderator_id; | ||
} | ||
|
||
/** | ||
* The default AutoMod level for the broadcaster. This is null if the broadcaster changed individual settings. | ||
*/ | ||
get overallLevel(): number | null { | ||
return this[rawDataSymbol].overall_level ? this[rawDataSymbol].overall_level : null; | ||
} | ||
|
||
/** | ||
* The Automod level for discrimination against disability. | ||
*/ | ||
get disability(): number { | ||
return this[rawDataSymbol].disability; | ||
} | ||
|
||
/** | ||
* The Automod level for hostility involving aggression. | ||
*/ | ||
get aggression(): number { | ||
return this[rawDataSymbol].aggression; | ||
} | ||
|
||
/** | ||
* The AutoMod level for discrimination based on sexuality, sex, or gender. | ||
*/ | ||
get sexualitySexOrGender(): number { | ||
return this[rawDataSymbol].sexuality_sex_or_gender; | ||
} | ||
|
||
/** | ||
* The Automod level for discrimination against women. | ||
*/ | ||
get misogyny(): number { | ||
return this[rawDataSymbol].misogyny; | ||
} | ||
|
||
/** | ||
* The Automod level for hostility involving name calling or insults. | ||
*/ | ||
get bullying(): number { | ||
return this[rawDataSymbol].bullying; | ||
} | ||
|
||
/** | ||
* The Automod level for profanity. | ||
*/ | ||
get swearing(): number { | ||
return this[rawDataSymbol].swearing; | ||
} | ||
|
||
/** | ||
* The Automod level for racial discrimination. | ||
*/ | ||
get raceEthnicityOrReligion(): number { | ||
return this[rawDataSymbol].race_ethnicity_or_religion; | ||
} | ||
|
||
/** | ||
* The Automod level for sexual content. | ||
*/ | ||
get sexBasedTerms(): number { | ||
return this[rawDataSymbol].sex_based_terms; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
packages/api/src/api/helix/moderation/HelixAutoModStatus.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { DataObject, rawDataSymbol, rtfm } from '@twurple/common'; | ||
|
||
/** @private */ | ||
export interface HelixAutoModStatusData { | ||
msg_id: string; | ||
is_permitted: boolean; | ||
} | ||
|
||
/** | ||
* The status of a message that says whether it is permitted by AutoMod or not. | ||
*/ | ||
@rtfm<HelixAutoModStatus>('api', 'HelixAutoModStatus', 'messageId') | ||
export class HelixAutoModStatus extends DataObject<HelixAutoModStatusData> { | ||
/** | ||
* The developer-generated ID that was sent with the request data. | ||
*/ | ||
get messageId(): string { | ||
return this[rawDataSymbol].msg_id; | ||
} | ||
|
||
/** | ||
* Whether the message is permitted by AutoMod or not. | ||
*/ | ||
get isPermitted(): boolean { | ||
return this[rawDataSymbol].is_permitted; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters