Tagscript

@tagscript/plugin-discord


Class: DenyParser

Defined in: tagscript-plugin-discord/src/lib/Parsers/AllowDeny.ts:88

The blacklist tag will attempt to convert the given parameter into a channel, role, or user using name or Id. If the user running the tag is in the targeted channel or has the targeted role or their id isn't same as targeted user's id, the tag will stop processing and it will send the response if one is given. Multiple user, role or channel requirements can be given, and should be split by a ,.

Examples

{deny(user,role,channel):response}

Aliases: denylist, blacklist

{deny(Moderator)}
{deny(#general, #chat):This tag can't be run in #general and #chat.}
{deny(757425366209134764, 668713062186090506, 737961895356792882):You aren't allowed to use this tag.}

Developers need to add the check themselves.

const { Interpreter } = require("tagscript")
const { DenyParser } = require("@tagscript/plugin-discord")
 
const ts = new Interpreter(new DenyParser())
 
const result = await ts.run("{require(id1, id2):You aren't allowed to use this tag.}")
 
if (result.actions.deny.ids.includes(interaction.user.id)) {
// add channel, role check here or check using name instead of id
return interaction.reply(result.actions.deny.message)
}

Extends

  • BaseParser

Implements

  • IParser

Constructors

new DenyParser()

new DenyParser(): DenyParser

Defined in: tagscript-plugin-discord/src/lib/Parsers/AllowDeny.ts:89

Returns

DenyParser

Overrides

BaseParser.constructor

Properties

acceptedNames

protected acceptedNames: string[]

Defined in: tagscript/dist/index.d.ts:381

Inherited from

BaseParser.acceptedNames


requiredParameter

protected requiredParameter: boolean

Defined in: tagscript/dist/index.d.ts:382

Inherited from

BaseParser.requiredParameter


requiredPayload

protected requiredPayload: boolean

Defined in: tagscript/dist/index.d.ts:383

Inherited from

BaseParser.requiredPayload

Methods

parse()

parse(ctx): null | ""

Defined in: tagscript-plugin-discord/src/lib/Parsers/AllowDeny.ts:93

Parses the given tag.

Parameters

ctx

Context

The context of the tag.

Returns

null | ""

Implementation of

IParser.parse


toJSON()

toJSON(): object

Defined in: tagscript/dist/index.d.ts:386

Returns

object

acceptedNames

acceptedNames: string[]

requiredParameter

requiredParameter: boolean

requiredPayload

requiredPayload: boolean

Inherited from

BaseParser.toJSON


willAccept()

willAccept(ctx): boolean

Defined in: tagscript/dist/index.d.ts:385

Parameters

ctx

Context

Returns

boolean

Implementation of

IParser.willAccept

Inherited from

BaseParser.willAccept