diff --git a/scripts/db/update.ts b/scripts/db/update.ts index 1833d7a6..d8234736 100644 --- a/scripts/db/update.ts +++ b/scripts/db/update.ts @@ -185,12 +185,14 @@ async function blockChannels({ loader }: { loader: IssueLoader }) { if (found) return const channel = data.getString('channel_id') + const reason = data.getString('reason')?.toLowerCase() const ref = data.getString('ref') - if (!channel || !ref) return + if (!channel || !reason || !ref) return blocklist.push( new Blocked({ channel, + reason, ref }) ) diff --git a/scripts/models/blocked.ts b/scripts/models/blocked.ts index 1de7a198..1bc38886 100644 --- a/scripts/models/blocked.ts +++ b/scripts/models/blocked.ts @@ -1,14 +1,17 @@ type BlockedProps = { channel: string + reason: string ref: string } export class Blocked { channel: string + reason: string ref: string - constructor({ ref, channel }: BlockedProps) { + constructor({ ref, reason, channel }: BlockedProps) { this.channel = channel + this.reason = reason this.ref = ref } } diff --git a/scripts/schemes/blocklist.ts b/scripts/schemes/blocklist.ts index 530862bc..9da691c0 100644 --- a/scripts/schemes/blocklist.ts +++ b/scripts/schemes/blocklist.ts @@ -4,5 +4,8 @@ export default { channel: Joi.string() .regex(/^[A-Za-z0-9]+\.[a-z]{2}$/) .required(), + reason: Joi.string() + .valid(...['dmca', 'nsfw']) + .required(), ref: Joi.string().uri().required() }