diff --git a/src/Action/LockAction.ts b/src/Action/LockAction.ts index 736bb7b..3e8cf03 100644 --- a/src/Action/LockAction.ts +++ b/src/Action/LockAction.ts @@ -5,6 +5,10 @@ import Snoowrap, {Comment, Submission} from "snoowrap"; export class LockAction extends Action { name?: string = 'Lock'; async handle(item: Comment|Submission, client: Snoowrap): Promise { + if (item instanceof Submission) { + // @ts-ignore + await item.lock(); + } } } diff --git a/src/Action/RemoveAction.ts b/src/Action/RemoveAction.ts index a3f494d..7224b07 100644 --- a/src/Action/RemoveAction.ts +++ b/src/Action/RemoveAction.ts @@ -5,6 +5,8 @@ import Snoowrap, {Comment, Submission} from "snoowrap"; export class RemoveAction extends Action { name?: string = 'Remove'; async handle(item: Comment|Submission, client: Snoowrap): Promise { + // @ts-ignore + await item.remove(); } } diff --git a/src/Action/ReportAction.ts b/src/Action/ReportAction.ts index 7315e07..7cd121e 100644 --- a/src/Action/ReportAction.ts +++ b/src/Action/ReportAction.ts @@ -11,7 +11,9 @@ export class ReportAction extends Action { this.content = options.content; } - async handle(item: Comment|Submission, client: Snoowrap): Promise { + async handle(item: Comment | Submission, client: Snoowrap): Promise { + // @ts-ignore + await item.report({reason: content}); } } diff --git a/src/Action/SubmissionAction/FlairAction.ts b/src/Action/SubmissionAction/FlairAction.ts index bdd3ee4..7109f53 100644 --- a/src/Action/SubmissionAction/FlairAction.ts +++ b/src/Action/SubmissionAction/FlairAction.ts @@ -3,8 +3,8 @@ import Action, {ActionJSONConfig} from "../index"; import Snoowrap, {Comment, Submission} from "snoowrap"; export class FlairAction extends Action { - text?: string; - css?: string; + text: string; + css: string; name?: string = 'Flair'; constructor(options: FlairActionOptions) { @@ -12,11 +12,15 @@ export class FlairAction extends Action { if (options.text === undefined && options.css === undefined) { throw new Error('Must define either text or css on FlairAction'); } - this.text = options.text; - this.css = options.css; + this.text = options.text || ''; + this.css = options.css || ''; } async handle(item: Comment | Submission, client: Snoowrap): Promise { + if (item instanceof Submission) { + // @ts-ignore + await item.assignFlair({text: this.text, cssClass: this.css}) + } } }